Changeset 9b1baac in mainline for uspace/srv/ns/ns.c


Ignore:
Timestamp:
2018-07-18T08:35:42Z (7 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0b05082
Parents:
edc64c0
Message:

ns: register service interfaces individually

Each service interface is now registered individually with the naming
service. This adds a degree of type safety, potentially allows the
individual interfaces to be implemented by independent tasks and moves
the code slightly closer to the full-fledged ports design.

Broker services (e.g. the location service) can still register a
fallback port for receiving connections to all interface types
explicitly using service_register_broker().

File:
1 edited

Legend:

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

    redc64c0 r9b1baac  
    6161                 * Client requests to be connected to a service.
    6262                 */
    63                 if (service_clonable(service)) {
    64                         connect_to_clonable(service, iface, icall);
     63                if (ns_service_is_clonable(service, iface)) {
     64                        ns_clonable_forward(service, iface, icall);
    6565                } else {
    66                         connect_to_service(service, iface, icall);
     66                        ns_service_forward(service, iface, icall);
    6767                }
     68
    6869                return;
    6970        }
     
    7273
    7374        while (true) {
    74                 process_pending_conn();
     75                ns_pending_conn_process();
    7576
    7677                async_get_call(&call);
     
    8283
    8384                service_t service;
    84                 sysarg_t phone;
    8585
    8686                switch (IPC_GET_IMETHOD(call)) {
    8787                case NS_REGISTER:
    8888                        service = IPC_GET_ARG1(call);
    89                         phone = IPC_GET_ARG5(call);
     89                        iface = IPC_GET_ARG2(call);
    9090
    9191                        /*
    9292                         * Server requests service registration.
    9393                         */
    94                         if (service_clonable(service)) {
    95                                 register_clonable(service, phone, &call);
     94                        if (ns_service_is_clonable(service, iface)) {
     95                                ns_clonable_register(&call);
    9696                                continue;
    9797                        } else {
    98                                 retval = register_service(service, phone, &call);
     98                                retval = ns_service_register(service, iface);
    9999                        }
    100100
     101                        break;
     102                case NS_REGISTER_BROKER:
     103                        service = IPC_GET_ARG1(call);
     104                        retval = ns_service_register_broker(service);
    101105                        break;
    102106                case NS_PING:
     
    115119                        break;
    116120                default:
    117                         printf("ns: method not supported\n");
     121                        printf("%s: Method not supported (%" PRIun ")\n",
     122                            NAME, IPC_GET_IMETHOD(call));
    118123                        retval = ENOTSUP;
    119124                        break;
     
    130135        printf("%s: HelenOS IPC Naming Service\n", NAME);
    131136
    132         errno_t rc = service_init();
     137        errno_t rc = ns_service_init();
    133138        if (rc != EOK)
    134139                return rc;
    135140
    136         rc = clonable_init();
     141        rc = ns_clonable_init();
    137142        if (rc != EOK)
    138143                return rc;
Note: See TracChangeset for help on using the changeset viewer.