Changeset 7880d58 in mainline


Ignore:
Timestamp:
2010-12-16T18:39:08Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cc274f5a
Parents:
f87c900
Message:

Remove data_receive() in favor of standard async_data_write_accept().

Location:
uspace
Files:
4 edited

Legend:

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

    rf87c900 r7880d58  
    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 *
  • uspace/srv/net/il/ip/ip.c

    rf87c900 r7880d58  
    19491949
    19501950        case NET_IP_GET_ROUTE:
    1951                 rc = data_receive((void **) &addr, &addrlen);
     1951                rc = async_data_write_accept((void **) &addr, false, 0, 0, 0,
     1952                    &addrlen);
    19521953                if (rc != EOK)
    19531954                        return rc;
  • uspace/srv/net/tl/tcp/tcp.c

    rf87c900 r7880d58  
    13651365
    13661366                case NET_SOCKET_BIND:
    1367                         res = data_receive((void **) &addr, &addrlen);
     1367                        res = async_data_write_accept((void **) &addr, false,
     1368                            0, 0, 0, &addrlen);
    13681369                        if (res != EOK)
    13691370                                break;
     
    14021403
    14031404                case NET_SOCKET_CONNECT:
    1404                         res = data_receive((void **) &addr, &addrlen);
     1405                        res = async_data_write_accept((void **) &addr, false,
     1406                            0, 0, 0, &addrlen);
    14051407                        if (res != EOK)
    14061408                                break;
     
    14531455
    14541456                case NET_SOCKET_SENDTO:
    1455                         res = data_receive((void **) &addr, &addrlen);
     1457                        res = async_data_write_accept((void **) &addr, false,
     1458                            0, 0, 0, &addrlen);
    14561459                        if (res != EOK)
    14571460                                break;
  • uspace/srv/net/tl/udp/udp.c

    rf87c900 r7880d58  
    771771
    772772                case NET_SOCKET_BIND:
    773                         res = data_receive((void **) &addr, &addrlen);
     773                        res = async_data_write_accept((void **) &addr, false,
     774                            0, 0, 0, &addrlen);
    774775                        if (res != EOK)
    775776                                break;
     
    784785
    785786                case NET_SOCKET_SENDTO:
    786                         res = data_receive((void **) &addr, &addrlen);
     787                        res = async_data_write_accept((void **) &addr, false,
     788                            0, 0, 0, &addrlen);
    787789                        if (res != EOK)
    788790                                break;
Note: See TracChangeset for help on using the changeset viewer.