Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 291c792 in mainline


Ignore:
Timestamp:
2012-03-08T21:54:25Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
fa101c4
Parents:
0e94b979
Message:

Set address object name upon creation.

Location:
uspace
Files:
2 edited

Legend:

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

    r0e94b979 r291c792  
    138138        async_exch_t *exch = async_exchange_begin(inetcfg_sess);
    139139
    140         int rc = async_req_3_1(exch, INETCFG_ADDR_CREATE_STATIC, naddr->ipv4,
    141             naddr->bits, link_id, addr_id);
    142         async_exchange_end(exch);
    143 
    144         return rc;
     140        ipc_call_t answer;
     141        aid_t req = async_send_3(exch, INETCFG_ADDR_CREATE_STATIC, naddr->ipv4,
     142            naddr->bits, link_id, &answer);
     143        sysarg_t retval = async_data_write_start(exch, name, str_size(name));
     144
     145        async_exchange_end(exch);
     146
     147        if (retval != EOK) {
     148                async_wait_for(req, NULL);
     149                return retval;
     150        }
     151
     152        async_wait_for(req, &retval);
     153        *addr_id = IPC_GET_ARG1(answer);
     154
     155        return retval;
    145156}
    146157
  • uspace/srv/inet/inetcfg.c

    r0e94b979 r291c792  
    5050#include "inetcfg.h"
    5151
    52 static int inetcfg_addr_create_static(inet_naddr_t *naddr, sysarg_t link_id,
    53     sysarg_t *addr_id)
     52static int inetcfg_addr_create_static(char *name, inet_naddr_t *naddr,
     53    sysarg_t link_id, sysarg_t *addr_id)
    5454{
    5555        inet_link_t *ilink;
     
    6868        addr->naddr = *naddr;
    6969        addr->ilink = ilink;
    70         addr->name = str_dup("foo");
     70        addr->name = str_dup(name);
    7171        inet_addrobj_add(addr);
    7272
     
    129129    ipc_call_t *call)
    130130{
     131        char *name;
    131132        inet_naddr_t naddr;
    132133        sysarg_t link_id;
     
    136137        log_msg(LVL_DEBUG, "inetcfg_addr_create_static_srv()");
    137138
     139        rc = async_data_write_accept((void **) &name, true, 0, LOC_NAME_MAXLEN,
     140            0, NULL);
     141        if (rc != EOK) {
     142                async_answer_0(callid, rc);
     143                return;
     144        }
     145
    138146        naddr.ipv4 = IPC_GET_ARG1(*call);
    139147        naddr.bits = IPC_GET_ARG2(*call);
     
    141149
    142150        addr_id = 0;
    143         rc = inetcfg_addr_create_static(&naddr, link_id, &addr_id);
     151        rc = inetcfg_addr_create_static(name, &naddr, link_id, &addr_id);
     152        free(name);
    144153        async_answer_1(callid, rc, addr_id);
    145154}
Note: See TracChangeset for help on using the changeset viewer.