Changeset 9b1baac in mainline for uspace/srv/devman/main.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/devman/main.c

    redc64c0 r9b1baac  
    325325        async_set_client_data_destructor(devman_client_data_destroy);
    326326
    327         port_id_t port;
    328         rc = async_create_port(INTERFACE_DDF_DRIVER,
    329             devman_connection_driver, NULL, &port);
    330         if (rc != EOK) {
    331                 printf("%s: Error creating DDF driver port: %s\n", NAME, str_error(rc));
    332                 return rc;
    333         }
    334 
    335         rc = async_create_port(INTERFACE_DDF_CLIENT,
    336             devman_connection_client, NULL, &port);
    337         if (rc != EOK) {
    338                 printf("%s: Error creating DDF client port: %s\n", NAME, str_error(rc));
    339                 return rc;
    340         }
    341 
    342         rc = async_create_port(INTERFACE_DEVMAN_DEVICE,
    343             devman_connection_device, NULL, &port);
    344         if (rc != EOK) {
    345                 printf("%s: Error creating devman device port: %s\n", NAME, str_error(rc));
    346                 return rc;
    347         }
    348 
    349         rc = async_create_port(INTERFACE_DEVMAN_PARENT,
    350             devman_connection_parent, NULL, &port);
    351         if (rc != EOK) {
    352                 printf("%s: Error creating devman parent port: %s\n", NAME, str_error(rc));
    353                 return rc;
    354         }
    355 
    356327        async_set_fallback_port_handler(devman_forward, NULL);
    357328
     
    362333
    363334        /* Register device manager at naming service. */
    364         rc = service_register(SERVICE_DEVMAN);
    365         if (rc != EOK) {
    366                 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering as a service: %s", str_error(rc));
     335        rc = service_register(SERVICE_DEVMAN, INTERFACE_DDF_DRIVER,
     336            devman_connection_driver, NULL);
     337        if (rc != EOK) {
     338                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering driver port: %s", str_error(rc));
     339                return rc;
     340        }
     341
     342        rc = service_register(SERVICE_DEVMAN, INTERFACE_DDF_CLIENT,
     343            devman_connection_client, NULL);
     344        if (rc != EOK) {
     345                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering client port: %s", str_error(rc));
     346                return rc;
     347        }
     348
     349        rc = service_register(SERVICE_DEVMAN, INTERFACE_DEVMAN_DEVICE,
     350            devman_connection_device, NULL);
     351        if (rc != EOK) {
     352                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering device port: %s", str_error(rc));
     353                return rc;
     354        }
     355
     356        rc = service_register(SERVICE_DEVMAN, INTERFACE_DEVMAN_PARENT,
     357            devman_connection_parent, NULL);
     358        if (rc != EOK) {
     359                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering parent port: %s", str_error(rc));
    367360                return rc;
    368361        }
Note: See TracChangeset for help on using the changeset viewer.