Changeset 0dd16778 in mainline


Ignore:
Timestamp:
2015-08-22T14:32:11Z (9 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f9b2cb4c
Parents:
78bb04b
Message:

start migrating devman to interfaces

Files:
11 edited

Legend:

Unmodified
Added
Removed
  • abi/include/abi/ipc/interfaces.h

    r78bb04b r0dd16778  
    8181        INTERFACE_LOADER =
    8282            FOURCC_COMPACT('l', 'o', 'a', 'd') | IFACE_EXCHANGE_PARALLEL,
     83        INTERFACE_DDF_CLIENT =
     84            FOURCC_COMPACT('d', 'd', 'f', 'c') | IFACE_EXCHANGE_SERIALIZE,
    8385        INTERFACE_TCP_CB =
    8486            FOURCC_COMPACT('t', 'c', 'p', ' ') | IFACE_EXCHANGE_SERIALIZE | IFACE_MOD_CALLBACK,
  • uspace/app/barber/barber.c

    r78bb04b r0dd16778  
    267267                        link_initialize(&dev->link);
    268268                        dev->svc_id = svcs[i];
    269                         dev->sess = loc_service_connect(EXCHANGE_SERIALIZE, svcs[i], 0);
     269                        dev->sess = loc_service_connect_iface(svcs[i], INTERFACE_DDF_CLIENT, 0);
    270270                       
    271271                        list_append(&dev->link, &led_devs);
  • uspace/lib/c/generic/async.c

    r78bb04b r0dd16778  
    22722272        sess->phone = phone;
    22732273        sess->arg1 = arg1;
     2274        sess->arg2 = arg2;
     2275        sess->arg3 = arg3;
     2276       
     2277        fibril_mutex_initialize(&sess->remote_state_mtx);
     2278        sess->remote_state_data = NULL;
     2279       
     2280        list_initialize(&sess->exch_list);
     2281        fibril_mutex_initialize(&sess->mutex);
     2282        atomic_set(&sess->refcnt, 0);
     2283       
     2284        return sess;
     2285}
     2286
     2287/** Wrapper for making IPC_M_CONNECT_ME_TO calls using the async framework.
     2288 *
     2289 * Ask through phone for a new connection to some service and block until
     2290 * success.
     2291 *
     2292 * @param exch  Exchange for sending the message.
     2293 * @param iface Connection interface.
     2294 * @param arg2  User defined argument.
     2295 * @param arg3  User defined argument.
     2296 *
     2297 * @return New session on success or NULL on error.
     2298 *
     2299 */
     2300async_sess_t *async_connect_me_to_iface(async_exch_t *exch, iface_t iface,
     2301    sysarg_t arg2, sysarg_t arg3)
     2302{
     2303        if (exch == NULL) {
     2304                errno = ENOENT;
     2305                return NULL;
     2306        }
     2307       
     2308        async_sess_t *sess = (async_sess_t *) malloc(sizeof(async_sess_t));
     2309        if (sess == NULL) {
     2310                errno = ENOMEM;
     2311                return NULL;
     2312        }
     2313       
     2314        int phone = async_connect_me_to_internal(exch->phone, iface, arg2,
     2315            arg3, 0);
     2316        if (phone < 0) {
     2317                errno = phone;
     2318                free(sess);
     2319                return NULL;
     2320        }
     2321       
     2322        sess->iface = iface;
     2323        sess->phone = phone;
     2324        sess->arg1 = iface;
    22742325        sess->arg2 = arg2;
    22752326        sess->arg3 = arg3;
  • uspace/lib/c/generic/loc.c

    r78bb04b r0dd16778  
    569569}
    570570
     571async_sess_t *loc_service_connect_iface(service_id_t handle, iface_t iface,
     572    unsigned int flags)
     573{
     574        async_sess_t *sess;
     575       
     576        if (flags & IPC_FLAG_BLOCKING)
     577                sess = service_connect_blocking_iface_extended(SERVICE_LOC, iface, handle);
     578        else
     579                sess = service_connect_iface_extended(SERVICE_LOC, iface, handle);
     580       
     581        return sess;
     582}
     583
    571584async_sess_t *loc_service_connect(exch_mgmt_t mgmt, service_id_t handle,
    572585    unsigned int flags)
  • uspace/lib/c/generic/ns.c

    r78bb04b r0dd16778  
    5858        async_sess_t *sess =
    5959            async_connect_me_to(mgmt, exch, iface, service, arg3);
     60        async_exchange_end(exch);
     61       
     62        if (!sess)
     63                return NULL;
     64       
     65        /*
     66         * FIXME Ugly hack to work around limitation of implementing
     67         * parallel exchanges using multiple connections. Shift out
     68         * first argument for non-initial connections.
     69         */
     70        async_sess_args_set(sess, iface, arg3, 0);
     71       
     72        return sess;
     73}
     74
     75async_sess_t *service_connect_iface_extended(service_t service, iface_t iface,
     76    sysarg_t arg3)
     77{
     78        async_exch_t *exch = async_exchange_begin(session_ns);
     79        if (!exch)
     80                return NULL;
     81       
     82        async_sess_t *sess =
     83            async_connect_me_to_iface(exch, iface, service, arg3);
    6084        async_exchange_end(exch);
    6185       
  • uspace/lib/c/include/async.h

    r78bb04b r0dd16778  
    350350extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
    351351    sysarg_t, sysarg_t);
     352extern async_sess_t *async_connect_me_to_iface(async_exch_t *, iface_t,
     353    sysarg_t, sysarg_t);
    352354extern async_sess_t *async_connect_me_to_blocking(exch_mgmt_t, async_exch_t *,
    353355    sysarg_t, sysarg_t, sysarg_t);
  • uspace/lib/c/include/ipc/devman.h

    r78bb04b r0dd16778  
    144144        DEVMAN_CLIENT,
    145145        DEVMAN_CONNECT_TO_DEVICE,
    146         DEVMAN_CONNECT_FROM_LOC,
    147146        DEVMAN_CONNECT_TO_PARENTS_DEVICE
    148147} devman_interface_t;
  • uspace/lib/c/include/loc.h

    r78bb04b r0dd16778  
    6565extern loc_object_type_t loc_id_probe(service_id_t);
    6666
     67extern async_sess_t *loc_service_connect_iface(service_id_t, iface_t,
     68    unsigned int);
    6769extern async_sess_t *loc_service_connect(exch_mgmt_t, service_id_t,
    6870    unsigned int);
  • uspace/lib/c/include/ns.h

    r78bb04b r0dd16778  
    4343extern int service_register(service_t);
    4444extern async_sess_t *service_connect(exch_mgmt_t, service_t, sysarg_t);
     45extern async_sess_t *service_connect_iface_extended(service_t, iface_t, sysarg_t);
    4546extern async_sess_t *service_connect_iface(exch_mgmt_t, sysarg_t, service_t, sysarg_t);
    4647extern async_sess_t *service_connect_blocking(exch_mgmt_t, service_t, sysarg_t);
  • uspace/srv/devman/loc.c

    r78bb04b r0dd16778  
    6060       
    6161        loc_service_register_with_iface(loc_pathname,
    62             &fun->service_id, DEVMAN_CONNECT_FROM_LOC);
     62            &fun->service_id, INTERFACE_DDF_CLIENT);
    6363       
    6464        tree_add_loc_function(tree, fun);
  • uspace/srv/devman/main.c

    r78bb04b r0dd16778  
    221221                devman_forward(iid, icall, false);
    222222                break;
    223         case DEVMAN_CONNECT_FROM_LOC:
     223        case INTERFACE_DDF_CLIENT:
    224224                /* Someone connected through loc node. */
    225225                devman_connection_loc(iid, icall);
Note: See TracChangeset for help on using the changeset viewer.