Changeset 4c53333 in mainline for uspace/srv/locsrv/locsrv.c


Ignore:
Timestamp:
2013-07-11T08:21:10Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
64e63ce1
Parents:
80445cf (diff), c8bb1633 (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 moved

Legend:

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

    r80445cf r4c53333  
    4242#include <stdio.h>
    4343#include <errno.h>
    44 #include <bool.h>
     44#include <stdbool.h>
    4545#include <fibril_synch.h>
    4646#include <macros.h>
     
    5151
    5252#include "category.h"
    53 #include "loc.h"
     53#include "locsrv.h"
    5454
    5555#define NAME          "loc"
     
    390390         */
    391391        list_initialize(&server->services);
    392 
    393392        link_initialize(&server->servers);
    394393       
     
    651650            min(size, act_size));
    652651        free(fqn);
     652       
     653        fibril_mutex_unlock(&services_list_mutex);
     654       
     655        async_answer_0(iid, retval);
     656}
     657
     658static void loc_service_get_server_name(ipc_callid_t iid, ipc_call_t *icall)
     659{
     660        ipc_callid_t callid;
     661        size_t size;
     662        size_t act_size;
     663        loc_service_t *svc;
     664       
     665        if (!async_data_read_receive(&callid, &size)) {
     666                async_answer_0(callid, EREFUSED);
     667                async_answer_0(iid, EREFUSED);
     668                return;
     669        }
     670       
     671        fibril_mutex_lock(&services_list_mutex);
     672       
     673        svc = loc_service_find_id(IPC_GET_ARG1(*icall));
     674        if (svc == NULL) {
     675                fibril_mutex_unlock(&services_list_mutex);
     676                async_answer_0(callid, ENOENT);
     677                async_answer_0(iid, ENOENT);
     678                return;
     679        }
     680       
     681        if (svc->server == NULL) {
     682                fibril_mutex_unlock(&services_list_mutex);
     683                async_answer_0(callid, EINVAL);
     684                async_answer_0(iid, EINVAL);
     685                return;
     686        }
     687       
     688        act_size = str_size(svc->server->name);
     689        if (act_size > size) {
     690                fibril_mutex_unlock(&services_list_mutex);
     691                async_answer_0(callid, EOVERFLOW);
     692                async_answer_0(iid, EOVERFLOW);
     693                return;
     694        }
     695       
     696        sysarg_t retval = async_data_read_finalize(callid, svc->server->name,
     697            min(size, act_size));
    653698       
    654699        fibril_mutex_unlock(&services_list_mutex);
     
    13081353        categ_dir_add_cat(&cdir, cat);
    13091354
     1355        cat = category_new("clock");
     1356        categ_dir_add_cat(&cdir, cat);
     1357
    13101358        cat = category_new("test3");
    13111359        categ_dir_add_cat(&cdir, cat);
     
    13211369       
    13221370        cat = category_new("nic");
     1371        categ_dir_add_cat(&cdir, cat);
     1372
     1373        cat = category_new("visualizer");
     1374        categ_dir_add_cat(&cdir, cat);
     1375
     1376        cat = category_new("renderer");
    13231377        categ_dir_add_cat(&cdir, cat);
    13241378       
     
    14051459                case LOC_SERVICE_GET_NAME:
    14061460                        loc_service_get_name(callid, &call);
     1461                        break;
     1462                case LOC_SERVICE_GET_SERVER_NAME:
     1463                        loc_service_get_server_name(callid, &call);
    14071464                        break;
    14081465                case LOC_NAMESPACE_GET_ID:
     
    14901547       
    14911548        /* Register location service at naming service */
    1492         if (service_register(SERVICE_LOC) != EOK)
    1493                 return -1;
     1549        int rc = service_register(SERVICE_LOC);
     1550        if (rc != EOK)
     1551                return rc;
    14941552       
    14951553        printf("%s: Accepting connections\n", NAME);
Note: See TracChangeset for help on using the changeset viewer.