summaryrefslogtreecommitdiff
path: root/src/hostname
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2013-11-05 02:57:49 +0100
committerKay Sievers <kay@vrfy.org>2013-11-05 02:57:49 +0100
commit9f6eb1cd58f2ddf2eb6ba0e4de056e13d938af75 (patch)
treed465dbbc5385774cb1f37111f8c5d55f64c0da69 /src/hostname
parent9b07511d658fa367f71de9f55fb60c37f0f596ad (diff)
bus: update bus_map_all_properties()
Diffstat (limited to 'src/hostname')
-rw-r--r--src/hostname/hostnamectl.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 8d8dc3d7f..cc7db67d7 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -142,12 +142,12 @@ static int show_one_name(sd_bus *bus, const char* attr) {
static int show_all_names(sd_bus *bus) {
StatusInfo info = {};
- const struct bus_properties_map map[] = {
- { "s", "Hostname", &info.hostname },
- { "s", "StaticHostname", &info.static_hostname },
- { "s", "PrettyHostname", &info.pretty_hostname },
- { "s", "IconName", &info.icon_name },
- { "s", "Chassis", &info.chassis },
+ static const struct bus_properties_map map[] = {
+ { "Hostname", "s", NULL, offsetof(StatusInfo, hostname) },
+ { "StaticHostname", "s", NULL, offsetof(StatusInfo, static_hostname) },
+ { "PrettyHostname", "s", NULL, offsetof(StatusInfo, pretty_hostname) },
+ { "IconName", "s", NULL, offsetof(StatusInfo, icon_name) },
+ { "Chassis", "s", NULL, offsetof(StatusInfo, chassis) },
{}
};
int r;
@@ -155,7 +155,8 @@ static int show_all_names(sd_bus *bus) {
r = bus_map_all_properties(bus,
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
- map);
+ map,
+ &info);
if (r < 0)
goto fail;