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


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

    r6a0b2cc r4c6fd56  
    11/*
     2 * Copyright (c) 2023 Jiri Svoboda
    23 * Copyright (c) 2012 Vojtech Horky
    34 * All rights reserved.
     
    110111};
    111112
     113static loc_srv_t *remcons_srv;
     114
    112115static telnet_user_t *srv_to_user(con_srv_t *srv)
    113116{
     
    301304        telnet_user_add(user);
    302305
    303         errno_t rc = loc_service_register(user->service_name, &user->service_id);
     306        errno_t rc = loc_service_register(remcons_srv, user->service_name,
     307            &user->service_id);
    304308        if (rc != EOK) {
    305309                telnet_user_error(user, "Unable to register %s with loc: %s.",
     
    332336        fibril_mutex_unlock(&user->guard);
    333337
    334         rc = loc_service_unregister(user->service_id);
     338        rc = loc_service_unregister(remcons_srv, user->service_id);
    335339        if (rc != EOK) {
    336340                telnet_user_error(user,
     
    351355
    352356        async_set_fallback_port_handler(client_connection, NULL);
    353         rc = loc_server_register(NAME);
     357        rc = loc_server_register(NAME, &remcons_srv);
    354358        if (rc != EOK) {
    355359                fprintf(stderr, "%s: Unable to register server\n", NAME);
Note: See TracChangeset for help on using the changeset viewer.