diff options
author | Mike Yuan <me@yhndnzj.com> | 2024-05-24 16:27:52 +0200 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2024-07-17 17:25:22 +0200 |
commit | e2f81f8d40c3e7d99c61e4642040ce4da562b7ac (patch) | |
tree | 7ae8ef1412855aa0b4f3dac666fe1daa0a8eab90 | |
parent | core/dbus-unit: use UNIT_IS_LOAD_ERROR where appropriate (diff) | |
download | systemd-e2f81f8d40c3e7d99c61e4642040ce4da562b7ac.tar.xz systemd-e2f81f8d40c3e7d99c61e4642040ce4da562b7ac.zip |
core/unit: drop pointless unit_freezer_state wrapper
-rw-r--r-- | src/core/dbus-unit.c | 4 | ||||
-rw-r--r-- | src/core/unit-serialize.c | 3 | ||||
-rw-r--r-- | src/core/unit.c | 6 | ||||
-rw-r--r-- | src/core/unit.h | 1 |
4 files changed, 4 insertions, 10 deletions
diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 0161a1bf45..a9ae81aed5 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 175e327d92..8baa30f9e5 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 8ac0aad2d7..8cdb3a025f 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 042ec3b3ea..c961edef5f 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); |