Naming Service
[HelenOS Services]


Files

file  ns.c
 Naming service for HelenOS IPC.

Data Structures

struct  hashed_service_t

Defines

#define NAME   "NS"
#define NS_HASH_TABLE_CHAINS   20

Functions

static int register_service (ipcarg_t service, ipcarg_t phone, ipc_call_t *call)
static int connect_to_service (ipcarg_t service, ipc_call_t *call, ipc_callid_t callid)
static hash_index_t ns_hash (unsigned long *key)
static int ns_compare (unsigned long *key, hash_count_t keys, link_t *item)
static void ns_remove (link_t *item)
static void get_as (ipc_callid_t callid, ipc_call_t *call, char *name, void **addr)
int main (int argc, char **argv)
int ns_compare (unsigned long key[], hash_count_t keys, link_t *item)

Variables

static hash_table_operations_t ns_hash_table_ops
static hash_table_t ns_hash_table
static void * clockaddr = NULL
static void * klogaddr = NULL

Define Documentation

#define NAME   "NS"
 

Definition at line 53 of file ns.c.

#define NS_HASH_TABLE_CHAINS   20
 

Definition at line 55 of file ns.c.

Referenced by main(), and ns_hash().


Function Documentation

int register_service ipcarg_t  service,
ipcarg_t  phone,
ipc_call_t call
[static]
 

Register service.

Parameters:
service Service to be registered.
phone 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 161 of file ns.c.

References hash_table_find(), hash_table_insert(), hashed_service_t::in_phone_hash, ipc_call_t::in_phone_hash, hashed_service_t::link, link_initialize(), ns_hash_table, hashed_service_t::phone, and hashed_service_t::service.

Referenced by main().

Here is the call graph for this function:

int connect_to_service ipcarg_t  service,
ipc_call_t call,
ipc_callid_t  callid
[static]
 

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 192 of file ns.c.

References hash_table_find(), hash_table_get_instance, ipc_forward_fast(), ns_hash_table, and hashed_service_t::phone.

Referenced by main().

Here is the call graph for this function:

hash_index_t ns_hash unsigned long *  key  )  [static]
 

Compute hash index into NS 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 212 of file ns.c.

References assert, and NS_HASH_TABLE_CHAINS.

static int ns_compare unsigned long *  key,
hash_count_t  keys,
link_t item
[static]
 

void ns_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 251 of file ns.c.

References assert, and hash_table_get_instance.

static void get_as ipc_callid_t  callid,
ipc_call_t call,
char *  name,
void **  addr
[static]
 

Definition at line 86 of file ns.c.

References as_get_mappable_page(), ipc_answer_fast(), map_physmem(), and sysinfo_value().

Referenced by main().

Here is the call graph for this function:

int main int  argc,
char **  argv
 

Definition at line 102 of file ns.c.

References clockaddr, connect_to_service(), get_as(), hash_table_create(), ipc_answer_fast(), ipc_wait_for_call(), klogaddr, ns_hash_table, NS_HASH_TABLE_CHAINS, ns_hash_table_ops, register_service(), SERVICE_MEM_KLOG, and SERVICE_MEM_REALTIME.

Here is the call graph for this function:

int ns_compare unsigned long  key[],
hash_count_t  keys,
link_t item
 

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 231 of file ns.c.

References assert, hash_table_get_instance, hashed_service_t::in_phone_hash, and hashed_service_t::service.


Variable Documentation

hash_table_operations_t ns_hash_table_ops [static]
 

Initial value:

 {
        .hash = ns_hash,
        .compare = ns_compare,
        .remove_callback = ns_remove
}
Operations for NS hash table.

Definition at line 66 of file ns.c.

Referenced by main().

hash_table_t ns_hash_table [static]
 

NS hash table structure.

Definition at line 73 of file ns.c.

Referenced by connect_to_service(), main(), and register_service().

void* clockaddr = NULL [static]
 

Definition at line 83 of file ns.c.

Referenced by main().

void* klogaddr = NULL [static]
 

Definition at line 84 of file ns.c.

Referenced by main().


Generated on Sun Jun 18 18:02:08 2006 for HelenOS Userspace (ia64) by  doxygen 1.4.6