[systemd-commits] 3 commits - src/dbus-common.c src/dbus-common.h src/dbus-manager.c src/dbus-service.c
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Apr 10 13:42:41 PDT 2012
src/dbus-common.c | 6 +++++-
src/dbus-common.h | 17 ++++++++++++++++-
src/dbus-manager.c | 4 ++--
src/dbus-service.c | 5 +++--
4 files changed, 26 insertions(+), 6 deletions(-)
New commits:
commit 69df6f00f232af788746c410cb4cccd8209bd11c
Author: Michael Olbrich <m.olbrich at pengutronix.de>
Date: Fri Apr 6 21:38:02 2012 +0200
dbus: make the service property StartLimitAction writeable
diff --git a/src/dbus-service.c b/src/dbus-service.c
index 7809164..d840415 100644
--- a/src/dbus-service.c
+++ b/src/dbus-service.c
@@ -48,7 +48,7 @@
" <property name=\"WatchdogTimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"StartLimitInterval\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"StartLimitBurst\" type=\"u\" access=\"read\"/>\n" \
- " <property name=\"StartLimitAction\" type=\"s\" access=\"read\"/>\n" \
+ " <property name=\"StartLimitAction\" type=\"s\" access=\"readwrite\"/>\n" \
BUS_EXEC_COMMAND_INTERFACE("ExecStartPre") \
BUS_EXEC_COMMAND_INTERFACE("ExecStart") \
BUS_EXEC_COMMAND_INTERFACE("ExecStartPost") \
@@ -105,6 +105,7 @@ static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_restart, service_resta
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_notify_access, notify_access, NotifyAccess);
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_service_result, service_result, ServiceResult);
static DEFINE_BUS_PROPERTY_APPEND_ENUM(bus_service_append_start_limit_action, start_limit_action, StartLimitAction);
+static DEFINE_BUS_PROPERTY_SET_ENUM(bus_service_set_start_limit_action, start_limit_action, StartLimitAction);
static const BusProperty bus_exec_main_status_properties[] = {
{ "ExecMainStartTimestamp", bus_property_append_usec, "t", offsetof(ExecStatus, start_timestamp.realtime) },
@@ -129,7 +130,7 @@ static const BusProperty bus_service_properties[] = {
{ "WatchdogTimestampMonotonic",bus_property_append_usec, "t", offsetof(Service, watchdog_timestamp.monotonic) },
{ "StartLimitInterval", bus_property_append_usec, "t", offsetof(Service, start_limit.interval) },
{ "StartLimitBurst", bus_property_append_uint32, "u", offsetof(Service, start_limit.burst) },
- { "StartLimitAction", bus_service_append_start_limit_action,"s", offsetof(Service, start_limit_action) },
+ { "StartLimitAction", bus_service_append_start_limit_action,"s", offsetof(Service, start_limit_action), false, bus_service_set_start_limit_action},
BUS_EXEC_COMMAND_PROPERTY("ExecStartPre", offsetof(Service, exec_command[SERVICE_EXEC_START_PRE]), true ),
BUS_EXEC_COMMAND_PROPERTY("ExecStart", offsetof(Service, exec_command[SERVICE_EXEC_START]), true ),
BUS_EXEC_COMMAND_PROPERTY("ExecStartPost", offsetof(Service, exec_command[SERVICE_EXEC_START_POST]), true ),
commit c57c09eed40704363256149e7b50582a68de6162
Author: Michael Olbrich <m.olbrich at pengutronix.de>
Date: Fri Apr 6 21:38:01 2012 +0200
dbus: add generic DEFINE_BUS_PROPERTY_SET_ENUM() macro for enum properties
The defined function can be used as BusPropertySetCallback.
diff --git a/src/dbus-common.h b/src/dbus-common.h
index 1dc0f59..892d129 100644
--- a/src/dbus-common.h
+++ b/src/dbus-common.h
@@ -160,6 +160,21 @@ int bus_property_append_long(DBusMessageIter *i, const char *property, void *dat
return 0; \
}
+#define DEFINE_BUS_PROPERTY_SET_ENUM(function,name,type) \
+ int function(DBusMessageIter *i, const char *property, void *data) { \
+ const char *value; \
+ type *field = data; \
+ \
+ assert(i); \
+ assert(property); \
+ \
+ dbus_message_iter_get_basic(i, &value); \
+ \
+ *field = name##_from_string(value); \
+ \
+ return 0; \
+ }
+
const char *bus_errno_to_dbus(int error);
DBusMessage* bus_properties_changed_new(const char *path, const char *interface, const char *properties);
commit 9612f07cbf2b0ec54c5dc6ed7e521e181cc3612d
Author: Michael Olbrich <m.olbrich at pengutronix.de>
Date: Fri Apr 6 21:38:00 2012 +0200
dbus: add data argument to BusPropertySetCallback
BusPropertyCallback already has the argument. It is necesary for the
callback to know what data to access.
diff --git a/src/dbus-common.c b/src/dbus-common.c
index 2905ac3..fc97108 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -402,6 +402,7 @@ get_prop:
const BusProperty *p;
DBusMessageIter sub;
char *sig;
+ void *data;
if (!dbus_message_iter_init(message, &iter) ||
dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRING)
@@ -456,7 +457,10 @@ set_prop:
dbus_free(sig);
- r = p->set(&sub, property);
+ data = (char*)bp->base + p->offset;
+ if (p->indirect)
+ data = *(void**)data;
+ r = p->set(&sub, property, data);
if (r < 0) {
if (r == -ENOMEM)
goto oom;
diff --git a/src/dbus-common.h b/src/dbus-common.h
index 15811a7..1dc0f59 100644
--- a/src/dbus-common.h
+++ b/src/dbus-common.h
@@ -93,7 +93,7 @@ int bus_connect_system_polkit(DBusConnection **_bus, DBusError *error);
const char *bus_error_message(const DBusError *error);
typedef int (*BusPropertyCallback)(DBusMessageIter *iter, const char *property, void *data);
-typedef int (*BusPropertySetCallback)(DBusMessageIter *iter, const char *property);
+typedef int (*BusPropertySetCallback)(DBusMessageIter *iter, const char *property, void *data);
typedef struct BusProperty {
const char *property; /* name of the property */
diff --git a/src/dbus-manager.c b/src/dbus-manager.c
index 0a6e55d..3bf0c07 100644
--- a/src/dbus-manager.c
+++ b/src/dbus-manager.c
@@ -326,7 +326,7 @@ static int bus_manager_append_log_target(DBusMessageIter *i, const char *propert
return 0;
}
-static int bus_manager_set_log_target(DBusMessageIter *i, const char *property) {
+static int bus_manager_set_log_target(DBusMessageIter *i, const char *property, void *data) {
const char *t;
assert(i);
@@ -351,7 +351,7 @@ static int bus_manager_append_log_level(DBusMessageIter *i, const char *property
return 0;
}
-static int bus_manager_set_log_level(DBusMessageIter *i, const char *property) {
+static int bus_manager_set_log_level(DBusMessageIter *i, const char *property, void *data) {
const char *t;
assert(i);
More information about the systemd-commits
mailing list