Changeset 4c53333 in mainline for uspace/lib/c/include/io/con_srv.h
- Timestamp:
- 2013-07-11T08:21:10Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 64e63ce1
- Parents:
- 80445cf (diff), c8bb1633 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/io/con_srv.h
r80445cf r4c53333 1 1 /* 2 * Copyright (c) 2006 Jakub Jermar 3 * Copyright (c) 2011 Radim Vansa 2 * Copyright (c) 2012 Jiri Svoboda 4 3 * All rights reserved. 5 4 * … … 34 33 */ 35 34 36 #ifndef LIBC_ HASH_SET_H_37 #define LIBC_ HASH_SET_H_35 #ifndef LIBC_CON_SRV_H_ 36 #define LIBC_CON_SRV_H_ 38 37 39 38 #include <adt/list.h> 40 #include <unistd.h> 39 #include <async.h> 40 #include <fibril_synch.h> 41 #include <io/color.h> 42 #include <io/concaps.h> 43 #include <io/cons_event.h> 44 #include <io/pixel.h> 45 #include <io/style.h> 46 #include <stdbool.h> 47 #include <sys/time.h> 48 #include <sys/types.h> 41 49 42 #define HASH_SET_MIN_SIZE 8 50 typedef struct con_ops con_ops_t; 43 51 44 typedef unsigned long (*hash_set_hash)(const link_t *); 45 typedef int (*hash_set_equals)(const link_t *, const link_t *); 52 /** Service setup (per sevice) */ 53 typedef struct { 54 con_ops_t *ops; 55 void *sarg; 56 /** Period to check for abort */ 57 suseconds_t abort_timeout; 58 bool aborted; 59 } con_srvs_t; 46 60 47 /** Hash table structure.*/61 /** Server structure (per client session) */ 48 62 typedef struct { 49 list_t *table; 50 51 /** Current table size */ 52 size_t size; 53 54 /** 55 * Current number of entries. If count > size, 56 * the table is rehashed into table with double 57 * size. If (4 * count < size) && (size > min_size), 58 * the table is rehashed into table with half the size. 59 */ 60 size_t count; 61 62 /** Hash function */ 63 hash_set_hash hash; 64 65 /** Hash table item equals function */ 66 hash_set_equals equals; 67 } hash_set_t; 63 con_srvs_t *srvs; 64 async_sess_t *client_sess; 65 void *carg; 66 } con_srv_t; 68 67 69 extern int hash_set_init(hash_set_t *, hash_set_hash, hash_set_equals, size_t); 70 extern int hash_set_insert(hash_set_t *, link_t *); 71 extern link_t *hash_set_find(hash_set_t *, const link_t *); 72 extern int hash_set_contains(const hash_set_t *, const link_t *); 73 extern size_t hash_set_count(const hash_set_t *); 74 extern link_t *hash_set_remove(hash_set_t *, const link_t *); 75 extern void hash_set_remove_selected(hash_set_t *, 76 int (*)(link_t *, void *), void *); 77 extern void hash_set_destroy(hash_set_t *); 78 extern void hash_set_apply(hash_set_t *, void (*)(link_t *, void *), void *); 79 extern void hash_set_clear(hash_set_t *, void (*)(link_t *, void *), void *); 68 struct con_ops { 69 int (*open)(con_srvs_t *, con_srv_t *); 70 int (*close)(con_srv_t *); 71 int (*read)(con_srv_t *, void *, size_t); 72 int (*write)(con_srv_t *, void *, size_t); 73 void (*sync)(con_srv_t *); 74 void (*clear)(con_srv_t *); 75 void (*set_pos)(con_srv_t *, sysarg_t col, sysarg_t row); 76 int (*get_pos)(con_srv_t *, sysarg_t *, sysarg_t *); 77 int (*get_size)(con_srv_t *, sysarg_t *, sysarg_t *); 78 int (*get_color_cap)(con_srv_t *, console_caps_t *); 79 void (*set_style)(con_srv_t *, console_style_t); 80 void (*set_color)(con_srv_t *, console_color_t, console_color_t, 81 console_color_attr_t); 82 void (*set_rgb_color)(con_srv_t *, pixel_t, pixel_t); 83 void (*set_cursor_visibility)(con_srv_t *, bool); 84 int (*get_event)(con_srv_t *, cons_event_t *); 85 }; 86 87 extern void con_srvs_init(con_srvs_t *); 88 89 extern int con_conn(ipc_callid_t, ipc_call_t *, con_srvs_t *); 80 90 81 91 #endif
Note:
See TracChangeset
for help on using the changeset viewer.