Changeset 36d852c in mainline
- Timestamp:
- 2007-12-23T19:45:30Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 654b7db
- Parents:
- 5c786d1
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/ipc.h
r5c786d1 r36d852c 185 185 * - ARG3 - final size of data to be copied 186 186 */ 187 #define IPC_M_DATA_SEND 6 187 #define IPC_M_DATA_WRITE 6 188 189 /** Receive data from another address space over IPC. 190 * - ARG1 - destination virtual address in the source address space 191 * - ARG2 - size of data to be received, may be cropped by the recipient 192 * 193 * on answer, the recipient must set: 194 * 195 * - ARG1 - source virtual address in the destination address space 196 * - ARG2 - final size of data to be copied 197 */ 198 #define IPC_M_DATA_READ 7 188 199 189 200 /* Well-known methods */ -
kernel/generic/src/ipc/sysipc.c
r5c786d1 r36d852c 50 50 #include <print.h> 51 51 52 /** Maximum buffer size allowed for IPC_M_DATA_SEND requests. */ 53 #define DATA_SEND_LIMIT (64 * 1024) 52 /** 53 * Maximum buffer size allowed for IPC_M_DATA_WRITE and IPC_M_DATA_READ 54 * requests. 55 */ 56 #define DATA_XFER_LIMIT (64 * 1024) 54 57 55 58 #define GET_CHECK_PHONE(phone, phoneid, err) \ … … 112 115 case IPC_M_AS_AREA_SEND: 113 116 case IPC_M_AS_AREA_RECV: 114 case IPC_M_DATA_SEND: 117 case IPC_M_DATA_WRITE: 118 case IPC_M_DATA_READ: 115 119 return 1; 116 120 break; … … 140 144 case IPC_M_AS_AREA_SEND: 141 145 case IPC_M_AS_AREA_RECV: 142 case IPC_M_DATA_SEND: 146 case IPC_M_DATA_WRITE: 147 case IPC_M_DATA_READ: 143 148 return 1; 144 149 default: … … 231 236 IPC_SET_RETVAL(answer->data, rc); 232 237 } 233 } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_ SEND) {238 } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_WRITE) { 234 239 if (!IPC_GET_RETVAL(answer->data)) { 235 240 int rc; … … 281 286 IPC_SET_ARG2(call->data, size); 282 287 break; 283 case IPC_M_DATA_ SEND:288 case IPC_M_DATA_WRITE: 284 289 src = IPC_GET_ARG2(call->data); 285 290 size = IPC_GET_ARG3(call->data); 286 291 287 if ((size <= 0) || (size > DATA_ SEND_LIMIT))292 if ((size <= 0) || (size > DATA_XFER_LIMIT)) 288 293 return ELIMIT; 289 294 -
uspace/app/tester/devmap/devmap1.c
r5c786d1 r36d852c 50 50 int retval; 51 51 52 printf("connected: method=%u arg1=%u, arg2=%u arg3=%u.\n", IPC_GET_METHOD(*icall), 53 IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall), IPC_GET_ARG3(*icall)); 52 printf("connected: method=%u arg1=%u, arg2=%u arg3=%u.\n", 53 IPC_GET_METHOD(*icall), IPC_GET_ARG1(*icall), IPC_GET_ARG2(*icall), 54 IPC_GET_ARG3(*icall)); 54 55 55 56 printf("driver_client_connection.\n"); … … 60 61 callid = async_get_call(&call); 61 62 retval = EOK; 62 printf("method=%u arg1=%u, arg2=%u arg3=%u.\n", IPC_GET_METHOD(call), 63 IPC_GET_ARG1(call), IPC_GET_ARG2(call), IPC_GET_ARG3(call)); 63 printf("method=%u arg1=%u, arg2=%u arg3=%u.\n", 64 IPC_GET_METHOD(call), IPC_GET_ARG1(call), 65 IPC_GET_ARG2(call), IPC_GET_ARG3(call)); 64 66 switch (IPC_GET_METHOD(call)) { 65 67 case IPC_M_PHONE_HUNGUP: … … 67 69 return; 68 70 default: 69 printf("Unknown device method %u.\n", IPC_GET_METHOD(call)); 71 printf("Unknown device method %u.\n", 72 IPC_GET_METHOD(call)); 70 73 retval = ENOENT; 71 74 } … … 82 85 handle = (int)arg; 83 86 84 device_phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, \85 87 device_phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, 88 DEVMAP_CONNECT_TO_DEVICE, handle); 86 89 87 90 if (device_phone < 0) { 88 printf("Failed to connect to devmap as client (handle = %u).\n", 89 91 printf("Failed to connect to devmap as client (handle = %u).\n", 92 handle); 90 93 return -1; 91 94 } … … 130 133 ipcarg_t callback_phonehash; 131 134 132 phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, 133 DEVMAP_DRIVER, 0); 135 phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, DEVMAP_DRIVER, 0); 134 136 135 137 while (phone < 0) { 136 138 usleep(100000); 137 139 phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, 138 140 DEVMAP_DRIVER, 0); 139 141 } 140 142 141 143 req = async_send_2(phone, DEVMAP_DRIVER_REGISTER, 0, 0, &answer); 142 144 143 retval = ipc_data_ send(phone, (char *)name, strlen(name) + 1);145 retval = ipc_data_write_send(phone, (char *)name, strlen(name) + 1); 144 146 145 147 if (retval != EOK) { … … 171 173 ipc_call_t answer; 172 174 173 req = async_send_2(driver_phone, DEVMAP_DEVICE_GET_HANDLE, 0, 0, &answer); 174 175 retval = ipc_data_send(driver_phone, name, strlen(name) + 1); 175 req = async_send_2(driver_phone, DEVMAP_DEVICE_GET_HANDLE, 0, 0, 176 &answer); 177 178 retval = ipc_data_write_send(driver_phone, name, strlen(name) + 1); 176 179 177 180 if (retval != EOK) { … … 192 195 *handle = (int) IPC_GET_ARG1(answer); 193 196 } 194 printf("Device '%s' has handle %u.\n", name, (int) IPC_GET_ARG1(answer)); 197 printf("Device '%s' has handle %u.\n", name, 198 (int) IPC_GET_ARG1(answer)); 195 199 } else { 196 200 printf("Failed to get handle for device '%s'.\n", name); … … 213 217 req = async_send_2(driver_phone, DEVMAP_DEVICE_REGISTER, 0, 0, &answer); 214 218 215 retval = ipc_data_send(driver_phone, (char *)name, strlen(name) + 1); 219 retval = ipc_data_write_send(driver_phone, (char *)name, 220 strlen(name) + 1); 216 221 217 222 if (retval != EOK) { … … 232 237 *handle = (int) IPC_GET_ARG1(answer); 233 238 } 234 printf("Device registered with handle %u.\n", (int) IPC_GET_ARG1(answer)); 239 printf("Device registered with handle %u.\n", 240 (int) IPC_GET_ARG1(answer)); 235 241 } 236 242 -
uspace/app/tester/vfs/vfs1.c
r5c786d1 r36d852c 54 54 aid_t req; 55 55 req = async_send_1(vfs_phone, VFS_MOUNT, TMPFS_DEVHANDLE, NULL); 56 if (ipc_data_ send(vfs_phone, fs_name, strlen(fs_name)) != EOK) {56 if (ipc_data_write_send(vfs_phone, fs_name, strlen(fs_name)) != EOK) { 57 57 async_wait_for(req, &rc); 58 58 return "Could not send fs_name to VFS.\n"; 59 59 } 60 if (ipc_data_ send(vfs_phone, mp, strlen(mp)) != EOK) {60 if (ipc_data_write_send(vfs_phone, mp, strlen(mp)) != EOK) { 61 61 async_wait_for(req, &rc); 62 62 return "Could not send mp to VFS.\n"; … … 71 71 ipc_call_t answer; 72 72 req = async_send_2(vfs_phone, VFS_OPEN, 0, 0, &answer); 73 if (ipc_data_ send(vfs_phone, path, strlen(path)) != EOK) {73 if (ipc_data_write_send(vfs_phone, path, strlen(path)) != EOK) { 74 74 async_wait_for(req, &rc); 75 75 return "Could not send path to VFS.\n"; -
uspace/lib/libc/generic/ipc.c
r5c786d1 r36d852c 667 667 } 668 668 669 /** Wrapper for making IPC_M_DATA_ SENDcalls.669 /** Wrapper for making IPC_M_DATA_WRITE calls. 670 670 * 671 671 * @param phoneid Phone that will be used to contact the receiving side. … … 675 675 * @return Zero on success or a negative error code from errno.h. 676 676 */ 677 int ipc_data_ send(int phoneid, void *src, size_t size)678 { 679 return ipc_call_sync_3_0(phoneid, IPC_M_DATA_ SEND, 0, (ipcarg_t) src,677 int ipc_data_write_send(int phoneid, void *src, size_t size) 678 { 679 return ipc_call_sync_3_0(phoneid, IPC_M_DATA_WRITE, 0, (ipcarg_t) src, 680 680 (ipcarg_t) size); 681 681 } 682 682 683 /** Wrapper for receiving the IPC_M_DATA_ SENDcalls.684 * 685 * This wrapper only makes it more comfortable to receive IPC_M_DATA_ SENDcalls683 /** Wrapper for receiving the IPC_M_DATA_WRITE calls. 684 * 685 * This wrapper only makes it more comfortable to receive IPC_M_DATA_WRITE calls 686 686 * so that the user doesn't have to remember the meaning of each IPC argument. 687 687 * 688 688 * So far, this wrapper is to be used from within a connection fibril. 689 689 * 690 * @param callid Storage where the hash of the IPC_M_DATA_ SENDcall will690 * @param callid Storage where the hash of the IPC_M_DATA_WRITE call will 691 691 * be stored. 692 692 * @param dst Storage where the suggested destination address will … … 697 697 * @return Non-zero on success, zero on failure. 698 698 */ 699 int ipc_data_ receive(ipc_callid_t *callid, void **dst, size_t *size)699 int ipc_data_write_receive(ipc_callid_t *callid, void **dst, size_t *size) 700 700 { 701 701 ipc_call_t data; … … 704 704 705 705 *callid = async_get_call(&data); 706 if (IPC_GET_METHOD(data) != IPC_M_DATA_ SEND)706 if (IPC_GET_METHOD(data) != IPC_M_DATA_WRITE) 707 707 return 0; 708 708 if (dst) … … 713 713 } 714 714 715 /** Wrapper for answering the IPC_M_DATA_ SENDcalls.716 * 717 * This wrapper only makes it more comfortable to answer IPC_M_DATA_ SENDcalls715 /** Wrapper for answering the IPC_M_DATA_WRITE calls. 716 * 717 * This wrapper only makes it more comfortable to answer IPC_M_DATA_WRITE calls 718 718 * so that the user doesn't have to remember the meaning of each IPC argument. 719 719 * 720 * @param callid Hash of the IPC_M_DATA_ SENDcall to answer.721 * @param dst Final destination address for the IPC_M_DATA_ SENDcall.722 * @param size Final size for the IPC_M_DATA_ SENDcall.720 * @param callid Hash of the IPC_M_DATA_WRITE call to answer. 721 * @param dst Final destination address for the IPC_M_DATA_WRITE call. 722 * @param size Final size for the IPC_M_DATA_WRITE call. 723 723 * 724 724 * @return Zero on success or a value from @ref errno.h on failure. 725 725 */ 726 ipcarg_t ipc_data_ deliver(ipc_callid_t callid, void *dst, size_t size)726 ipcarg_t ipc_data_write_deliver(ipc_callid_t callid, void *dst, size_t size) 727 727 { 728 728 return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size); -
uspace/lib/libc/include/ipc/ipc.h
r5c786d1 r36d852c 261 261 extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, 262 262 ipcarg_t arg1, ipcarg_t arg2, int mode); 263 extern int ipc_data_send(int phoneid, void *src, size_t size); 264 extern int ipc_data_receive(ipc_callid_t *callid, void **dst, size_t *size); 265 extern ipcarg_t ipc_data_deliver(ipc_callid_t callid, void *dst, size_t size); 263 extern int ipc_data_write_send(int phoneid, void *src, size_t size); 264 extern int ipc_data_write_receive(ipc_callid_t *callid, void **dst, 265 size_t *size); 266 extern ipcarg_t ipc_data_write_deliver(ipc_callid_t callid, void *dst, 267 size_t size); 266 268 267 269 #endif -
uspace/lib/libfs/libfs.c
r5c786d1 r36d852c 72 72 * Send our VFS info structure to VFS. 73 73 */ 74 int rc = ipc_data_ send(vfs_phone, info, sizeof(*info));74 int rc = ipc_data_write_send(vfs_phone, info, sizeof(*info)); 75 75 if (rc != EOK) { 76 76 async_wait_for(req, NULL); -
uspace/srv/devmap/devmap.c
r5c786d1 r36d852c 203 203 * Get driver name 204 204 */ 205 if (!ipc_data_ receive(&callid, NULL, &name_size)) {205 if (!ipc_data_write_receive(&callid, NULL, &name_size)) { 206 206 printf("Unexpected request.\n"); 207 207 free(driver); … … 234 234 * Send confirmation to sender and get data into buffer. 235 235 */ 236 if (EOK != ipc_data_ deliver(callid, driver->name, name_size)) {236 if (EOK != ipc_data_write_deliver(callid, driver->name, name_size)) { 237 237 printf("Cannot read driver name.\n"); 238 238 free(driver->name); … … 369 369 370 370 /* Get device name */ 371 if (!ipc_data_ receive(&callid, NULL, &size)) {371 if (!ipc_data_write_receive(&callid, NULL, &size)) { 372 372 free(device); 373 373 printf("Cannot read device name.\n"); … … 395 395 } 396 396 397 ipc_data_ deliver(callid, device->name, size);397 ipc_data_write_deliver(callid, device->name, size); 398 398 device->name[size] = 0; 399 399 … … 490 490 * read the name itself until the buffer is allocated). 491 491 */ 492 if (!ipc_data_ receive(&callid, NULL, &name_size)) {492 if (!ipc_data_write_receive(&callid, NULL, &name_size)) { 493 493 ipc_answer_0(callid, EREFUSED); 494 494 ipc_answer_0(iid, EREFUSED); … … 514 514 * Send confirmation to sender and get data into buffer. 515 515 */ 516 if (EOK != (retval = ipc_data_ deliver(callid, name, name_size))) {516 if (EOK != (retval = ipc_data_write_deliver(callid, name, name_size))) { 517 517 ipc_answer_0(iid, EREFUSED); 518 518 return; … … 567 567 sending must be initiated by client 568 568 569 int rc = ipc_data_ send(phone, device->name, name_size);569 int rc = ipc_data_write_send(phone, device->name, name_size); 570 570 if (rc != EOK) { 571 571 async_wait_for(req, NULL); -
uspace/srv/vfs/vfs_mount.c
r5c786d1 r36d852c 87 87 * system. 88 88 */ 89 if (!ipc_data_ receive(&callid, NULL, &size)) {89 if (!ipc_data_write_receive(&callid, NULL, &size)) { 90 90 ipc_answer_0(callid, EINVAL); 91 91 ipc_answer_0(rid, EINVAL); … … 107 107 */ 108 108 char fs_name[FS_NAME_MAXLEN + 1]; 109 (void) ipc_data_ deliver(callid, fs_name, size);109 (void) ipc_data_write_deliver(callid, fs_name, size); 110 110 fs_name[size] = '\0'; 111 111 … … 123 123 * Now, we want the client to send us the mount point. 124 124 */ 125 if (!ipc_data_ receive(&callid, NULL, &size)) {125 if (!ipc_data_write_receive(&callid, NULL, &size)) { 126 126 ipc_answer_0(callid, EINVAL); 127 127 ipc_answer_0(rid, EINVAL); … … 151 151 * Deliver the mount point. 152 152 */ 153 (void) ipc_data_ deliver(callid, buf, size);153 (void) ipc_data_write_deliver(callid, buf, size); 154 154 155 155 /* -
uspace/srv/vfs/vfs_open.c
r5c786d1 r36d852c 62 62 ipc_callid_t callid; 63 63 64 if (!ipc_data_ receive(&callid, NULL, &size)) {64 if (!ipc_data_write_receive(&callid, NULL, &size)) { 65 65 ipc_answer_0(callid, EINVAL); 66 66 ipc_answer_0(rid, EINVAL); … … 83 83 84 84 int rc; 85 if ((rc = ipc_data_ deliver(callid, path, size))) {85 if ((rc = ipc_data_write_deliver(callid, path, size))) { 86 86 ipc_answer_0(rid, rc); 87 87 free(path); -
uspace/srv/vfs/vfs_register.c
r5c786d1 r36d852c 165 165 * VFS info structure from the client FS. 166 166 */ 167 if (!ipc_data_ receive(&callid, NULL, &size)) {167 if (!ipc_data_write_receive(&callid, NULL, &size)) { 168 168 /* 169 169 * The client doesn't obey the same protocol as we do. … … 206 206 futex_initialize(&fs_info->phone_futex, 1); 207 207 208 rc = ipc_data_ deliver(callid, &fs_info->vfs_info, size);208 rc = ipc_data_write_deliver(callid, &fs_info->vfs_info, size); 209 209 if (rc != EOK) { 210 210 dprintf("Failed to deliver the VFS info into our AS, rc=%d.\n",
Note:
See TracChangeset
for help on using the changeset viewer.