diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-04-21 10:36:20 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-04-21 17:08:23 +0200 |
commit | 25141692e9ba62a8fd2769e751cdd21d29ddb5a1 (patch) | |
tree | c8e6bce5cd91268e6e477b86e532373982579efa /src/core/dbus-manager.c | |
parent | tree-wide: implement new log control API dbus interface in all our daemons (diff) | |
download | systemd-25141692e9ba62a8fd2769e751cdd21d29ddb5a1.tar.xz systemd-25141692e9ba62a8fd2769e751cdd21d29ddb5a1.zip |
core: use generic implementations of log level/target bus propertier getters
The setters are slightly different, hence keep them as they are for now.
Diffstat (limited to '')
-rw-r--r-- | src/core/dbus-manager.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 84c251af27..08f13a63a1 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -9,6 +9,7 @@ #include "architecture.h" #include "build.h" #include "bus-common-errors.h" +#include "bus-log-control-api.h" #include "bus-util.h" #include "dbus-cgroup.h" #include "dbus-execute.h" @@ -50,7 +51,6 @@ BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_oom_policy, oom_policy, OOMPolicy) static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_version, "s", GIT_VERSION); static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_features, "s", SYSTEMD_FEATURES); static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_architecture, "s", architecture_to_string(uname_architecture())); -static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_log_target, "s", log_target_to_string(log_get_target())); static BUS_DEFINE_PROPERTY_GET2(property_get_system_state, "s", Manager, manager_state, manager_state_to_string); static BUS_DEFINE_PROPERTY_GET_GLOBAL(property_get_timer_slack_nsec, "t", (uint64_t) prctl(PR_GET_TIMERSLACK)); static BUS_DEFINE_PROPERTY_GET_REF(property_get_hashmap_size, "u", Hashmap *, hashmap_size); @@ -141,28 +141,6 @@ static int property_set_log_target( return 0; } -static int property_get_log_level( - sd_bus *bus, - const char *path, - const char *interface, - const char *property, - sd_bus_message *reply, - void *userdata, - sd_bus_error *error) { - - _cleanup_free_ char *t = NULL; - int r; - - assert(bus); - assert(reply); - - r = log_level_to_string_alloc(log_get_max_level(), &t); - if (r < 0) - return r; - - return sd_bus_message_append(reply, "s", t); -} - static int property_set_log_level( sd_bus *bus, const char *path, @@ -2404,8 +2382,8 @@ const sd_bus_vtable bus_manager_vtable[] = { BUS_PROPERTY_DUAL_TIMESTAMP("InitRDGeneratorsFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD_GENERATORS_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST), BUS_PROPERTY_DUAL_TIMESTAMP("InitRDUnitsLoadStartTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_START]), SD_BUS_VTABLE_PROPERTY_CONST), BUS_PROPERTY_DUAL_TIMESTAMP("InitRDUnitsLoadFinishTimestamp", offsetof(Manager, timestamps[MANAGER_TIMESTAMP_INITRD_UNITS_LOAD_FINISH]), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", property_get_log_level, property_set_log_level, 0, 0), - SD_BUS_WRITABLE_PROPERTY("LogTarget", "s", property_get_log_target, property_set_log_target, 0, 0), + SD_BUS_WRITABLE_PROPERTY("LogLevel", "s", bus_property_get_log_level, property_set_log_level, 0, 0), + SD_BUS_WRITABLE_PROPERTY("LogTarget", "s", bus_property_get_log_target, property_set_log_target, 0, 0), SD_BUS_PROPERTY("NNames", "u", property_get_hashmap_size, offsetof(Manager, units), 0), SD_BUS_PROPERTY("NFailedUnits", "u", property_get_set_size, offsetof(Manager, failed_units), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("NJobs", "u", property_get_hashmap_size, offsetof(Manager, jobs), 0), |