Changeset 4c6fd56 in mainline for uspace/srv/hid/console/console.c


Ignore:
Timestamp:
2023-09-16T19:58:18Z (20 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/console/console.c

    r6a0b2cc r4c6fd56  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * Copyright (c) 2011 Martin Decky
    44 * All rights reserved.
     
    8989} console_t;
    9090
     91static loc_srv_t *console_srv;
     92
    9193/** Input server proxy */
    9294static input_t *input;
     
    902904        /* Register server */
    903905        async_set_fallback_port_handler(client_connection, NULL);
    904         rc = loc_server_register(NAME);
     906        rc = loc_server_register(NAME, &console_srv);
    905907        if (rc != EOK) {
    906908                printf("%s: Unable to register server (%s)\n", NAME,
     
    952954                        snprintf(vc, LOC_NAME_MAXLEN, "%s/vc%zu", NAMESPACE, i);
    953955
    954                         if (loc_service_register(vc, &consoles[i].dsid) != EOK) {
     956                        if (loc_service_register(console_srv, vc,
     957                            &consoles[i].dsid) != EOK) {
    955958                                printf("%s: Unable to register device %s\n", NAME, vc);
    956959                                return false;
Note: See TracChangeset for help on using the changeset viewer.