Naming Service
[HelenOS Services]


Data Structures

struct  cs_req_t
 Request for connection to a clonable service. More...
struct  hashed_service_t
 Service hash table item. More...
struct  hashed_task_t
 Task hash table item. More...
struct  p2i_entry_t
struct  pending_conn_t
 Pending connection structure. More...
struct  pending_wait_t
 Pending task wait structure. More...

Defines

#define NAME   "ns"
#define P2I_HASH_TABLE_CHAINS   256
#define SERVICE_HASH_TABLE_CHAINS   20
#define TASK_HASH_TABLE_CHAINS   256

Functions

int clonable_init (void)
void connect_to_clonable (sysarg_t service, ipc_call_t *call, ipc_callid_t callid)
 Connect client to clonable service.
void connect_to_service (sysarg_t service, ipc_call_t *call, ipc_callid_t callid)
 Connect client to service.
static int get_id_by_phone (sysarg_t phone_hash, task_id_t *id)
int main (int argc, char **argv)
int ns_task_disconnect (ipc_call_t *call)
int ns_task_id_intro (ipc_call_t *call)
int ns_task_retval (ipc_call_t *call)
static int p2i_compare (unsigned long key[], hash_count_t keys, link_t *item)
 Compare a key with hashed item.
static hash_index_t p2i_hash (unsigned long key[])
 Compute hash index into task hash table.
static void p2i_remove (link_t *item)
 Perform actions after removal of item from the hash table.
void process_pending_conn (void)
 Process pending connection requests.
void process_pending_wait (void)
 Process pending wait requests.
void register_clonable (sysarg_t service, sysarg_t phone, ipc_call_t *call, ipc_callid_t callid)
 Register clonable service.
int register_service (sysarg_t service, sysarg_t phone, ipc_call_t *call)
 Register service.
bool service_clonable (int service)
 Return true if service is clonable.
static int service_compare (unsigned long key[], hash_count_t keys, link_t *item)
 Compare a key with hashed item.
static hash_index_t service_hash (unsigned long key[])
 Compute hash index into service hash table.
int service_init (void)
static void service_remove (link_t *item)
 Perform actions after removal of item from the hash table.
static int task_compare (unsigned long key[], hash_count_t keys, link_t *item)
 Compare a key with hashed item.
static hash_index_t task_hash (unsigned long key[])
 Compute hash index into task hash table.
int task_init (void)
static void task_remove (link_t *item)
 Perform actions after removal of item from the hash table.
void wait_for_task (task_id_t id, ipc_call_t *call, ipc_callid_t callid)

Variables

static link_t cs_req
 List of clonable-service connection requests.
static hash_table_operations_t p2i_ops
 Operations for task hash table.
static link_t pending_conn
static link_t pending_wait
static hash_table_t phone_to_id
 Map phone hash to task ID.
static hash_table_t service_hash_table
 Service hash table structure.
static hash_table_operations_t service_hash_table_ops
 Operations for service hash table.
static hash_table_t task_hash_table
 Task hash table structure.
static hash_table_operations_t task_hash_table_ops
 Operations for task hash table.

Function Documentation

void connect_to_clonable ( sysarg_t  service,
ipc_call_t call,
ipc_callid_t  callid 
)

Connect client to clonable service.

Parameters:
service Service to be connected to.
call Pointer to call structure.
callid Call ID of the request.
Returns:
Zero on success or a value from errno.h.

Definition at line 109 of file clonable.c.

void connect_to_service ( sysarg_t  service,
ipc_call_t call,
ipc_callid_t  callid 
)

Connect client to service.

Parameters:
service Service to be connected to.
call Pointer to call structure.
callid Call ID of the request.
Returns:
Zero on success or a value from errno.h.

Definition at line 211 of file service.c.

static int p2i_compare ( unsigned long  key[],
hash_count_t  keys,
link_t item 
) [static]

Compare a key with hashed item.

Parameters:
key Array of keys.
keys Must be less than or equal to 1.
item Pointer to a hash table item.
Returns:
Non-zero if the key matches the item, zero otherwise.

Definition at line 152 of file task.c.

static hash_index_t p2i_hash ( unsigned long  key[]  )  [static]

Compute hash index into task hash table.

Parameters:
key Array of keys.
Returns:
Hash index corresponding to key[0].

Definition at line 137 of file task.c.

static void p2i_remove ( link_t item  )  [static]

Perform actions after removal of item from the hash table.

Parameters:
item Item that was removed from the hash table.

Definition at line 168 of file task.c.

void register_clonable ( sysarg_t  service,
sysarg_t  phone,
ipc_call_t call,
ipc_callid_t  callid 
)

Register clonable service.

Parameters:
service Service to be registered.
phone Phone to be used for connections to the service.
call Pointer to call structure.

Definition at line 75 of file clonable.c.

int register_service ( sysarg_t  service,
sysarg_t  phone,
ipc_call_t call 
)

Register service.

Parameters:
service Service to be registered.
phone Phone to be used for connections to the service.
call Pointer to call structure.
Returns:
Zero on success or a value from errno.h.

Definition at line 178 of file service.c.

static int service_compare ( unsigned long  key[],
hash_count_t  keys,
link_t item 
) [static]

Compare a key with hashed item.

This compare function always ignores the third key. It exists only to make it possible to remove records originating from connection with key[1] in_phone_hash value. Note that this is close to being classified as a nasty hack.

Parameters:
key Array of keys.
keys Must be lesser or equal to 3.
item Pointer to a hash table item.
Returns:
Non-zero if the key matches the item, zero otherwise.

Definition at line 81 of file service.c.

static hash_index_t service_hash ( unsigned long  key[]  )  [static]

Compute hash index into service hash table.

Parameters:
key Pointer keys. However, only the first key (i.e. service number) is used to compute the hash index.
Returns:
Hash index corresponding to key[0].

Definition at line 60 of file service.c.

static void service_remove ( link_t item  )  [static]

Perform actions after removal of item from the hash table.

Parameters:
item Item that was removed from the hash table.

Definition at line 100 of file service.c.

static int task_compare ( unsigned long  key[],
hash_count_t  keys,
link_t item 
) [static]

Compare a key with hashed item.

Parameters:
key Array of keys.
keys Must be less than or equal to 2.
item Pointer to a hash table item.
Returns:
Non-zero if the key matches the item, zero otherwise.

Definition at line 88 of file task.c.

static hash_index_t task_hash ( unsigned long  key[]  )  [static]

Compute hash index into task hash table.

Parameters:
key Pointer keys. However, only the first key (i.e. truncated task number) is used to compute the hash index.
Returns:
Hash index corresponding to key[0].

Definition at line 73 of file task.c.

static void task_remove ( link_t item  )  [static]

Perform actions after removal of item from the hash table.

Parameters:
item Item that was removed from the hash table.

Definition at line 108 of file task.c.


Generated on Thu Jun 2 07:45:55 2011 for HelenOS/USB by  doxygen 1.4.7