summaryrefslogtreecommitdiff
path: root/src/core/dbus-mount.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-05-11 18:09:40 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-05-13 12:21:08 +0900
commitf724fd4c2582071f9d5bf5100521d5b828a77645 (patch)
treef1ce76d25402b5a42f3a94d0dc41ddd0d334a6f0 /src/core/dbus-mount.c
parent23c9a63a9895c6ac725ebd65bcd0f5e54e6b2446 (diff)
downloadsystemd-f724fd4c2582071f9d5bf5100521d5b828a77645.tar.gz
dbus-mount: use BUS_DEFINE_PROPERTY_GET* macros
Diffstat (limited to 'src/core/dbus-mount.c')
-rw-r--r--src/core/dbus-mount.c79
1 files changed, 17 insertions, 62 deletions
diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c
index 0088bdae49..d9b900abad 100644
--- a/src/core/dbus-mount.c
+++ b/src/core/dbus-mount.c
@@ -15,78 +15,33 @@
#include "string-util.h"
#include "unit.h"
-static int property_get_what(
- sd_bus *bus,
- const char *path,
- const char *interface,
- const char *property,
- sd_bus_message *reply,
- void *userdata,
- sd_bus_error *error) {
-
- Mount *m = userdata;
- const char *d = NULL;
-
- assert(bus);
- assert(reply);
- assert(m);
-
+static const char *mount_get_what(const Mount *m) {
if (m->from_proc_self_mountinfo && m->parameters_proc_self_mountinfo.what)
- d = m->parameters_proc_self_mountinfo.what;
- else if (m->from_fragment && m->parameters_fragment.what)
- d = m->parameters_fragment.what;
-
- return sd_bus_message_append(reply, "s", d);
+ return m->parameters_proc_self_mountinfo.what;
+ if (m->from_fragment && m->parameters_fragment.what)
+ return m->parameters_fragment.what;
+ return NULL;
}
-static int property_get_options(
- sd_bus *bus,
- const char *path,
- const char *interface,
- const char *property,
- sd_bus_message *reply,
- void *userdata,
- sd_bus_error *error) {
-
- Mount *m = userdata;
- const char *d = NULL;
-
- assert(bus);
- assert(reply);
- assert(m);
-
+static const char *mount_get_options(const Mount *m) {
if (m->from_proc_self_mountinfo && m->parameters_proc_self_mountinfo.options)
- d = m->parameters_proc_self_mountinfo.options;
- else if (m->from_fragment && m->parameters_fragment.options)
- d = m->parameters_fragment.options;
-
- return sd_bus_message_append(reply, "s", d);
+ return m->parameters_proc_self_mountinfo.options;
+ if (m->from_fragment && m->parameters_fragment.options)
+ return m->parameters_fragment.options;
+ return NULL;
}
-static int property_get_type(
- sd_bus *bus,
- const char *path,
- const char *interface,
- const char *property,
- sd_bus_message *reply,
- void *userdata,
- sd_bus_error *error) {
-
- const char *fstype = NULL;
- Mount *m = userdata;
-
- assert(bus);
- assert(reply);
- assert(m);
-
+static const char *mount_get_fstype(const Mount *m) {
if (m->from_proc_self_mountinfo && m->parameters_proc_self_mountinfo.fstype)
- fstype = m->parameters_proc_self_mountinfo.fstype;
+ return m->parameters_proc_self_mountinfo.fstype;
else if (m->from_fragment && m->parameters_fragment.fstype)
- fstype = m->parameters_fragment.fstype;
-
- return sd_bus_message_append(reply, "s", fstype);
+ return m->parameters_fragment.fstype;
+ return NULL;
}
+static BUS_DEFINE_PROPERTY_GET(property_get_what, "s", Mount, mount_get_what);
+static BUS_DEFINE_PROPERTY_GET(property_get_options, "s", Mount, mount_get_options);
+static BUS_DEFINE_PROPERTY_GET(property_get_type, "s", Mount, mount_get_fstype);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, mount_result, MountResult);
const sd_bus_vtable bus_mount_vtable[] = {