Changeset 4c6fd56 in mainline for uspace/srv/net/ethip/ethip.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/net/ethip/ethip.c

    r6a0b2cc r4c6fd56  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    7878};
    7979
     80static loc_srv_t *ethip_srv;
     81
    8082static errno_t ethip_init(void)
    8183{
    8284        async_set_fallback_port_handler(ethip_client_conn, NULL);
    8385
    84         errno_t rc = loc_server_register(NAME);
     86        errno_t rc = loc_server_register(NAME, &ethip_srv);
    8587        if (rc != EOK) {
    8688                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering server.");
     
    115117        }
    116118
    117         rc = loc_service_register(svc_name, &sid);
     119        rc = loc_service_register(ethip_srv, svc_name, &sid);
    118120        if (rc != EOK) {
    119121                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed registering service %s.", svc_name);
     
    129131        }
    130132
    131         rc = loc_service_add_to_cat(sid, iplink_cat);
     133        rc = loc_service_add_to_cat(ethip_srv, sid, iplink_cat);
    132134        if (rc != EOK) {
    133135                log_msg(LOG_DEFAULT, LVL_ERROR, "Failed adding %s to category.", svc_name);
Note: See TracChangeset for help on using the changeset viewer.