Changeset 36d852c in mainline


Ignore:
Timestamp:
2007-12-23T19:45:30Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
654b7db
Parents:
5c786d1
Message:

Rename IPC_M_DATA_SEND to IPC_M_DATA_WRITE. Now, when we also add
IPC_M_DATA_READ, it will not clash and cause confusion with userspace wrappers
such as ipc_data_receive(). Rename the forementioned wrappers to
ipc_data_write_send(), ipc_data_write_receive() and ipc_data_write_deliver().

Files:
11 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ipc/ipc.h

    r5c786d1 r36d852c  
    185185 * - ARG3 - final size of data to be copied
    186186 */
    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
    188199
    189200/* Well-known methods */
  • kernel/generic/src/ipc/sysipc.c

    r5c786d1 r36d852c  
    5050#include <print.h>
    5151
    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)
    5457
    5558#define GET_CHECK_PHONE(phone, phoneid, err) \
     
    112115        case IPC_M_AS_AREA_SEND:
    113116        case IPC_M_AS_AREA_RECV:
    114         case IPC_M_DATA_SEND:
     117        case IPC_M_DATA_WRITE:
     118        case IPC_M_DATA_READ:
    115119                return 1;
    116120                break;
     
    140144        case IPC_M_AS_AREA_SEND:
    141145        case IPC_M_AS_AREA_RECV:
    142         case IPC_M_DATA_SEND:
     146        case IPC_M_DATA_WRITE:
     147        case IPC_M_DATA_READ:
    143148                return 1;
    144149        default:
     
    231236                        IPC_SET_RETVAL(answer->data, rc);
    232237                }
    233         } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_SEND) {
     238        } else if (IPC_GET_METHOD(*olddata) == IPC_M_DATA_WRITE) {
    234239                if (!IPC_GET_RETVAL(answer->data)) {
    235240                        int rc;
     
    281286                IPC_SET_ARG2(call->data, size);
    282287                break;
    283         case IPC_M_DATA_SEND:
     288        case IPC_M_DATA_WRITE:
    284289                src = IPC_GET_ARG2(call->data);
    285290                size = IPC_GET_ARG3(call->data);
    286291               
    287                 if ((size <= 0) || (size > DATA_SEND_LIMIT))
     292                if ((size <= 0) || (size > DATA_XFER_LIMIT))
    288293                        return ELIMIT;
    289294               
  • uspace/app/tester/devmap/devmap1.c

    r5c786d1 r36d852c  
    5050        int retval;
    5151       
    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));
    5455
    5556        printf("driver_client_connection.\n");
     
    6061                callid = async_get_call(&call);
    6162                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));
    6466                switch (IPC_GET_METHOD(call)) {
    6567                case IPC_M_PHONE_HUNGUP:
     
    6769                        return;
    6870                default:
    69                         printf("Unknown device method %u.\n", IPC_GET_METHOD(call));
     71                        printf("Unknown device method %u.\n",
     72                            IPC_GET_METHOD(call));
    7073                        retval = ENOENT;
    7174                }
     
    8285        handle = (int)arg;
    8386
    84         device_phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, \
    85                 DEVMAP_CONNECT_TO_DEVICE, handle);
     87        device_phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP,
     88            DEVMAP_CONNECT_TO_DEVICE, handle);
    8689
    8790        if (device_phone < 0) {
    88                 printf("Failed to connect to devmap as client (handle = %u).\n", 
    89                         handle);
     91                printf("Failed to connect to devmap as client (handle = %u).\n",
     92                    handle);
    9093                return -1;
    9194        }
     
    130133        ipcarg_t callback_phonehash;
    131134
    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);
    134136
    135137        while (phone < 0) {
    136138                usleep(100000);
    137139                phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP,
    138                         DEVMAP_DRIVER, 0);
     140                    DEVMAP_DRIVER, 0);
    139141        }
    140142       
    141143        req = async_send_2(phone, DEVMAP_DRIVER_REGISTER, 0, 0, &answer);
    142144
    143         retval = ipc_data_send(phone, (char *)name, strlen(name) + 1);
     145        retval = ipc_data_write_send(phone, (char *)name, strlen(name) + 1);
    144146
    145147        if (retval != EOK) {
     
    171173        ipc_call_t answer;
    172174
    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);
    176179
    177180        if (retval != EOK) {
     
    192195                        *handle = (int) IPC_GET_ARG1(answer);
    193196                }
    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));
    195199        } else {
    196200                printf("Failed to get handle for device '%s'.\n", name);
     
    213217        req = async_send_2(driver_phone, DEVMAP_DEVICE_REGISTER, 0, 0, &answer);
    214218
    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);
    216221
    217222        if (retval != EOK) {
     
    232237                        *handle = (int) IPC_GET_ARG1(answer);
    233238                }
    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));
    235241        }
    236242
  • uspace/app/tester/vfs/vfs1.c

    r5c786d1 r36d852c  
    5454        aid_t req;
    5555        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) {
    5757                async_wait_for(req, &rc);
    5858                return "Could not send fs_name to VFS.\n";
    5959        }
    60         if (ipc_data_send(vfs_phone, mp, strlen(mp)) != EOK) {
     60        if (ipc_data_write_send(vfs_phone, mp, strlen(mp)) != EOK) {
    6161                async_wait_for(req, &rc);
    6262                return "Could not send mp to VFS.\n";
     
    7171        ipc_call_t answer;
    7272        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) {
    7474                async_wait_for(req, &rc);
    7575                return "Could not send path to VFS.\n";
  • uspace/lib/libc/generic/ipc.c

    r5c786d1 r36d852c  
    667667}
    668668
    669 /** Wrapper for making IPC_M_DATA_SEND calls.
     669/** Wrapper for making IPC_M_DATA_WRITE calls.
    670670 *
    671671 * @param phoneid       Phone that will be used to contact the receiving side.
     
    675675 * @return              Zero on success or a negative error code from errno.h.
    676676 */
    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,
     677int 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,
    680680            (ipcarg_t) size);
    681681}
    682682
    683 /** Wrapper for receiving the IPC_M_DATA_SEND calls.
    684  *
    685  * This wrapper only makes it more comfortable to receive IPC_M_DATA_SEND calls
     683/** 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
    686686 * so that the user doesn't have to remember the meaning of each IPC argument.
    687687 *
    688688 * So far, this wrapper is to be used from within a connection fibril.
    689689 *
    690  * @param callid        Storage where the hash of the IPC_M_DATA_SEND call will
     690 * @param callid        Storage where the hash of the IPC_M_DATA_WRITE call will
    691691 *                      be stored.
    692692 * @param dst           Storage where the suggested destination address will
     
    697697 * @return              Non-zero on success, zero on failure.
    698698 */
    699 int ipc_data_receive(ipc_callid_t *callid, void **dst, size_t *size)
     699int ipc_data_write_receive(ipc_callid_t *callid, void **dst, size_t *size)
    700700{
    701701        ipc_call_t data;
     
    704704
    705705        *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)
    707707                return 0;
    708708        if (dst)
     
    713713}
    714714
    715 /** Wrapper for answering the IPC_M_DATA_SEND calls.
    716  *
    717  * This wrapper only makes it more comfortable to answer IPC_M_DATA_SEND calls
     715/** 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
    718718 * so that the user doesn't have to remember the meaning of each IPC argument.
    719719 *
    720  * @param callid        Hash of the IPC_M_DATA_SEND call to answer.
    721  * @param dst           Final destination address for the IPC_M_DATA_SEND call.
    722  * @param size          Final size for the IPC_M_DATA_SEND call.
     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.
    723723 *
    724724 * @return              Zero on success or a value from @ref errno.h on failure.
    725725 */
    726 ipcarg_t ipc_data_deliver(ipc_callid_t callid, void *dst, size_t size)
     726ipcarg_t ipc_data_write_deliver(ipc_callid_t callid, void *dst, size_t size)
    727727{
    728728        return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size);
  • uspace/lib/libc/include/ipc/ipc.h

    r5c786d1 r36d852c  
    261261extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
    262262    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);
     263extern int ipc_data_write_send(int phoneid, void *src, size_t size);
     264extern int ipc_data_write_receive(ipc_callid_t *callid, void **dst,
     265    size_t *size);
     266extern ipcarg_t ipc_data_write_deliver(ipc_callid_t callid, void *dst,
     267    size_t size);
    266268
    267269#endif
  • uspace/lib/libfs/libfs.c

    r5c786d1 r36d852c  
    7272         * Send our VFS info structure to VFS.
    7373         */
    74         int rc = ipc_data_send(vfs_phone, info, sizeof(*info));
     74        int rc = ipc_data_write_send(vfs_phone, info, sizeof(*info));
    7575        if (rc != EOK) {
    7676                async_wait_for(req, NULL);
  • uspace/srv/devmap/devmap.c

    r5c786d1 r36d852c  
    203203         * Get driver name
    204204         */
    205         if (!ipc_data_receive(&callid, NULL, &name_size)) {
     205        if (!ipc_data_write_receive(&callid, NULL, &name_size)) {
    206206                printf("Unexpected request.\n");
    207207                free(driver);
     
    234234         * Send confirmation to sender and get data into buffer.
    235235         */
    236         if (EOK != ipc_data_deliver(callid, driver->name, name_size)) {
     236        if (EOK != ipc_data_write_deliver(callid, driver->name, name_size)) {
    237237                printf("Cannot read driver name.\n");
    238238                free(driver->name);
     
    369369       
    370370        /* Get device name */
    371         if (!ipc_data_receive(&callid, NULL, &size)) {
     371        if (!ipc_data_write_receive(&callid, NULL, &size)) {
    372372                free(device);
    373373                printf("Cannot read device name.\n");
     
    395395        }
    396396       
    397         ipc_data_deliver(callid, device->name, size);
     397        ipc_data_write_deliver(callid, device->name, size);
    398398        device->name[size] = 0;
    399399
     
    490490         * read the name itself until the buffer is allocated).
    491491         */
    492         if (!ipc_data_receive(&callid, NULL, &name_size)) {
     492        if (!ipc_data_write_receive(&callid, NULL, &name_size)) {
    493493                ipc_answer_0(callid, EREFUSED);
    494494                ipc_answer_0(iid, EREFUSED);
     
    514514         * Send confirmation to sender and get data into buffer.
    515515         */
    516         if (EOK != (retval = ipc_data_deliver(callid, name, name_size))) {
     516        if (EOK != (retval = ipc_data_write_deliver(callid, name, name_size))) {
    517517                ipc_answer_0(iid, EREFUSED);
    518518                return;
     
    567567        sending must be initiated by client
    568568
    569         int rc = ipc_data_send(phone, device->name, name_size);
     569        int rc = ipc_data_write_send(phone, device->name, name_size);
    570570        if (rc != EOK) {
    571571                async_wait_for(req, NULL);
  • uspace/srv/vfs/vfs_mount.c

    r5c786d1 r36d852c  
    8787         * system.
    8888         */
    89         if (!ipc_data_receive(&callid, NULL, &size)) {
     89        if (!ipc_data_write_receive(&callid, NULL, &size)) {
    9090                ipc_answer_0(callid, EINVAL);
    9191                ipc_answer_0(rid, EINVAL);
     
    107107         */
    108108        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);
    110110        fs_name[size] = '\0';
    111111       
     
    123123         * Now, we want the client to send us the mount point.
    124124         */
    125         if (!ipc_data_receive(&callid, NULL, &size)) {
     125        if (!ipc_data_write_receive(&callid, NULL, &size)) {
    126126                ipc_answer_0(callid, EINVAL);
    127127                ipc_answer_0(rid, EINVAL);
     
    151151         * Deliver the mount point.
    152152         */
    153         (void) ipc_data_deliver(callid, buf, size);
     153        (void) ipc_data_write_deliver(callid, buf, size);
    154154
    155155        /*
  • uspace/srv/vfs/vfs_open.c

    r5c786d1 r36d852c  
    6262        ipc_callid_t callid;
    6363
    64         if (!ipc_data_receive(&callid, NULL, &size)) {
     64        if (!ipc_data_write_receive(&callid, NULL, &size)) {
    6565                ipc_answer_0(callid, EINVAL);
    6666                ipc_answer_0(rid, EINVAL);
     
    8383
    8484        int rc;
    85         if ((rc = ipc_data_deliver(callid, path, size))) {
     85        if ((rc = ipc_data_write_deliver(callid, path, size))) {
    8686                ipc_answer_0(rid, rc);
    8787                free(path);
  • uspace/srv/vfs/vfs_register.c

    r5c786d1 r36d852c  
    165165         * VFS info structure from the client FS.
    166166         */
    167         if (!ipc_data_receive(&callid, NULL, &size)) {
     167        if (!ipc_data_write_receive(&callid, NULL, &size)) {
    168168                /*
    169169                 * The client doesn't obey the same protocol as we do.
     
    206206        futex_initialize(&fs_info->phone_futex, 1);
    207207               
    208         rc = ipc_data_deliver(callid, &fs_info->vfs_info, size);
     208        rc = ipc_data_write_deliver(callid, &fs_info->vfs_info, size);
    209209        if (rc != EOK) {
    210210                dprintf("Failed to deliver the VFS info into our AS, rc=%d.\n",
Note: See TracChangeset for help on using the changeset viewer.