Changeset d7427a7e in mainline for uspace/srv/loc/loc.c


Ignore:
Timestamp:
2011-08-18T20:27:02Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
be79a663
Parents:
0cc32f2 (diff), ef7052ec (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r0cc32f2 rd7427a7e  
    6767 **/
    6868
    69 static FIBRIL_MUTEX_INITIALIZE(services_list_mutex);
     69FIBRIL_MUTEX_INITIALIZE(services_list_mutex);
    7070static FIBRIL_CONDVAR_INITIALIZE(services_list_cv);
    7171static FIBRIL_MUTEX_INITIALIZE(servers_list_mutex);
     
    311311{
    312312        assert(fibril_mutex_is_locked(&services_list_mutex));
    313 
     313        assert(fibril_mutex_is_locked(&cdir.mutex));
     314       
    314315        loc_namespace_delref(service->namespace);
    315316        list_remove(&(service->services));
    316317        list_remove(&(service->server_services));
     318       
     319        /* Remove service from all categories. */
     320        while (!list_empty(&service->cat_memb)) {
     321                link_t *link = list_first(&service->cat_memb);
     322                svc_categ_t *memb = list_get_instance(link, svc_categ_t,
     323                    svc_link);
     324                fibril_mutex_lock(&memb->cat->mutex);
     325                category_remove_service(memb);
     326                fibril_mutex_unlock(&memb->cat->mutex);
     327        }
    317328       
    318329        free(service->name);
     
    415426        fibril_mutex_lock(&services_list_mutex);
    416427        fibril_mutex_lock(&server->services_mutex);
     428        fibril_mutex_lock(&cdir.mutex);
    417429       
    418430        while (!list_empty(&server->services)) {
     
    423435        }
    424436       
     437        fibril_mutex_unlock(&cdir.mutex);
    425438        fibril_mutex_unlock(&server->services_mutex);
    426439        fibril_mutex_unlock(&services_list_mutex);
     
    492505        link_initialize(&service->services);
    493506        link_initialize(&service->server_services);
     507        list_initialize(&service->cat_memb);
    494508       
    495509        /* Check that service is not already registered */
     
    529543 *
    530544 */
    531 static int loc_service_unregister(ipc_callid_t iid, ipc_call_t *icall,
     545static void loc_service_unregister(ipc_callid_t iid, ipc_call_t *icall,
    532546    loc_server_t *server)
    533547{
    534         /* TODO */
    535         return EOK;
     548        loc_service_t *svc;
     549       
     550        fibril_mutex_lock(&services_list_mutex);
     551        svc = loc_service_find_id(IPC_GET_ARG1(*icall));
     552        if (svc == NULL) {
     553                fibril_mutex_unlock(&services_list_mutex);
     554                async_answer_0(iid, ENOENT);
     555                return;
     556        }
     557       
     558        fibril_mutex_lock(&cdir.mutex);
     559        loc_service_unregister_core(svc);
     560        fibril_mutex_unlock(&cdir.mutex);
     561        fibril_mutex_unlock(&services_list_mutex);
     562        async_answer_0(iid, EOK);
    536563}
    537564
     
    11761203       
    11771204        fibril_mutex_lock(&services_list_mutex);
     1205        fibril_mutex_lock(&cdir.mutex);
    11781206        loc_service_unregister_core(null_services[i]);
     1207        fibril_mutex_unlock(&cdir.mutex);
    11791208        fibril_mutex_unlock(&services_list_mutex);
    11801209       
     
    12421271
    12431272        cat = category_new("usbhc");
     1273        categ_dir_add_cat(&cdir, cat);
     1274
     1275        cat = category_new("virtual");
    12441276        categ_dir_add_cat(&cdir, cat);
    12451277
Note: See TracChangeset for help on using the changeset viewer.