From 78b8781a4c738dc42dc03f9363ec7779d28e9884 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Fri, 7 Sep 2012 16:51:18 -0400 Subject: [PATCH] Add MDRaid:SyncAction and MDRaid:Degraded properties Signed-off-by: David Zeuthen --- data/org.freedesktop.UDisks2.xml | 21 ++++++++++++++++++++- src/udiskslinuxmdraid.c | 10 ++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/data/org.freedesktop.UDisks2.xml b/data/org.freedesktop.UDisks2.xml index 6ba1b85..3110bf9 100644 --- a/data/org.freedesktop.UDisks2.xml +++ b/data/org.freedesktop.UDisks2.xml @@ -1618,7 +1618,26 @@ --> - + + + + + diff --git a/src/udiskslinuxmdraid.c b/src/udiskslinuxmdraid.c index 3e697e9..1eaae35 100644 --- a/src/udiskslinuxmdraid.c +++ b/src/udiskslinuxmdraid.c @@ -137,6 +137,8 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, GUdevDevice *raid_device; GList *member_devices; GUdevDevice *member_device; + guint degraded; + const gchar *sync_action = ""; member_devices = udisks_linux_mdraid_object_get_members (object); if (member_devices == NULL) @@ -164,6 +166,14 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, udisks_mdraid_set_num_devices (iface, num_devices); udisks_mdraid_set_size (iface, size); + if (raid_device != NULL) + { + degraded = g_udev_device_get_sysfs_attr_as_int (raid_device, "md/degraded"); + sync_action = g_udev_device_get_sysfs_attr (raid_device, "md/sync_action"); + } + udisks_mdraid_set_degraded (iface, degraded); + udisks_mdraid_set_sync_action (iface, sync_action); + /* TODO: set other stuff */ out: -- 2.7.4