Changeset e2ab36f1 in mainline
- Timestamp:
- 2011-08-19T12:38:09Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36b16bc, 9247c02c
- Parents:
- 903bac0a
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
r903bac0a re2ab36f1 40 40 #include <synch/mutex.h> 41 41 #include <synch/waitq.h> 42 #include <typedefs.h> 42 43 43 44 #define IPC_MAX_PHONES 32 … … 98 99 sysarg_t args[IPC_CALL_LEN]; 99 100 /** Task which made or forwarded the call with IPC_FF_ROUTE_FROM_ME. */ 100 struct task *task;101 task_id_t task_id; 101 102 /** Phone which made or last masqueraded this call. */ 102 103 phone_t *phone; -
kernel/generic/src/ipc/event.c
r903bac0a re2ab36f1 161 161 IPC_SET_ARG5(call->data, a5); 162 162 163 call->data.task_id = TASK ? TASK->taskid : 0; 164 163 165 irq_spinlock_lock(&event->answerbox->irq_lock, true); 164 166 list_append(&call->link, &event->answerbox->irq_notifs); -
kernel/generic/src/ipc/ipc.c
r903bac0a re2ab36f1 294 294 atomic_inc(&phone->active_calls); 295 295 call->data.phone = phone; 296 call->data.task = TASK;296 call->data.task_id = TASK->taskid; 297 297 } 298 298 … … 406 406 call->caller_phone = call->data.phone; 407 407 call->data.phone = newphone; 408 call->data.task = TASK;408 call->data.task_id = TASK->taskid; 409 409 } 410 410 -
kernel/generic/src/ipc/sysipc.c
r903bac0a re2ab36f1 54 54 #include <mm/as.h> 55 55 #include <print.h> 56 #include <macros.h> 56 57 57 58 /** … … 375 376 IPC_GET_ARG2(*olddata), 376 377 IPC_GET_ARG3(*olddata), 377 (sysarg_t) olddata->task,378 (sysarg_t) TASK);378 LOWER32(olddata->task_id), 379 UPPER32(olddata->task_id)); 379 380 IPC_SET_RETVAL(answer->data, rc); 380 381 } -
uspace/lib/c/generic/async.c
r903bac0a re2ab36f1 112 112 #include <mem.h> 113 113 #include <stdlib.h> 114 #include <macros.h> 114 115 #include "private/async.h" 115 116 … … 138 139 link_t link; 139 140 140 sysarg_t in_task_ hash;141 sysarg_t in_task_id; 141 142 atomic_t refcnt; 142 143 void *data; … … 150 151 link_t link; 151 152 152 /** Incoming client task hash. */153 sysarg_t in_task_hash;153 /** Incoming client task ID. */ 154 task_id_t in_task_id; 154 155 155 156 /** Incoming phone hash. */ … … 283 284 { 284 285 assert(key); 286 assert(keys == 2); 285 287 assert(item); 286 288 287 289 client_t *client = hash_table_get_instance(item, client_t, link); 288 return (key[0] == client->in_task_hash); 290 return (key[0] == LOWER32(client->in_task_id) && 291 (key[1] == UPPER32(client->in_task_id))); 289 292 } 290 293 … … 574 577 } 575 578 576 static client_t *async_client_get(sysarg_t client_hash, bool create) 577 { 578 unsigned long key = client_hash; 579 static client_t *async_client_get(task_id_t client_id, bool create) 580 { 581 unsigned long key[2] = { 582 LOWER32(client_id), 583 UPPER32(client_id), 584 }; 579 585 client_t *client = NULL; 580 586 581 587 futex_down(&async_futex); 582 link_t *lnk = hash_table_find(&client_hash_table, &key);588 link_t *lnk = hash_table_find(&client_hash_table, key); 583 589 if (lnk) { 584 590 client = hash_table_get_instance(lnk, client_t, link); … … 587 593 client = malloc(sizeof(client_t)); 588 594 if (client) { 589 client->in_task_ hash = client_hash;595 client->in_task_id = client_id; 590 596 client->data = async_client_data_create(); 591 597 592 598 atomic_set(&client->refcnt, 1); 593 hash_table_insert(&client_hash_table, &key, &client->link);599 hash_table_insert(&client_hash_table, key, &client->link); 594 600 } 595 601 } … … 602 608 { 603 609 bool destroy; 604 unsigned long key = client->in_task_hash; 610 unsigned long key[2] = { 611 LOWER32(client->in_task_id), 612 UPPER32(client->in_task_id) 613 }; 605 614 606 615 futex_down(&async_futex); 607 616 608 617 if (atomic_predec(&client->refcnt) == 0) { 609 hash_table_remove(&client_hash_table, &key, 1);618 hash_table_remove(&client_hash_table, key, 2); 610 619 destroy = true; 611 620 } else … … 628 637 } 629 638 630 void *async_get_client_data_by_ hash(sysarg_t client_hash)631 { 632 client_t *client = async_client_get(client_ hash, false);639 void *async_get_client_data_by_id(task_id_t client_id) 640 { 641 client_t *client = async_client_get(client_id, false); 633 642 if (!client) 634 643 return NULL; … … 641 650 } 642 651 643 void async_put_client_data_by_ hash(sysarg_t client_hash)644 { 645 client_t *client = async_client_get(client_ hash, false);652 void async_put_client_data_by_id(task_id_t client_id) 653 { 654 client_t *client = async_client_get(client_id, false); 646 655 647 656 assert(client); … … 680 689 */ 681 690 682 client_t *client = async_client_get(fibril_connection->in_task_ hash, true);691 client_t *client = async_client_get(fibril_connection->in_task_id, true); 683 692 if (!client) { 684 693 ipc_answer_0(fibril_connection->callid, ENOMEM); … … 737 746 * particular fibrils. 738 747 * 739 * @param in_task_ hashIdentification of the incoming connection.748 * @param in_task_id Identification of the incoming connection. 740 749 * @param in_phone_hash Identification of the incoming connection. 741 750 * @param callid Hash of the opening IPC_M_CONNECT_ME_TO call. … … 751 760 * 752 761 */ 753 fid_t async_new_connection( sysarg_t in_task_hash, sysarg_t in_phone_hash,762 fid_t async_new_connection(task_id_t in_task_id, sysarg_t in_phone_hash, 754 763 ipc_callid_t callid, ipc_call_t *call, 755 764 async_client_conn_t cfibril, void *carg) … … 763 772 } 764 773 765 conn->in_task_ hash = in_task_hash;774 conn->in_task_id = in_task_id; 766 775 conn->in_phone_hash = in_phone_hash; 767 776 list_initialize(&conn->msg_queue); … … 822 831 case IPC_M_CONNECT_ME_TO: 823 832 /* Open new connection with fibril, etc. */ 824 async_new_connection(call->in_task_ hash, IPC_GET_ARG5(*call),833 async_new_connection(call->in_task_id, IPC_GET_ARG5(*call), 825 834 callid, call, client_connection, NULL); 826 835 return; … … 970 979 { 971 980 if (!hash_table_create(&client_hash_table, CLIENT_HASH_TABLE_BUCKETS, 972 1, &client_hash_table_ops))981 2, &client_hash_table_ops)) 973 982 abort(); 974 983 -
uspace/lib/c/include/async.h
r903bac0a re2ab36f1 176 176 extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t); 177 177 178 extern fid_t async_new_connection( sysarg_t, sysarg_t, ipc_callid_t,178 extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t, 179 179 ipc_call_t *, async_client_conn_t, void *); 180 180 … … 186 186 extern void async_set_client_data_destructor(async_client_data_dtor_t); 187 187 extern void *async_get_client_data(void); 188 extern void *async_get_client_data_by_ hash(sysarg_t);189 extern void async_put_client_data_by_ hash(sysarg_t);188 extern void *async_get_client_data_by_id(task_id_t); 189 extern void async_put_client_data_by_id(task_id_t); 190 190 191 191 extern void async_set_client_connection(async_client_conn_t); -
uspace/lib/c/include/ipc/common.h
r903bac0a re2ab36f1 39 39 #include <abi/ipc/ipc.h> 40 40 #include <atomic.h> 41 #include <task.h> 41 42 42 43 #define IPC_FLAG_BLOCKING 0x01 … … 44 45 typedef struct { 45 46 sysarg_t args[IPC_CALL_LEN]; 46 sysarg_t in_task_hash;47 task_id_t in_task_id; 47 48 sysarg_t in_phone_hash; 48 49 } ipc_call_t; -
uspace/srv/vfs/vfs.c
r903bac0a re2ab36f1 36 36 */ 37 37 38 #include <vfs/vfs.h> 38 39 #include <ipc/services.h> 39 40 #include <abi/ipc/event.h> … … 47 48 #include <as.h> 48 49 #include <atomic.h> 49 #include < vfs/vfs.h>50 #include <macros.h> 50 51 #include "vfs.h" 51 52 … … 143 144 case VFS_TASK_STATE_CHANGE: 144 145 if (IPC_GET_ARG1(*call) == VFS_PASS_HANDLE) 145 vfs_pass_handle(IPC_GET_ARG4(*call), 146 IPC_GET_ARG5(*call), (int) IPC_GET_ARG2(*call)); 146 vfs_pass_handle( 147 (task_id_t) MERGE_LOUP32(IPC_GET_ARG4(*call), 148 IPC_GET_ARG5(*call)), call->in_task_id, 149 (int) IPC_GET_ARG2(*call)); 147 150 break; 148 151 default: -
uspace/srv/vfs/vfs.h
r903bac0a re2ab36f1 41 41 #include <bool.h> 42 42 #include <ipc/vfs.h> 43 #include <task.h> 43 44 44 45 #ifndef dprintf … … 188 189 extern void vfs_client_data_destroy(void *); 189 190 190 extern void vfs_pass_handle( sysarg_t, sysarg_t, int);191 extern void vfs_pass_handle(task_id_t, task_id_t, int); 191 192 extern int vfs_wait_handle_internal(void); 192 193 -
uspace/srv/vfs/vfs_file.c
r903bac0a re2ab36f1 44 44 #include <fibril_synch.h> 45 45 #include <adt/list.h> 46 #include <task.h> 46 47 #include "vfs.h" 47 48 … … 346 347 } 347 348 348 void vfs_pass_handle( sysarg_t donor_hash, sysarg_t acceptor_hash, int donor_fd)349 void vfs_pass_handle(task_id_t donor_id, task_id_t acceptor_id, int donor_fd) 349 350 { 350 351 vfs_client_data_t *donor_data = NULL; … … 355 356 int acceptor_fd; 356 357 357 acceptor_data = async_get_client_data_by_ hash(acceptor_hash);358 acceptor_data = async_get_client_data_by_id(acceptor_id); 358 359 if (!acceptor_data) 359 360 return; … … 365 366 bh->handle = -1; 366 367 367 donor_data = async_get_client_data_by_ hash(donor_hash);368 donor_data = async_get_client_data_by_id(donor_id); 368 369 if (!donor_data) 369 370 goto out; … … 402 403 403 404 if (donor_data) 404 async_put_client_data_by_ hash(donor_hash);405 async_put_client_data_by_id(donor_id); 405 406 if (acceptor_data) 406 async_put_client_data_by_ hash(acceptor_hash);407 async_put_client_data_by_id(acceptor_id); 407 408 if (donor_file) 408 409 _vfs_file_put(donor_data, donor_file);
Note:
See TracChangeset
for help on using the changeset viewer.