Changeset 984a9ba in mainline for uspace/srv/ns/clonable.c


Ignore:
Timestamp:
2018-07-05T09:34:09Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63d46341
Parents:
76f566d
Message:

do not expose the call capability handler from the async framework

Keep the call capability handler encapsulated within the async framework
and do not expose it explicitly via its API. Use the pointer to
ipc_call_t as the sole object identifying an IPC call in the code that
uses the async framework.

This plugs a major leak in the abstraction and also simplifies both the
async framework (slightly) and all IPC servers.

File:
1 edited

Legend:

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

    r76f566d r984a9ba  
    4848        service_t service;
    4949        iface_t iface;
    50         cap_call_handle_t chandle;
    51         sysarg_t arg3;
     50        ipc_call_t call;
    5251} cs_req_t;
    5352
     
    7473 *
    7574 */
    76 void register_clonable(service_t service, sysarg_t phone, ipc_call_t *call,
    77     cap_call_handle_t chandle)
     75void register_clonable(service_t service, sysarg_t phone, ipc_call_t *call)
    7876{
    7977        link_t *req_link = list_first(&cs_req);
     
    8179                /* There was no pending connection request. */
    8280                printf("%s: Unexpected clonable server.\n", NAME);
    83                 async_answer_0(chandle, EBUSY);
     81                async_answer_0(call, EBUSY);
    8482                return;
    8583        }
     
    9189        assert(csr->service == SERVICE_LOADER);
    9290
    93         async_answer_0(chandle, EOK);
     91        async_answer_0(call, EOK);
    9492
    9593        async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
    9694        if (sess == NULL)
    97                 async_answer_0(chandle, EIO);
     95                async_answer_0(call, EIO);
    9896
    9997        async_exch_t *exch = async_exchange_begin(sess);
    100         async_forward_fast(csr->chandle, exch, csr->iface, csr->arg3, 0,
    101             IPC_FF_NONE);
     98        async_forward_fast(&csr->call, exch, csr->iface,
     99            IPC_GET_ARG3(csr->call), 0, IPC_FF_NONE);
    102100        async_exchange_end(exch);
    103101
     
    108106/** Connect client to clonable service.
    109107 *
    110  * @param service  Service to be connected to.
    111  * @param iface    Interface to be connected to.
    112  * @param call     Pointer to call structure.
    113  * @param chandle  Call handle of the request.
     108 * @param service Service to be connected to.
     109 * @param iface   Interface to be connected to.
     110 * @param call    Pointer to call structure.
    114111 *
    115112 * @return Zero on success or a value from @ref errno.h.
    116113 *
    117114 */
    118 void connect_to_clonable(service_t service, iface_t iface, ipc_call_t *call,
    119     cap_call_handle_t chandle)
     115void connect_to_clonable(service_t service, iface_t iface, ipc_call_t *call)
    120116{
    121117        assert(service == SERVICE_LOADER);
     
    123119        cs_req_t *csr = malloc(sizeof(cs_req_t));
    124120        if (csr == NULL) {
    125                 async_answer_0(chandle, ENOMEM);
     121                async_answer_0(call, ENOMEM);
    126122                return;
    127123        }
     
    132128        if (rc != EOK) {
    133129                free(csr);
    134                 async_answer_0(chandle, rc);
     130                async_answer_0(call, rc);
    135131                return;
    136132        }
     
    139135        csr->service = service;
    140136        csr->iface = iface;
    141         csr->chandle = chandle;
    142         csr->arg3 = IPC_GET_ARG3(*call);
     137        csr->call = *call;
    143138
    144139        /*
Note: See TracChangeset for help on using the changeset viewer.