Changeset a46e56b in mainline for uspace/lib/c/generic/inetping.c


Ignore:
Timestamp:
2018-03-22T06:49:35Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77f0a1d
Parents:
3e242d2
git-author:
Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
git-committer:
Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
Message:

Prefer handle over ID in naming handle variables

File:
1 edited

Legend:

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

    r3e242d2 ra46e56b  
    150150}
    151151
    152 static void inetping_ev_recv(cap_call_handle_t iid, ipc_call_t *icall)
     152static void inetping_ev_recv(cap_call_handle_t icall_handle, ipc_call_t *icall)
    153153{
    154154        inetping_sdu_t sdu;
     
    156156        sdu.seq_no = IPC_GET_ARG1(*icall);
    157157
    158         cap_call_handle_t callid;
     158        cap_call_handle_t chandle;
    159159        size_t size;
    160         if (!async_data_write_receive(&callid, &size)) {
    161                 async_answer_0(callid, EREFUSED);
    162                 async_answer_0(iid, EREFUSED);
     160        if (!async_data_write_receive(&chandle, &size)) {
     161                async_answer_0(chandle, EREFUSED);
     162                async_answer_0(icall_handle, EREFUSED);
    163163                return;
    164164        }
    165165
    166166        if (size != sizeof(sdu.src)) {
    167                 async_answer_0(callid, EINVAL);
    168                 async_answer_0(iid, EINVAL);
    169                 return;
    170         }
    171 
    172         errno_t rc = async_data_write_finalize(callid, &sdu.src, size);
    173         if (rc != EOK) {
    174                 async_answer_0(callid, rc);
    175                 async_answer_0(iid, rc);
    176                 return;
    177         }
    178 
    179         if (!async_data_write_receive(&callid, &size)) {
    180                 async_answer_0(callid, EREFUSED);
    181                 async_answer_0(iid, EREFUSED);
     167                async_answer_0(chandle, EINVAL);
     168                async_answer_0(icall_handle, EINVAL);
     169                return;
     170        }
     171
     172        errno_t rc = async_data_write_finalize(chandle, &sdu.src, size);
     173        if (rc != EOK) {
     174                async_answer_0(chandle, rc);
     175                async_answer_0(icall_handle, rc);
     176                return;
     177        }
     178
     179        if (!async_data_write_receive(&chandle, &size)) {
     180                async_answer_0(chandle, EREFUSED);
     181                async_answer_0(icall_handle, EREFUSED);
    182182                return;
    183183        }
    184184
    185185        if (size != sizeof(sdu.dest)) {
    186                 async_answer_0(callid, EINVAL);
    187                 async_answer_0(iid, EINVAL);
    188                 return;
    189         }
    190 
    191         rc = async_data_write_finalize(callid, &sdu.dest, size);
    192         if (rc != EOK) {
    193                 async_answer_0(callid, rc);
    194                 async_answer_0(iid, rc);
     186                async_answer_0(chandle, EINVAL);
     187                async_answer_0(icall_handle, EINVAL);
     188                return;
     189        }
     190
     191        rc = async_data_write_finalize(chandle, &sdu.dest, size);
     192        if (rc != EOK) {
     193                async_answer_0(chandle, rc);
     194                async_answer_0(icall_handle, rc);
    195195                return;
    196196        }
     
    198198        rc = async_data_write_accept(&sdu.data, false, 0, 0, 0, &sdu.size);
    199199        if (rc != EOK) {
    200                 async_answer_0(iid, rc);
     200                async_answer_0(icall_handle, rc);
    201201                return;
    202202        }
     
    204204        rc = inetping_ev_ops->recv(&sdu);
    205205        free(sdu.data);
    206         async_answer_0(iid, rc);
    207 }
    208 
    209 static void inetping_cb_conn(cap_call_handle_t iid, ipc_call_t *icall, void *arg)
     206        async_answer_0(icall_handle, rc);
     207}
     208
     209static void inetping_cb_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
    210210{
    211211        while (true) {
    212212                ipc_call_t call;
    213                 cap_call_handle_t callid = async_get_call(&call);
     213                cap_call_handle_t chandle = async_get_call(&call);
    214214
    215215                if (!IPC_GET_IMETHOD(call)) {
     
    220220                switch (IPC_GET_IMETHOD(call)) {
    221221                case INETPING_EV_RECV:
    222                         inetping_ev_recv(callid, &call);
     222                        inetping_ev_recv(chandle, &call);
    223223                        break;
    224224                default:
    225                         async_answer_0(callid, ENOTSUP);
     225                        async_answer_0(chandle, ENOTSUP);
    226226                }
    227227        }
Note: See TracChangeset for help on using the changeset viewer.