From: Mike Yuan Date: Fri, 24 May 2024 14:27:52 +0000 (+0800) Subject: core/unit: drop pointless unit_freezer_state wrapper X-Git-Tag: v257-rc1~888^2~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2f81f8d40c3e7d99c61e4642040ce4da562b7ac;p=thirdparty%2Fsystemd.git core/unit: drop pointless unit_freezer_state wrapper --- diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 0161a1bf458..a9ae81aed50 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -34,9 +34,9 @@ static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_collect_mode, collect_mode, CollectMode); static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_load_state, unit_load_state, UnitLoadState); static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_job_mode, job_mode, JobMode); +static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_freezer_state, freezer_state, FreezerState); static BUS_DEFINE_PROPERTY_GET(property_get_description, "s", Unit, unit_description); static BUS_DEFINE_PROPERTY_GET2(property_get_active_state, "s", Unit, unit_active_state, unit_active_state_to_string); -static BUS_DEFINE_PROPERTY_GET2(property_get_freezer_state, "s", Unit, unit_freezer_state, freezer_state_to_string); static BUS_DEFINE_PROPERTY_GET(property_get_sub_state, "s", Unit, unit_sub_state_to_string); static BUS_DEFINE_PROPERTY_GET2(property_get_unit_file_state, "s", Unit, unit_get_unit_file_state, unit_file_state_to_string); static BUS_DEFINE_PROPERTY_GET(property_get_can_reload, "b", Unit, unit_can_reload); @@ -864,7 +864,7 @@ const sd_bus_vtable bus_unit_vtable[] = { SD_BUS_PROPERTY("AccessSELinuxContext", "s", NULL, offsetof(Unit, access_selinux_context), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("LoadState", "s", property_get_load_state, offsetof(Unit, load_state), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("ActiveState", "s", property_get_active_state, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), - SD_BUS_PROPERTY("FreezerState", "s", property_get_freezer_state, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("FreezerState", "s", property_get_freezer_state, offsetof(Unit, freezer_state), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("SubState", "s", property_get_sub_state, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("FragmentPath", "s", NULL, offsetof(Unit, fragment_path), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("SourcePath", "s", NULL, offsetof(Unit, source_path), SD_BUS_VTABLE_PROPERTY_CONST), diff --git a/src/core/unit-serialize.c b/src/core/unit-serialize.c index 175e327d925..8baa30f9e5f 100644 --- a/src/core/unit-serialize.c +++ b/src/core/unit-serialize.c @@ -117,7 +117,8 @@ int unit_serialize_state(Unit *u, FILE *f, FDSet *fds, bool switching_root) { if (!sd_id128_is_null(u->invocation_id)) (void) serialize_item_format(f, "invocation-id", SD_ID128_FORMAT_STR, SD_ID128_FORMAT_VAL(u->invocation_id)); - (void) serialize_item_format(f, "freezer-state", "%s", freezer_state_to_string(unit_freezer_state(u))); + (void) serialize_item(f, "freezer-state", freezer_state_to_string(u->freezer_state)); + (void) serialize_markers(f, u->markers); bus_track_serialize(u->bus_track, f, "ref"); diff --git a/src/core/unit.c b/src/core/unit.c index 8ac0aad2d75..8cdb3a025f8 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -864,12 +864,6 @@ Unit* unit_free(Unit *u) { return mfree(u); } -FreezerState unit_freezer_state(Unit *u) { - assert(u); - - return u->freezer_state; -} - UnitActiveState unit_active_state(Unit *u) { assert(u); diff --git a/src/core/unit.h b/src/core/unit.h index 042ec3b3ea4..c961edef5fb 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -849,7 +849,6 @@ const char* unit_status_string(Unit *u, char **combined); bool unit_has_name(const Unit *u, const char *name); UnitActiveState unit_active_state(Unit *u); -FreezerState unit_freezer_state(Unit *u); const char* unit_sub_state_to_string(Unit *u);