From aec8de63b14a93b91b85dc15bf879604352fbbe1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 22 Dec 2013 03:43:03 +0100 Subject: [PATCH] core: no need to list properties for PropertiesChanged messages anymore Since the vtable includes this information anyway, let's just use that --- src/core/automount.c | 1 - src/core/busname.c | 1 - src/core/dbus-automount.c | 5 ----- src/core/dbus-automount.h | 1 - src/core/dbus-busname.c | 5 ----- src/core/dbus-busname.h | 1 - src/core/dbus-device.c | 5 ----- src/core/dbus-device.h | 1 - src/core/dbus-mount.c | 9 --------- src/core/dbus-mount.h | 1 - src/core/dbus-path.c | 5 ----- src/core/dbus-path.h | 1 - src/core/dbus-scope.c | 5 ----- src/core/dbus-scope.h | 1 - src/core/dbus-service.c | 15 --------------- src/core/dbus-service.h | 1 - src/core/dbus-socket.c | 16 ++++------------ src/core/dbus-socket.h | 1 - src/core/dbus-swap.c | 8 -------- src/core/dbus-swap.h | 1 - src/core/dbus-timer.c | 7 ------- src/core/dbus-timer.h | 1 - src/core/dbus-unit.c | 32 ++++++++++++++------------------ src/core/device.c | 1 - src/core/mount.c | 1 - src/core/path.c | 3 +-- src/core/scope.c | 1 - src/core/service.c | 1 - src/core/socket.c | 1 - src/core/swap.c | 1 - src/core/timer.c | 1 - src/core/unit.h | 3 --- 32 files changed, 19 insertions(+), 118 deletions(-) diff --git a/src/core/automount.c b/src/core/automount.c index c6e0a7470..c44521c22 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -874,7 +874,6 @@ const UnitVTable automount_vtable = { .bus_interface = "org.freedesktop.systemd1.Automount", .bus_vtable = bus_automount_vtable, - .bus_changing_properties = bus_automount_changing_properties, .shutdown = automount_shutdown, diff --git a/src/core/busname.c b/src/core/busname.c index 034e5f60d..9b6bf07d9 100644 --- a/src/core/busname.c +++ b/src/core/busname.c @@ -584,7 +584,6 @@ const UnitVTable busname_vtable = { .bus_interface = "org.freedesktop.systemd1.BusName", .bus_vtable = bus_busname_vtable, - .bus_changing_properties = bus_busname_changing_properties, .status_message_formats = { .finished_start_job = { diff --git a/src/core/dbus-automount.c b/src/core/dbus-automount.c index 8559aed0e..b2a510ad0 100644 --- a/src/core/dbus-automount.c +++ b/src/core/dbus-automount.c @@ -34,8 +34,3 @@ const sd_bus_vtable bus_automount_vtable[] = { SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Automount, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_VTABLE_END }; - -const char* const bus_automount_changing_properties[] = { - "Result", - NULL -}; diff --git a/src/core/dbus-automount.h b/src/core/dbus-automount.h index 0b9618368..1bec95378 100644 --- a/src/core/dbus-automount.h +++ b/src/core/dbus-automount.h @@ -24,4 +24,3 @@ #include "sd-bus.h" extern const sd_bus_vtable bus_automount_vtable[]; -extern const char* const bus_automount_changing_properties[]; diff --git a/src/core/dbus-busname.c b/src/core/dbus-busname.c index 9f94bf1d5..854491b2e 100644 --- a/src/core/dbus-busname.c +++ b/src/core/dbus-busname.c @@ -33,8 +33,3 @@ const sd_bus_vtable bus_busname_vtable[] = { SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(BusName, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_VTABLE_END }; - -const char* const bus_busname_changing_properties[] = { - "Result", - NULL -}; diff --git a/src/core/dbus-busname.h b/src/core/dbus-busname.h index 3a29317e1..b5eed37d5 100644 --- a/src/core/dbus-busname.h +++ b/src/core/dbus-busname.h @@ -25,4 +25,3 @@ #include "unit.h" extern const sd_bus_vtable bus_busname_vtable[]; -extern const char* const bus_busname_changing_properties[]; diff --git a/src/core/dbus-device.c b/src/core/dbus-device.c index 621bab042..f556536f3 100644 --- a/src/core/dbus-device.c +++ b/src/core/dbus-device.c @@ -29,8 +29,3 @@ const sd_bus_vtable bus_device_vtable[] = { SD_BUS_PROPERTY("SysFSPath", "s", NULL, offsetof(Device, sysfs), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_VTABLE_END }; - -const char* const bus_device_changing_properties[] = { - "SysFSPath", - NULL -}; diff --git a/src/core/dbus-device.h b/src/core/dbus-device.h index f248c28db..4aff226ab 100644 --- a/src/core/dbus-device.h +++ b/src/core/dbus-device.h @@ -25,4 +25,3 @@ #include "unit.h" extern const sd_bus_vtable bus_device_vtable[]; -extern const char* const bus_device_changing_properties[]; diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c index 3b588087e..28f0e9071 100644 --- a/src/core/dbus-mount.c +++ b/src/core/dbus-mount.c @@ -124,15 +124,6 @@ const sd_bus_vtable bus_mount_vtable[] = { SD_BUS_VTABLE_END }; -const char * const bus_mount_changing_properties[] = { - "What", - "Options", - "Type", - "ControlPID", - "Result", - NULL -}; - int bus_mount_set_property( Unit *u, const char *name, diff --git a/src/core/dbus-mount.h b/src/core/dbus-mount.h index 4bb5d2dde..f7004d252 100644 --- a/src/core/dbus-mount.h +++ b/src/core/dbus-mount.h @@ -25,7 +25,6 @@ #include "unit.h" extern const sd_bus_vtable bus_mount_vtable[]; -extern const char * const bus_mount_changing_properties[]; int bus_mount_set_property(Unit *u, const char *name, sd_bus_message *message, UnitSetPropertiesMode mode, sd_bus_error *error); int bus_mount_commit_properties(Unit *u); diff --git a/src/core/dbus-path.c b/src/core/dbus-path.c index 36c4e0f72..b5e894101 100644 --- a/src/core/dbus-path.c +++ b/src/core/dbus-path.c @@ -86,8 +86,3 @@ const sd_bus_vtable bus_path_vtable[] = { SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Path, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_VTABLE_END }; - -const char* const bus_path_changing_properties[] = { - "Result", - NULL -}; diff --git a/src/core/dbus-path.h b/src/core/dbus-path.h index e9558f81b..667da0522 100644 --- a/src/core/dbus-path.h +++ b/src/core/dbus-path.h @@ -25,4 +25,3 @@ #include "sd-bus.h" extern const sd_bus_vtable bus_path_vtable[]; -extern const char* const bus_path_changing_properties[]; diff --git a/src/core/dbus-scope.c b/src/core/dbus-scope.c index b20b6e7ff..bb251edc7 100644 --- a/src/core/dbus-scope.c +++ b/src/core/dbus-scope.c @@ -36,11 +36,6 @@ const sd_bus_vtable bus_scope_vtable[] = { SD_BUS_VTABLE_END }; -const char* const bus_scope_changing_properties[] = { - "Result", - NULL -}; - static int bus_scope_set_transient_property( Scope *s, const char *name, diff --git a/src/core/dbus-scope.h b/src/core/dbus-scope.h index 30c5e1e0a..7e8f0053d 100644 --- a/src/core/dbus-scope.h +++ b/src/core/dbus-scope.h @@ -25,7 +25,6 @@ #include "unit.h" extern const sd_bus_vtable bus_scope_vtable[]; -extern const char* const bus_scope_changing_properties[]; int bus_scope_set_property(Unit *u, const char *name, sd_bus_message *i, UnitSetPropertiesMode mode, sd_bus_error *error); int bus_scope_commit_properties(Unit *u); diff --git a/src/core/dbus-service.c b/src/core/dbus-service.c index 25af7acc2..3db9339d4 100644 --- a/src/core/dbus-service.c +++ b/src/core/dbus-service.c @@ -69,21 +69,6 @@ const sd_bus_vtable bus_service_vtable[] = { SD_BUS_VTABLE_END }; -const char* const bus_service_changing_properties[] = { - "ExecMainStartTimestamp", - "ExecMainStartTimestampMonotonic", - "ExecMainExitTimestamp", - "ExecMainExitTimestampMonotonic", - "ExecMainPID", - "ExecMainCode", - "ExecMainStatus", - "MainPID", - "ControlPID", - "StatusText", - "Result", - NULL -}; - static int bus_service_set_transient_property( Service *s, const char *name, diff --git a/src/core/dbus-service.h b/src/core/dbus-service.h index 5fa9b2f13..aab9f7aa2 100644 --- a/src/core/dbus-service.h +++ b/src/core/dbus-service.h @@ -25,7 +25,6 @@ #include "unit.h" extern const sd_bus_vtable bus_service_vtable[]; -extern const char* const bus_service_changing_properties[]; int bus_service_set_property(Unit *u, const char *name, sd_bus_message *i, UnitSetPropertiesMode mode, sd_bus_error *error); int bus_service_commit_properties(Unit *u); diff --git a/src/core/dbus-socket.c b/src/core/dbus-socket.c index c64bf82e6..bb9d41990 100644 --- a/src/core/dbus-socket.c +++ b/src/core/dbus-socket.c @@ -90,7 +90,6 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_PROPERTY("BindIPv6Only", "s", property_get_bind_ipv6_only, offsetof(Socket, bind_ipv6_only), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Backlog", "u", bus_property_get_unsigned, offsetof(Socket, backlog), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("TimeoutUSec", "t", bus_property_get_usec, offsetof(Socket, timeout_usec), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_PROPERTY("ControlPID", "u", bus_property_get_pid, offsetof(Socket, control_pid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("BindToDevice", "s", NULL, offsetof(Socket, bind_to_device), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("DirectoryMode", "u", bus_property_get_mode, offsetof(Socket, directory_mode), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("SocketMode", "u", bus_property_get_mode, offsetof(Socket, socket_mode), SD_BUS_VTABLE_PROPERTY_CONST), @@ -110,15 +109,16 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_PROPERTY("Listen", "a(ss)", property_get_listen, 0, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("Mark", "i", bus_property_get_int, offsetof(Socket, mark), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("MaxConnections", "u", bus_property_get_unsigned, offsetof(Socket, max_connections), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_PROPERTY("NConnections", "u", bus_property_get_unsigned, offsetof(Socket, n_connections), 0), - SD_BUS_PROPERTY("NAccepted", "u", bus_property_get_unsigned, offsetof(Socket, n_accepted), 0), SD_BUS_PROPERTY("MessageQueueMaxMessages", "x", bus_property_get_long, offsetof(Socket, mq_maxmsg), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("MessageQueueMessageSize", "x", bus_property_get_long, offsetof(Socket, mq_msgsize), SD_BUS_VTABLE_PROPERTY_CONST), - SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Socket, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("ReusePort", "b", bus_property_get_bool, offsetof(Socket, reuse_port), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("SmackLabel", "s", NULL, offsetof(Socket, smack), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("SmackLabelIPIn", "s", NULL, offsetof(Socket, smack_ip_in), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("SmackLabelIPOut", "s", NULL, offsetof(Socket, smack_ip_out), SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("ControlPID", "u", bus_property_get_pid, offsetof(Socket, control_pid), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("Result", "s", property_get_result, offsetof(Socket, result), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("NConnections", "u", bus_property_get_unsigned, offsetof(Socket, n_connections), 0), + SD_BUS_PROPERTY("NAccepted", "u", bus_property_get_unsigned, offsetof(Socket, n_accepted), 0), BUS_EXEC_COMMAND_LIST_VTABLE("ExecStartPre", offsetof(Socket, exec_command[SOCKET_EXEC_START_PRE]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), BUS_EXEC_COMMAND_LIST_VTABLE("ExecStartPost", offsetof(Socket, exec_command[SOCKET_EXEC_START_POST]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), BUS_EXEC_COMMAND_LIST_VTABLE("ExecStopPre", offsetof(Socket, exec_command[SOCKET_EXEC_STOP_PRE]), SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION), @@ -126,14 +126,6 @@ const sd_bus_vtable bus_socket_vtable[] = { SD_BUS_VTABLE_END }; -const char* const bus_socket_changing_properties[] = { - "ControlPID", - "NAccepted", - "NConnections", - "Result", - NULL -}; - int bus_socket_set_property( Unit *u, const char *name, diff --git a/src/core/dbus-socket.h b/src/core/dbus-socket.h index 8808fa235..17164d987 100644 --- a/src/core/dbus-socket.h +++ b/src/core/dbus-socket.h @@ -25,7 +25,6 @@ #include "unit.h" extern const sd_bus_vtable bus_socket_vtable[]; -extern const char* const bus_socket_changing_properties[]; int bus_socket_set_property(Unit *u, const char *name, sd_bus_message *message, UnitSetPropertiesMode mode, sd_bus_error *error); int bus_socket_commit_properties(Unit *u); diff --git a/src/core/dbus-swap.c b/src/core/dbus-swap.c index bad53feb5..7bd05db41 100644 --- a/src/core/dbus-swap.c +++ b/src/core/dbus-swap.c @@ -69,14 +69,6 @@ const sd_bus_vtable bus_swap_vtable[] = { SD_BUS_VTABLE_END }; -const char* const bus_swap_changing_properties[] = { - "What", - "Priority", - "ControlPID", - "Result", - NULL -}; - int bus_swap_set_property( Unit *u, const char *name, diff --git a/src/core/dbus-swap.h b/src/core/dbus-swap.h index 5d357377c..9469f68ab 100644 --- a/src/core/dbus-swap.h +++ b/src/core/dbus-swap.h @@ -26,7 +26,6 @@ #include "unit.h" extern const sd_bus_vtable bus_swap_vtable[]; -extern const char* const bus_swap_changing_properties[]; int bus_swap_set_property(Unit *u, const char *name, sd_bus_message *message, UnitSetPropertiesMode mode, sd_bus_error *error); int bus_swap_commit_properties(Unit *u); diff --git a/src/core/dbus-timer.c b/src/core/dbus-timer.c index b37c0d0f2..277a45c0b 100644 --- a/src/core/dbus-timer.c +++ b/src/core/dbus-timer.c @@ -146,10 +146,3 @@ const sd_bus_vtable bus_timer_vtable[] = { SD_BUS_PROPERTY("AccuracyUSec", "t", bus_property_get_usec, offsetof(Timer, accuracy_usec), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_VTABLE_END }; - -const char* const bus_timer_changing_properties[] = { - "NextElapseUSecRealtime", - "NextElapseUSecMonotonic", - "Result", - NULL -}; diff --git a/src/core/dbus-timer.h b/src/core/dbus-timer.h index ddd311c62..cfff88e8b 100644 --- a/src/core/dbus-timer.h +++ b/src/core/dbus-timer.h @@ -24,4 +24,3 @@ #include "sd-bus.h" extern const sd_bus_vtable bus_timer_vtable[]; -extern const char* const bus_timer_changing_properties[]; diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 7a566ff7f..4d3e3cc9e 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -634,29 +634,25 @@ static int send_changed_signal(sd_bus *bus, const char *destination, void *userd * type, then for the generic unit. The clients may rely on * this order to get atomic behavior if needed. */ - if (UNIT_VTABLE(u)->bus_changing_properties) { - - r = sd_bus_emit_properties_changed_strv( - bus, p, - UNIT_VTABLE(u)->bus_interface, - (char**) UNIT_VTABLE(u)->bus_changing_properties); - if (r < 0) - return r; + r = sd_bus_emit_properties_changed_strv( + bus, p, + UNIT_VTABLE(u)->bus_interface, + NULL); + if (r < 0) { + log_warning("Failed to send out specific PropertiesChanged signal for %s: %s", u->id, strerror(-r)); + return r; } - return sd_bus_emit_properties_changed( + r = sd_bus_emit_properties_changed_strv( bus, p, "org.freedesktop.systemd1.Unit", - "ActiveState", - "SubState", - "InactiveExitTimestamp", - "ActiveEnterTimestamp", - "ActiveExitTimestamp", - "InactiveEnterTimestamp", - "Job", - "ConditionResult", - "ConditionTimestamp", NULL); + if (r < 0) { + log_warning("Failed to send out generic PropertiesChanged signal for %s: %s", u->id, strerror(-r)); + return r; + } + + return 0; } void bus_unit_send_change_signal(Unit *u) { diff --git a/src/core/device.c b/src/core/device.c index 72d98aea7..2c44dec77 100644 --- a/src/core/device.c +++ b/src/core/device.c @@ -653,7 +653,6 @@ const UnitVTable device_vtable = { .sub_state_to_string = device_sub_state_to_string, .bus_interface = "org.freedesktop.systemd1.Device", - .bus_changing_properties = bus_device_changing_properties, .bus_vtable = bus_device_vtable, .following = device_following, diff --git a/src/core/mount.c b/src/core/mount.c index 77493dbd3..2b7934e40 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -1793,7 +1793,6 @@ const UnitVTable mount_vtable = { .bus_interface = "org.freedesktop.systemd1.Mount", .bus_vtable = bus_mount_vtable, - .bus_changing_properties = bus_mount_changing_properties, .bus_set_property = bus_mount_set_property, .bus_commit_properties = bus_mount_commit_properties, diff --git a/src/core/path.c b/src/core/path.c index 51e8d1dbc..fc7069e6c 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -805,6 +805,5 @@ const UnitVTable path_vtable = { .reset_failed = path_reset_failed, .bus_interface = "org.freedesktop.systemd1.Path", - .bus_vtable = bus_path_vtable, - .bus_changing_properties = bus_path_changing_properties + .bus_vtable = bus_path_vtable }; diff --git a/src/core/scope.c b/src/core/scope.c index a3c94794b..56c374660 100644 --- a/src/core/scope.c +++ b/src/core/scope.c @@ -492,7 +492,6 @@ const UnitVTable scope_vtable = { .bus_interface = "org.freedesktop.systemd1.Scope", .bus_vtable = bus_scope_vtable, - .bus_changing_properties = bus_scope_changing_properties, .bus_set_property = bus_scope_set_property, .bus_commit_properties = bus_scope_commit_properties, diff --git a/src/core/service.c b/src/core/service.c index 6c82ced92..87eaa2937 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -3836,7 +3836,6 @@ const UnitVTable service_vtable = { .bus_interface = "org.freedesktop.systemd1.Service", .bus_vtable = bus_service_vtable, - .bus_changing_properties = bus_service_changing_properties, .bus_set_property = bus_service_set_property, .bus_commit_properties = bus_service_commit_properties, diff --git a/src/core/socket.c b/src/core/socket.c index d6289a316..244222135 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -2424,7 +2424,6 @@ const UnitVTable socket_vtable = { .bus_interface = "org.freedesktop.systemd1.Socket", .bus_vtable = bus_socket_vtable, - .bus_changing_properties = bus_socket_changing_properties, .bus_set_property = bus_socket_set_property, .bus_commit_properties = bus_socket_commit_properties, diff --git a/src/core/swap.c b/src/core/swap.c index b197eb469..79862e5b8 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -1445,7 +1445,6 @@ const UnitVTable swap_vtable = { .bus_interface = "org.freedesktop.systemd1.Swap", .bus_vtable = bus_swap_vtable, - .bus_changing_properties = bus_swap_changing_properties, .bus_set_property = bus_swap_set_property, .bus_commit_properties = bus_swap_commit_properties, diff --git a/src/core/timer.c b/src/core/timer.c index f23582c2d..a4ff662c5 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -646,5 +646,4 @@ const UnitVTable timer_vtable = { .bus_interface = "org.freedesktop.systemd1.Timer", .bus_vtable = bus_timer_vtable, - .bus_changing_properties = bus_timer_changing_properties, }; diff --git a/src/core/unit.h b/src/core/unit.h index 8ceeececc..45816eae3 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -426,9 +426,6 @@ struct UnitVTable { /* The bus vtable */ const sd_bus_vtable *bus_vtable; - /* strv list of changing properties */ - const char * const * const bus_changing_properties; - /* The strings to print in status messages */ UnitStatusMessageFormats status_message_formats; -- 2.30.2