From: Mike Yuan Date: Sun, 16 Jun 2024 16:40:39 +0000 (+0200) Subject: core/service: drop unused bus_name_owner X-Git-Tag: v257-rc1~1131^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=029df9ed7a5ab39109d7d497c171b58e71faee77;p=thirdparty%2Fsystemd.git core/service: drop unused bus_name_owner Follow-up for fc67a943d989d5e74577adea9676cdc7928b08fc After the mentioned comment, we no longer need to record the owner to restore the previous bus owner state. Therefore, bus_name_owner is effectively unused. Kill it. --- diff --git a/src/core/service.c b/src/core/service.c index ac873580950..f48ebc0bf8a 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -489,8 +489,6 @@ static void service_done(Unit *u) { s->bus_name = mfree(s->bus_name); } - s->bus_name_owner = mfree(s->bus_name_owner); - s->usb_function_descriptors = mfree(s->usb_function_descriptors); s->usb_function_strings = mfree(s->usb_function_strings); @@ -2967,7 +2965,6 @@ static int service_serialize(Unit *u, FILE *f, FDSet *fds) { (void) serialize_bool(f, "main-pid-known", s->main_pid_known); (void) serialize_bool(f, "bus-name-good", s->bus_name_good); - (void) serialize_bool(f, "bus-name-owner", s->bus_name_owner); (void) serialize_item_format(f, "n-restarts", "%u", s->n_restarts); (void) serialize_bool(f, "flush-n-restarts", s->flush_n_restarts); @@ -3221,11 +3218,6 @@ static int service_deserialize_item(Unit *u, const char *key, const char *value, log_unit_debug(u, "Failed to parse bus-name-good value: %s", value); else s->bus_name_good = b; - } else if (streq(key, "bus-name-owner")) { - r = free_and_strdup(&s->bus_name_owner, value); - if (r < 0) - log_unit_error_errno(u, r, "Unable to deserialize current bus owner %s: %m", value); - } else if (streq(key, "accept-socket")) { Unit *socket; @@ -4708,17 +4700,8 @@ static void service_bus_name_owner_change(Unit *u, const char *new_owner) { s->bus_name_good = new_owner; - /* Track the current owner, so we can reconstruct changes after a daemon reload */ - r = free_and_strdup(&s->bus_name_owner, new_owner); - if (r < 0) { - log_unit_error_errno(u, r, "Unable to set new bus name owner %s: %m", new_owner); - return; - } - if (s->type == SERVICE_DBUS) { - - /* service_enter_running() will figure out what to - * do */ + /* service_enter_running() will figure out what to do */ if (s->state == SERVICE_RUNNING) service_enter_running(s, SERVICE_SUCCESS); else if (s->state == SERVICE_START && new_owner) diff --git a/src/core/service.h b/src/core/service.h index 59598f77de6..55ea413f40a 100644 --- a/src/core/service.h +++ b/src/core/service.h @@ -196,7 +196,6 @@ struct Service { bool exec_fd_hot:1; char *bus_name; - char *bus_name_owner; /* unique name of the current owner */ char *status_text; int status_errno;