Changeset f568ee7 in mainline for uspace/lib/c/generic/net/modules.c


Ignore:
Timestamp:
2010-12-19T10:34:19Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e080332
Parents:
6e5dc07 (diff), 557c7d0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge with /usb/development

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/net/modules.c

    r6e5dc07 rf568ee7  
    198198}
    199199
    200 /** Receives data from the other party.
    201  *
    202  * The received data buffer is allocated and returned.
    203  *
    204  * @param[out] data     The data buffer to be filled.
    205  * @param[out] length   The buffer length.
    206  * @return              EOK on success.
    207  * @return              EBADMEM if the data or the length parameter is NULL.
    208  * @return              EINVAL if the client does not send data.
    209  * @return              ENOMEM if there is not enough memory left.
    210  * @return              Other error codes as defined for the
    211  *                      async_data_write_finalize() function.
    212  */
    213 int data_receive(void **data, size_t *length)
    214 {
    215         ipc_callid_t callid;
    216         int rc;
    217 
    218         if (!data || !length)
    219                 return EBADMEM;
    220 
    221         // fetch the request
    222         if (!async_data_write_receive(&callid, length))
    223                 return EINVAL;
    224 
    225         // allocate the buffer
    226         *data = malloc(*length);
    227         if (!*data)
    228                 return ENOMEM;
    229 
    230         // fetch the data
    231         rc = async_data_write_finalize(callid, *data, *length);
    232         if (rc != EOK) {
    233                 free(data);
    234                 return rc;
    235         }
    236 
    237         return EOK;
    238 }
    239 
    240200/** Replies the data to the other party.
    241201 *
Note: See TracChangeset for help on using the changeset viewer.