~jakub/helenos/ia64-revival

« back to all changes in this revision

Viewing changes to uspace/srv/ns/service.c

  • Committer: Jakub Jermar
  • Date: 2011-04-13 14:45:41 UTC
  • mfrom: (527.1.397 main-clone)
  • Revision ID: jakub@jermar.eu-20110413144541-x0j3r1zxqhsljx1o
MergeĀ mainlineĀ changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
/** Service hash table item. */
43
43
typedef struct {
44
44
        link_t link;
45
 
        ipcarg_t service;        /**< Number of the service. */
46
 
        ipcarg_t phone;          /**< Phone registered with the service. */
47
 
        ipcarg_t in_phone_hash;  /**< Incoming phone hash. */
 
45
        sysarg_t service;        /**< Service ID. */
 
46
        sysarg_t phone;          /**< Phone registered with the service. */
 
47
        sysarg_t in_phone_hash;  /**< Incoming phone hash. */
48
48
} hashed_service_t;
49
49
 
50
50
/** Compute hash index into service hash table.
55
55
 * @return Hash index corresponding to key[0].
56
56
 *
57
57
 */
58
 
static hash_index_t service_hash(unsigned long *key)
 
58
static hash_index_t service_hash(unsigned long key[])
59
59
{
60
60
        assert(key);
61
 
        return (*key % SERVICE_HASH_TABLE_CHAINS);
 
61
        return (key[0] % SERVICE_HASH_TABLE_CHAINS);
62
62
}
63
63
 
64
64
/** Compare a key with hashed item.
85
85
        hashed_service_t *hs = hash_table_get_instance(item, hashed_service_t, link);
86
86
        
87
87
        if (keys == 2)
88
 
                return (key[1] == hs->in_phone_hash);
 
88
                return ((key[0] == hs->service) && (key[1] == hs->in_phone_hash));
89
89
        else
90
90
                return (key[0] == hs->service);
91
91
}
114
114
/** Pending connection structure. */
115
115
typedef struct {
116
116
        link_t link;
117
 
        ipcarg_t service;        /**< Number of the service. */
 
117
        sysarg_t service;        /**< Number of the service. */
118
118
        ipc_callid_t callid;     /**< Call ID waiting for the connection */
119
 
        ipcarg_t arg2;           /**< Second argument */
120
 
        ipcarg_t arg3;           /**< Third argument */
 
119
        sysarg_t arg2;           /**< Second argument */
 
120
        sysarg_t arg3;           /**< Third argument */
121
121
} pending_conn_t;
122
122
 
123
123
static link_t pending_conn;
173
173
 * @return Zero on success or a value from @ref errno.h.
174
174
 *
175
175
 */
176
 
int register_service(ipcarg_t service, ipcarg_t phone, ipc_call_t *call)
 
176
int register_service(sysarg_t service, sysarg_t phone, ipc_call_t *call)
177
177
{
178
178
        unsigned long keys[3] = {
179
179
                service,
194
194
        hs->in_phone_hash = call->in_phone_hash;
195
195
        hash_table_insert(&service_hash_table, keys, &hs->link);
196
196
        
197
 
        return 0;
 
197
        return EOK;
198
198
}
199
199
 
200
200
/** Connect client to service.
206
206
 * @return Zero on success or a value from @ref errno.h.
207
207
 *
208
208
 */
209
 
void connect_to_service(ipcarg_t service, ipc_call_t *call, ipc_callid_t callid)
 
209
void connect_to_service(sysarg_t service, ipc_call_t *call, ipc_callid_t callid)
210
210
{
211
 
        ipcarg_t retval;
 
211
        sysarg_t retval;
212
212
        unsigned long keys[3] = {
213
213
                service,
214
214
                0,
226
226
                                goto out;
227
227
                        }
228
228
                        
 
229
                        link_initialize(&pr->link);
229
230
                        pr->service = service;
230
231
                        pr->callid = callid;
231
232
                        pr->arg2 = IPC_GET_ARG2(*call);