Changeset f6bffee in mainline for uspace


Ignore:
Timestamp:
2011-04-06T20:19:04Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
55132b8, b910455
Parents:
b946bf83
Message:

Allow special flags that control processing of IPC_M_DATA_READ/WRITE in
the kernel:

  • IPC_XF_NONE: default behavior
  • IPC_XF_RESTRICT: restrict the transfer size if necessary

Make read() and write() use IPC_XF_RESTRICT.

Location:
uspace/lib/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/async.c

    rb946bf83 rf6bffee  
    15721572 * @param dst     Address of the beginning of the destination buffer.
    15731573 * @param size    Size of the destination buffer.
     1574 * @param flags   Flags to control the data transfer.
    15741575 *
    15751576 * @return Zero on success or a negative error code from errno.h.
    15761577 *
    15771578 */
    1578 int async_data_read_start(int phoneid, void *dst, size_t size)
    1579 {
    1580         return async_req_2_0(phoneid, IPC_M_DATA_READ, (sysarg_t) dst,
    1581             (sysarg_t) size);
     1579int
     1580async_data_read_start_flexible(int phoneid, void *dst, size_t size, int flags)
     1581{
     1582        return async_req_3_0(phoneid, IPC_M_DATA_READ, (sysarg_t) dst,
     1583            (sysarg_t) size, (sysarg_t) flags);
    15821584}
    15831585
     
    16691671 * @param src     Address of the beginning of the source buffer.
    16701672 * @param size    Size of the source buffer.
     1673 * @param flags   Flags to control the data transfer.
    16711674 *
    16721675 * @return Zero on success or a negative error code from errno.h.
    16731676 *
    16741677 */
    1675 int async_data_write_start(int phoneid, const void *src, size_t size)
    1676 {
    1677         return async_req_2_0(phoneid, IPC_M_DATA_WRITE, (sysarg_t) src,
    1678             (sysarg_t) size);
     1678int
     1679async_data_write_start_flexible(int phoneid, const void *src, size_t size,
     1680    int flags)
     1681{
     1682        return async_req_3_0(phoneid, IPC_M_DATA_WRITE, (sysarg_t) src,
     1683            (sysarg_t) size, (sysarg_t) flags);
    16791684}
    16801685
  • uspace/lib/c/generic/vfs/vfs.c

    rb946bf83 rf6bffee  
    378378       
    379379        req = async_send_1(vfs_phone, VFS_IN_READ, fildes, &answer);
    380         rc = async_data_read_start(vfs_phone, (void *)buf, nbyte);
     380        rc = async_data_read_start_flexible(vfs_phone, (void *) buf, nbyte,
     381            IPC_XF_RESTRICT);
    381382        if (rc != EOK) {
    382383                vfs_exchange_end(vfs_phone);
     
    407408       
    408409        req = async_send_1(vfs_phone, VFS_IN_WRITE, fildes, &answer);
    409         rc = async_data_write_start(vfs_phone, (void *)buf, nbyte);
     410        rc = async_data_write_start_flexible(vfs_phone, (void *) buf, nbyte,
     411            IPC_XF_RESTRICT);
    410412        if (rc != EOK) {
    411413                vfs_exchange_end(vfs_phone);
  • uspace/lib/c/include/async.h

    rb946bf83 rf6bffee  
    340340            (arg4), (answer))
    341341
    342 extern int async_data_read_start(int, void *, size_t);
     342#define async_data_read_start(p, buf, len) \
     343        async_data_read_start_flexible((p), (buf), (len), IPC_XF_NONE)
     344
     345extern int async_data_read_start_flexible(int, void *, size_t, int);
    343346extern bool async_data_read_receive(ipc_callid_t *, size_t *);
    344347extern int async_data_read_finalize(ipc_callid_t, const void *, size_t);
     
    379382            (arg4), (answer))
    380383
    381 extern int async_data_write_start(int, const void *, size_t);
     384#define async_data_write_start(p, buf, len) \
     385        async_data_write_start_flexible((p), (buf), (len), IPC_XF_NONE)
     386
     387extern int async_data_write_start_flexible(int, const void *, size_t, int);
    382388extern bool async_data_write_receive(ipc_callid_t *, size_t *);
    383389extern int async_data_write_finalize(ipc_callid_t, void *, size_t);
Note: See TracChangeset for help on using the changeset viewer.