Changeset 4c6fd56 in mainline for uspace/srv/devman


Ignore:
Timestamp:
2023-09-16T19:58:18Z (22 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7d7f5e3
Parents:
6a0b2cc
git-author:
Jiri Svoboda <jiri@…> (2023-09-16 19:48:07)
git-committer:
Jiri Svoboda <jiri@…> (2023-09-16 19:58:18)
Message:

loc_server_register() should be callable more than once (API only)

Now loc_server_register() returns a pointer to a loc_srv_t object,
that is then passed to loc_service_register() and
loc_service_add_to_cat().

Added loc_server_unregister() that unregisters the server
and frees the loc_srv_t object.

Updated all callers. The implementation, however, is a stub.
It is not actually possible to call loc_server_register() more
than once, yet.

Location:
uspace/srv/devman
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/drv_conn.c

    r6a0b2cc r4c6fd56  
    11/*
     2 * Copyright (c) 2023 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    34 * All rights reserved.
     
    360361        rc = loc_category_get_id(cat_name, &cat_id, IPC_FLAG_BLOCKING);
    361362        if (rc == EOK)
    362                 rc = loc_service_add_to_cat(fun->service_id, cat_id);
     363                rc = loc_service_add_to_cat(devman_srv, fun->service_id, cat_id);
    363364        if (rc == EOK) {
    364365                log_msg(LOG_DEFAULT, LVL_NOTE, "Function `%s' added to category `%s'.",
  • uspace/srv/devman/loc.c

    r6a0b2cc r4c6fd56  
    11/*
     2 * Copyright (c) 2023 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    34 * All rights reserved.
     
    3738#include "fun.h"
    3839#include "loc.h"
     40#include "main.h"
    3941
    4042/** Create loc path and name for the function. */
     
    5961        }
    6062
    61         loc_service_register(loc_pathname, &fun->service_id);
     63        loc_service_register(devman_srv, loc_pathname, &fun->service_id);
    6264
    6365        tree_add_loc_function(tree, fun);
     
    6971errno_t loc_unregister_tree_function(fun_node_t *fun, dev_tree_t *tree)
    7072{
    71         errno_t rc = loc_service_unregister(fun->service_id);
     73        errno_t rc = loc_service_unregister(devman_srv, fun->service_id);
    7274        tree_rem_loc_function(tree, fun);
    7375        return rc;
  • uspace/srv/devman/main.c

    r6a0b2cc r4c6fd56  
    11/*
     2 * Copyright (c) 2023 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    34 * All rights reserved.
     
    6465driver_list_t drivers_list;
    6566dev_tree_t device_tree;
     67loc_srv_t *devman_srv;
    6668
    6769static void devman_connection_device(ipc_call_t *icall, void *arg)
     
    280282static bool devman_init(void)
    281283{
     284        errno_t rc;
     285
    282286        log_msg(LOG_DEFAULT, LVL_DEBUG, "devman_init - looking for available drivers.");
    283287
     
    305309         * not work.
    306310         */
    307         loc_server_register(NAME);
     311        rc = loc_server_register(NAME, &devman_srv);
     312        if (rc != EOK) {
     313                log_msg(LOG_DEFAULT, LVL_FATAL, "Error registering devman server.");
     314                return false;
     315        }
    308316
    309317        return true;
  • uspace/srv/devman/main.h

    r6a0b2cc r4c6fd56  
    11/*
    2  * Copyright (c) 2013 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3434#define MAIN_H_
    3535
     36#include <loc.h>
    3637#include "devman.h"
    3738
    3839extern driver_list_t drivers_list;
    3940extern dev_tree_t device_tree;
     41extern loc_srv_t *devman_srv;
    4042
    4143#endif
Note: See TracChangeset for help on using the changeset viewer.