Changeset a46e56b in mainline for uspace/srv/ns


Ignore:
Timestamp:
2018-03-22T06:49:35Z (8 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

Location:
uspace/srv/ns
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/ns/clonable.c

    r3e242d2 ra46e56b  
    4848        service_t service;
    4949        iface_t iface;
    50         cap_call_handle_t callid;
     50        cap_call_handle_t chandle;
    5151        sysarg_t arg3;
    5252} cs_req_t;
     
    7575 */
    7676void register_clonable(service_t service, sysarg_t phone, ipc_call_t *call,
    77     cap_call_handle_t callid)
     77    cap_call_handle_t chandle)
    7878{
    7979        link_t *req_link = list_first(&cs_req);
     
    8181                /* There was no pending connection request. */
    8282                printf("%s: Unexpected clonable server.\n", NAME);
    83                 async_answer_0(callid, EBUSY);
     83                async_answer_0(chandle, EBUSY);
    8484                return;
    8585        }
     
    9191        assert(csr->service == SERVICE_LOADER);
    9292
    93         async_answer_0(callid, EOK);
     93        async_answer_0(chandle, EOK);
    9494
    9595        async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
    9696        if (sess == NULL)
    97                 async_answer_0(callid, EIO);
     97                async_answer_0(chandle, EIO);
    9898
    9999        async_exch_t *exch = async_exchange_begin(sess);
    100         async_forward_fast(csr->callid, exch, csr->iface, csr->arg3, 0,
     100        async_forward_fast(csr->chandle, exch, csr->iface, csr->arg3, 0,
    101101            IPC_FF_NONE);
    102102        async_exchange_end(exch);
     
    111111 * @param iface   Interface to be connected to.
    112112 * @param call    Pointer to call structure.
    113  * @param callid  Call ID of the request.
     113 * @param chandle  Call ID of the request.
    114114 *
    115115 * @return Zero on success or a value from @ref errno.h.
     
    117117 */
    118118void connect_to_clonable(service_t service, iface_t iface, ipc_call_t *call,
    119     cap_call_handle_t callid)
     119    cap_call_handle_t chandle)
    120120{
    121121        assert(service == SERVICE_LOADER);
     
    123123        cs_req_t *csr = malloc(sizeof(cs_req_t));
    124124        if (csr == NULL) {
    125                 async_answer_0(callid, ENOMEM);
     125                async_answer_0(chandle, ENOMEM);
    126126                return;
    127127        }
     
    132132        if (rc != EOK) {
    133133                free(csr);
    134                 async_answer_0(callid, rc);
     134                async_answer_0(chandle, rc);
    135135                return;
    136136        }
     
    139139        csr->service = service;
    140140        csr->iface = iface;
    141         csr->callid = callid;
     141        csr->chandle = chandle;
    142142        csr->arg3 = IPC_GET_ARG3(*call);
    143143
  • uspace/srv/ns/ns.c

    r3e242d2 ra46e56b  
    4949#include "task.h"
    5050
    51 static void ns_connection(cap_call_handle_t iid, ipc_call_t *icall, void *arg)
     51static void ns_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
    5252{
    5353        ipc_call_t call;
    54         cap_call_handle_t callid;
     54        cap_call_handle_t chandle;
    5555        iface_t iface;
    5656        service_t service;
     
    6363                 */
    6464                if (service_clonable(service)) {
    65                         connect_to_clonable(service, iface, icall, iid);
     65                        connect_to_clonable(service, iface, icall, icall_handle);
    6666                } else {
    67                         connect_to_service(service, iface, icall, iid);
     67                        connect_to_service(service, iface, icall, icall_handle);
    6868                }
    6969                return;
    7070        }
    7171
    72         async_answer_0(iid, EOK);
     72        async_answer_0(icall_handle, EOK);
    7373
    7474        while (true) {
    7575                process_pending_conn();
    7676
    77                 callid = async_get_call(&call);
     77                chandle = async_get_call(&call);
    7878                if (!IPC_GET_IMETHOD(call))
    7979                        break;
     
    9494                         */
    9595                        if (service_clonable(service)) {
    96                                 register_clonable(service, phone, &call, callid);
     96                                register_clonable(service, phone, &call, chandle);
    9797                                continue;
    9898                        } else {
     
    107107                        id = (task_id_t)
    108108                            MERGE_LOUP32(IPC_GET_ARG1(call), IPC_GET_ARG2(call));
    109                         wait_for_task(id, &call, callid);
     109                        wait_for_task(id, &call, chandle);
    110110                        continue;
    111111                case NS_ID_INTRO:
     
    121121                }
    122122
    123                 async_answer_0(callid, retval);
     123                async_answer_0(chandle, retval);
    124124        }
    125125
  • uspace/srv/ns/service.c

    r3e242d2 ra46e56b  
    8787typedef struct {
    8888        link_t link;
    89         service_t service;    /**< Service ID */
    90         iface_t iface;        /**< Interface ID */
    91         cap_call_handle_t callid;  /**< Call ID waiting for the connection */
    92         sysarg_t arg3;        /**< Third argument */
     89        service_t service;         /**< Service ID */
     90        iface_t iface;             /**< Interface ID */
     91        cap_call_handle_t chandle; /**< Call handle waiting for the connection */
     92        sysarg_t arg3;             /**< Third argument */
    9393} pending_conn_t;
    9494
     
    119119                hashed_service_t *hashed_service = hash_table_get_inst(link, hashed_service_t, link);
    120120                async_exch_t *exch = async_exchange_begin(hashed_service->sess);
    121                 async_forward_fast(pending->callid, exch, pending->iface,
     121                async_forward_fast(pending->chandle, exch, pending->iface,
    122122                    pending->arg3, 0, IPC_FF_NONE);
    123123                async_exchange_end(exch);
     
    163163 * @param iface   Interface to be connected to.
    164164 * @param call    Pointer to call structure.
    165  * @param callid  Call ID of the request.
     165 * @param chandle  Call ID of the request.
    166166 *
    167167 * @return Zero on success or a value from @ref errno.h.
     
    169169 */
    170170void connect_to_service(service_t service, iface_t iface, ipc_call_t *call,
    171     cap_call_handle_t callid)
     171    cap_call_handle_t chandle)
    172172{
    173173        sysarg_t arg3 = IPC_GET_ARG3(*call);
     
    189189                        pending->service = service;
    190190                        pending->iface = iface;
    191                         pending->callid = callid;
     191                        pending->chandle = chandle;
    192192                        pending->arg3 = arg3;
    193193
     
    202202        hashed_service_t *hashed_service = hash_table_get_inst(link, hashed_service_t, link);
    203203        async_exch_t *exch = async_exchange_begin(hashed_service->sess);
    204         async_forward_fast(callid, exch, iface, arg3, 0, IPC_FF_NONE);
     204        async_forward_fast(chandle, exch, iface, arg3, 0, IPC_FF_NONE);
    205205        async_exchange_end(exch);
    206206        return;
    207207
    208208out:
    209         async_answer_0(callid, retval);
     209        async_answer_0(chandle, retval);
    210210}
    211211
  • uspace/srv/ns/task.c

    r3e242d2 ra46e56b  
    146146        link_t link;
    147147        task_id_t id;         /**< Task ID. */
    148         cap_call_handle_t callid;  /**< Call ID waiting for the connection */
     148        cap_call_handle_t chandle;  /**< Call ID waiting for the connection */
    149149} pending_wait_t;
    150150
     
    184184                texit = ht->have_rval ? TASK_EXIT_NORMAL :
    185185                    TASK_EXIT_UNEXPECTED;
    186                 async_answer_2(pr->callid, EOK, texit, ht->retval);
     186                async_answer_2(pr->chandle, EOK, texit, ht->retval);
    187187
    188188                list_remove(&pr->link);
     
    192192}
    193193
    194 void wait_for_task(task_id_t id, ipc_call_t *call, cap_call_handle_t callid)
     194void wait_for_task(task_id_t id, ipc_call_t *call, cap_call_handle_t chandle)
    195195{
    196196        ht_link_t *link = hash_table_find(&task_hash_table, &id);
     
    200200        if (ht == NULL) {
    201201                /* No such task exists. */
    202                 async_answer_0(callid, ENOENT);
     202                async_answer_0(chandle, ENOENT);
    203203                return;
    204204        }
     
    207207                task_exit_t texit = ht->have_rval ? TASK_EXIT_NORMAL :
    208208                    TASK_EXIT_UNEXPECTED;
    209                 async_answer_2(callid, EOK, texit, ht->retval);
     209                async_answer_2(chandle, EOK, texit, ht->retval);
    210210                return;
    211211        }
     
    215215            (pending_wait_t *) malloc(sizeof(pending_wait_t));
    216216        if (!pr) {
    217                 async_answer_0(callid, ENOMEM);
     217                async_answer_0(chandle, ENOMEM);
    218218                return;
    219219        }
     
    221221        link_initialize(&pr->link);
    222222        pr->id = id;
    223         pr->callid = callid;
     223        pr->chandle = chandle;
    224224        list_append(&pr->link, &pending_wait);
    225225}
Note: See TracChangeset for help on using the changeset viewer.