summaryrefslogtreecommitdiffstats
path: root/src/resolve/resolved-bus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-04-22 12:30:16 +0200
committerLennart Poettering <lennart@poettering.net>2024-04-22 15:16:54 +0200
commit0ef0e2691a6ec17ed4ba78292e5767e07a61dd8d (patch)
tree42e6b7e5316e25da835a54c84a485f43bf5b732a /src/resolve/resolved-bus.c
parentresolved: rename DnssdService.filename field to .path (diff)
downloadsystemd-0ef0e2691a6ec17ed4ba78292e5767e07a61dd8d.tar.xz
systemd-0ef0e2691a6ec17ed4ba78292e5767e07a61dd8d.zip
resolved: rename DnssdService "name" field to "id"
"name" is a bit confusing since this field is *not* the DNS-SD service identifier, bust just some string derived from the .dnssd filename that is used as handle for the service. Let's hence give it a better name: "id". While we are at it, switch from basename() to path_extract_filename().
Diffstat (limited to 'src/resolve/resolved-bus.c')
-rw-r--r--src/resolve/resolved-bus.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/resolve/resolved-bus.c b/src/resolve/resolved-bus.c
index 986a90f9f2..080a4becce 100644
--- a/src/resolve/resolved-bus.c
+++ b/src/resolve/resolved-bus.c
@@ -1866,7 +1866,7 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
_cleanup_(sd_bus_creds_unrefp) sd_bus_creds *creds = NULL;
_cleanup_(dnssd_service_freep) DnssdService *service = NULL;
_cleanup_(sd_bus_track_unrefp) sd_bus_track *bus_track = NULL;
- const char *name, *name_template, *type;
+ const char *id, *name_template, *type;
_cleanup_free_ char *path = NULL;
DnssdService *s = NULL;
Manager *m = ASSERT_PTR(userdata);
@@ -1892,21 +1892,21 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
service->originator = euid;
service->config_source = RESOLVE_CONFIG_SOURCE_DBUS;
- r = sd_bus_message_read(message, "sssqqq", &name, &name_template, &type,
+ r = sd_bus_message_read(message, "sssqqq", &id, &name_template, &type,
&service->port, &service->priority,
&service->weight);
if (r < 0)
return r;
- s = hashmap_get(m->dnssd_services, name);
+ s = hashmap_get(m->dnssd_services, id);
if (s)
- return sd_bus_error_setf(error, BUS_ERROR_DNSSD_SERVICE_EXISTS, "DNS-SD service '%s' exists already", name);
+ return sd_bus_error_setf(error, BUS_ERROR_DNSSD_SERVICE_EXISTS, "DNS-SD service '%s' exists already", id);
if (!dnssd_srv_type_is_valid(type))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "DNS-SD service type '%s' is invalid", type);
- service->name = strdup(name);
- if (!service->name)
+ service->id = strdup(id);
+ if (!service->id)
return log_oom();
service->name_template = strdup(name_template);
@@ -1999,7 +1999,7 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
txt_data = NULL;
}
- r = sd_bus_path_encode("/org/freedesktop/resolve1/dnssd", service->name, &path);
+ r = sd_bus_path_encode("/org/freedesktop/resolve1/dnssd", service->id, &path);
if (r < 0)
return r;
@@ -2014,7 +2014,7 @@ static int bus_method_register_service(sd_bus_message *message, void *userdata,
if (r == 0)
return 1; /* Polkit will call us back */
- r = hashmap_ensure_put(&m->dnssd_services, &string_hash_ops, service->name, service);
+ r = hashmap_ensure_put(&m->dnssd_services, &string_hash_ops, service->id, service);
if (r < 0)
return r;
@@ -2178,7 +2178,7 @@ static const sd_bus_vtable resolve_vtable[] = {
bus_method_revert_link,
SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_METHOD_WITH_ARGS("RegisterService",
- SD_BUS_ARGS("s", name,
+ SD_BUS_ARGS("s", id,
"s", name_template,
"s", type,
"q", service_port,