Changeset 26f2af0 in mainline
- Timestamp:
- 2007-09-18T19:58:19Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 47a776f9
- Parents:
- c3b25510
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/generic/ipc.c
rc3b25510 r26f2af0 516 516 int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phonehash) 517 517 { 518 return ipc_call_sync_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2, 0, 0, 0,519 phonehash);518 return ipc_call_sync_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2, 0, 0, 519 0, phonehash); 520 520 } 521 521 … … 533 533 int res; 534 534 535 res = 535 res = ipc_call_sync_3(phoneid, IPC_M_CONNECT_ME_TO, arg1, arg2, 0, 0, 0, 536 536 &newphid); 537 537 if (res) … … 596 596 } 597 597 598 /** Wrapper for accepting the IPC_M_DATA_SEND calls. 599 * 600 * This wrapper only makes it more comfortable to accept IPC_M_DATA_SEND calls 598 /** Wrapper for making IPC_M_DATA_SEND calls. 599 * 600 * @param phoneid Phone that will be used to contact the receiving side. 601 * @param src Address of the beginning of the source buffer. 602 * @param size Size of the source buffer. 603 * 604 * @return Zero on success or a negative error code from errno.h. 605 */ 606 int ipc_data_send(int phoneid, void *src, size_t size) 607 { 608 return ipc_call_sync_3(phoneid, IPC_M_DATA_SEND, 0, (ipcarg_t) src, 609 (ipcarg_t) size, NULL, NULL, NULL); 610 } 611 612 /** Wrapper for receiving the IPC_M_DATA_SEND calls. 613 * 614 * This wrapper only makes it more comfortable to receive IPC_M_DATA_SEND calls 601 615 * so that the user doesn't have to remember the meaning of each IPC argument. 602 616 * … … 613 627 * @return Non-zero on success, zero on failure. 614 628 */ 615 int ipc_data_ send_accept(ipc_callid_t *callid, ipc_call_t *call, void **dst,629 int ipc_data_receive(ipc_callid_t *callid, ipc_call_t *call, void **dst, 616 630 size_t *size) 617 631 { … … 641 655 * @return Zero on success or a value from @ref errno.h on failure. 642 656 */ 643 ipcarg_t ipc_data_send_answer(ipc_callid_t callid, ipc_call_t *call, void *dst, size_t size) 657 ipcarg_t ipc_data_deliver(ipc_callid_t callid, ipc_call_t *call, void *dst, 658 size_t size) 644 659 { 645 660 IPC_SET_RETVAL(*call, EOK); -
uspace/lib/libc/include/async.h
rc3b25510 r26f2af0 103 103 104 104 fid_t async_new_connection(ipcarg_t in_phone_hash,ipc_callid_t callid, 105 ipc_call_t *call, 106 void (*cthread)(ipc_callid_t,ipc_call_t *)); 105 ipc_call_t *call, void (*cthread)(ipc_callid_t,ipc_call_t *)); 107 106 void async_usleep(suseconds_t timeout); 108 107 void async_create_manager(void); -
uspace/lib/libc/include/ipc/ipc.h
rc3b25510 r26f2af0 75 75 76 76 #define ipc_call_async(phoneid, method, arg1, private, callback, can_preempt) \ 77 (ipc_call_async_2(phoneid, method, arg1, 0, private, callback, \ 78 can_preempt)) 77 (ipc_call_async_2(phoneid, method, arg1, 0, private, callback, can_preempt)) 79 78 extern void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1, 80 79 ipcarg_t arg2, void *private, ipc_async_callback_t callback, … … 91 90 extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, 92 91 ipcarg_t arg1); 93 94 extern int ipc_data_ send_accept(ipc_callid_t *callid, ipc_call_t *call,95 void **dst,size_t *size);96 extern ipcarg_t ipc_data_ send_answer(ipc_callid_t callid, ipc_call_t *call,92 extern int ipc_data_send(int phoneid, void *src, size_t size); 93 extern int ipc_data_receive(ipc_callid_t *callid, ipc_call_t *call, void **dst, 94 size_t *size); 95 extern ipcarg_t ipc_data_deliver(ipc_callid_t callid, ipc_call_t *call, 97 96 void *dst, size_t size); 98 97 -
uspace/srv/fs/fat/fat.c
rc3b25510 r26f2af0 39 39 #include <ipc/ipc.h> 40 40 #include <ipc/services.h> 41 #include <async.h> 41 42 #include <errno.h> 42 43 #include <unistd.h> … … 59 60 }; 60 61 62 /* 63 * This fibril processes request from the VFS server. 64 */ 65 void fat_connection(ipc_callid_t iid, ipc_call_t *icall) 66 { 67 while (1) { 68 ipc_callid_t callid; 69 ipc_call_t call; 70 71 callid = async_get_call(&call); 72 ipc_answer_fast(callid, ENOTSUP, 0, 0); 73 } 74 } 75 61 76 int main(int argc, char **argv) 62 77 { … … 69 84 } 70 85 71 /* TODO: start making calls according to the VFS protocol */ 86 /* 87 * Tell VFS that we are here and want to get registered. 88 * We use the async framework because VFS will answer the request 89 * out-of-order, when it knows that the operation succeeded or failed. 90 */ 91 ipc_call_t answer; 92 aid_t req = async_send_2(vfs_phone, VFS_REGISTER, 0, 0, &answer); 72 93 94 /* 95 * Send our VFS info structure to VFS. 96 */ 97 int rc = ipc_data_send(vfs_phone, &fat_vfs_info, sizeof(fat_vfs_info)); 98 if (rc != EOK) { 99 async_wait_for(req, NULL); 100 return rc; 101 } 102 103 /* 104 * Ask VFS for callback connection. 105 */ 106 ipcarg_t phonehash; 107 ipc_connect_to_me(vfs_phone, 0, 0, &phonehash); 108 109 async_new_connection(phonehash, 0, NULL, fat_connection); 73 110 return 0; 74 111 } -
uspace/srv/vfs/vfs.c
rc3b25510 r26f2af0 124 124 * VFS info structure from the client FS. 125 125 */ 126 if (!ipc_data_ send_accept(&callid, &call, NULL, &size)) {126 if (!ipc_data_receive(&callid, &call, NULL, &size)) { 127 127 /* 128 128 * The client doesn't obey the same protocol as we do. … … 159 159 link_initialize(&fs_info->fs_link); 160 160 161 rc = ipc_data_ send_answer(callid, &call, &fs_info->vfs_info, size);161 rc = ipc_data_deliver(callid, &call, &fs_info->vfs_info, size); 162 162 if (!rc) { 163 163 free(fs_info);
Note:
See TracChangeset
for help on using the changeset viewer.