Changeset 63a3276 in mainline for uspace/srv/locsrv/locsrv.c
- Timestamp:
- 2019-08-06T19:20:35Z (5 years ago)
- Children:
- 3f05ef7
- Parents:
- 72c8f77
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-06-17 23:02:03)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-06 19:20:35)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/locsrv/locsrv.c
r72c8f77 r63a3276 64 64 } cb_sess_t; 65 65 66 typedef enum { 67 NAME_TO_START, 68 NAME_TO_EXPOSE 69 } unit_name_t; 70 66 71 LIST_INITIALIZE(services_list); 67 72 LIST_INITIALIZE(namespaces_list); … … 335 340 } 336 341 337 static int loc_service_request_start(const char *ns_name, const char *name) 342 /** Derive unit name from service name according to purpose 343 * 344 * All services in 'device' namespace are considered to be drivers and 345 * devman is thus requested to start. Otherwise name of unit is made 346 * from fully qualified name of service (namespace separator is changed 347 * for usage in unit name. 348 */ 349 static int loc_service_unit_name(const char *ns_name, const char *name, 350 unit_name_t name_type, char **unit_name_ptr) 338 351 { 339 352 char *service_name = NULL; 340 341 /* 342 * All services in 'device' namespace are considered to be drivers and 343 * devman is thus requested to start. Otherwise name of unit is made 344 * from fully qualified name of service (namespace separator is changed 345 * for usage in unit name. 346 */ 347 if (str_cmp(ns_name, LOC_DEVICE_NAMESPACE) == 0) { 353 if (name_type == NAME_TO_START && 354 str_cmp(ns_name, LOC_DEVICE_NAMESPACE) == 0) { 348 355 asprintf(&service_name, "%s", SERVICE_NAME_DEVMAN); 349 356 } else if (str_cmp(ns_name, "") == 0) { … … 365 372 } 366 373 367 int rc = sysman_unit_start(unit_name, IPC_FLAG_BLOCKING); 374 *unit_name_ptr = unit_name; 375 return EOK; 376 } 377 378 static int loc_service_request_start(const char *ns_name, const char *name) 379 { 380 char *unit_name; 381 int rc = loc_service_unit_name(ns_name, name, NAME_TO_START, &unit_name); 382 if (rc != EOK) { 383 return rc; 384 } 385 386 rc = sysman_unit_start(unit_name, IPC_FLAG_BLOCKING); 368 387 free(unit_name); 369 free(service_name);370 388 return rc; 371 389 } … … 555 573 return; 556 574 } 575 576 /* Notify sysman about new exposee */ 577 char *unit_name = NULL; 578 rc = loc_service_unit_name(namespace->name, service->name, 579 NAME_TO_EXPOSE, &unit_name); 580 if (rc != EOK) { 581 loc_namespace_destroy(namespace); 582 fibril_mutex_unlock(&services_list_mutex); 583 free(service->name); 584 free(service); 585 free(unit_name); 586 async_answer_0(iid, rc); 587 return; 588 } 589 590 if (str_cmp(namespace->name, LOC_DEVICE_NAMESPACE) == 0) { 591 sysman_exposee_added(unit_name); 592 } else { 593 sysman_main_exposee_added(unit_name, icall->in_task_id); 594 } 595 free(unit_name); 557 596 558 597 /* Get unique service ID */ … … 837 876 } 838 877 839 if ( flags & IPC_FLAG_BLOCKING) {878 if ((flags & IPC_FLAG_BLOCKING) || flags & IPC_FLAG_AUTOSTART) { 840 879 fibril_condvar_wait(&services_list_cv, 841 880 &services_list_mutex);
Note:
See TracChangeset
for help on using the changeset viewer.