Changeset 6769005 in mainline for uspace/srv/ns/task.c
- Timestamp:
- 2018-10-31T06:03:38Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 53ee7a0
- Parents:
- 94ab1fe
- git-author:
- Jakub Jermar <jakub@…> (2018-10-28 12:42:35)
- git-committer:
- Jakub Jermar <jakub@…> (2018-10-31 06:03:38)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/ns/task.c
r94ab1fe r6769005 91 91 typedef struct { 92 92 ht_link_t link; 93 sysarg_t in_phone_hash; /**< Incoming phone hash. */94 task_id_t id; 93 sysarg_t label; /**< Incoming phone label. */ 94 task_id_t id; /**< Task ID. */ 95 95 } p2i_entry_t; 96 96 97 /* phone-to-id hash table operations */97 /* label-to-id hash table operations */ 98 98 99 99 static size_t p2i_key_hash(void *key) 100 100 { 101 sysarg_t in_phone_hash= *(sysarg_t *)key;102 return in_phone_hash;101 sysarg_t label = *(sysarg_t *)key; 102 return label; 103 103 } 104 104 … … 106 106 { 107 107 p2i_entry_t *entry = hash_table_get_inst(item, p2i_entry_t, link); 108 return entry-> in_phone_hash;108 return entry->label; 109 109 } 110 110 111 111 static bool p2i_key_equal(void *key, const ht_link_t *item) 112 112 { 113 sysarg_t in_phone_hash= *(sysarg_t *)key;113 sysarg_t label = *(sysarg_t *)key; 114 114 p2i_entry_t *entry = hash_table_get_inst(item, p2i_entry_t, link); 115 115 116 return ( in_phone_hash == entry->in_phone_hash);116 return (label == entry->label); 117 117 } 118 118 … … 137 137 }; 138 138 139 /** Map phone hashto task ID */139 /** Map phone label to task ID */ 140 140 static hash_table_t phone_to_id; 141 141 … … 227 227 task_id_t id = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call)); 228 228 229 ht_link_t *link = hash_table_find(&phone_to_id, &call-> in_phone_hash);229 ht_link_t *link = hash_table_find(&phone_to_id, &call->request_label); 230 230 if (link != NULL) 231 231 return EEXIST; … … 245 245 */ 246 246 247 entry->in_phone_hash = call->in_phone_hash; 247 assert(call->request_label); 248 entry->label = call->request_label; 248 249 entry->id = id; 249 250 hash_table_insert(&phone_to_id, &entry->link); … … 262 263 } 263 264 264 static errno_t get_id_by_phone(sysarg_t phone_hash, task_id_t *id) 265 { 266 ht_link_t *link = hash_table_find(&phone_to_id, &phone_hash); 265 static errno_t get_id_by_phone(sysarg_t label, task_id_t *id) 266 { 267 assert(label); 268 ht_link_t *link = hash_table_find(&phone_to_id, &label); 267 269 if (link == NULL) 268 270 return ENOENT; … … 276 278 errno_t ns_task_retval(ipc_call_t *call) 277 279 { 278 task_id_t id = call-> in_task_id;280 task_id_t id = call->task_id; 279 281 280 282 ht_link_t *link = hash_table_find(&task_hash_table, &id); … … 297 299 { 298 300 task_id_t id; 299 errno_t rc = get_id_by_phone(call-> in_phone_hash, &id);301 errno_t rc = get_id_by_phone(call->request_label, &id); 300 302 if (rc != EOK) 301 303 return rc; 302 304 303 305 /* Delete from phone-to-id map. */ 304 hash_table_remove(&phone_to_id, &call-> in_phone_hash);306 hash_table_remove(&phone_to_id, &call->request_label); 305 307 306 308 /* Mark task as finished. */
Note:
See TracChangeset
for help on using the changeset viewer.