Skip to content

Commit

Permalink
mdraid: Expose "consistency_policy" sysfs value
Browse files Browse the repository at this point in the history
  • Loading branch information
mvollmer committed Apr 30, 2024
1 parent 8b59006 commit e3adc68
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions data/org.freedesktop.UDisks2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3141,6 +3141,17 @@
-->
<property name="Degraded" type="u" access="read"/>

<!-- ConsistencyPolicy:
The consistency policy of the array.
If the RAID array does not support consistency policies (for
example RAID-0 arrays), this is empty.
This property corresponds to the
<literal>consistency_policy</literal> sysfs file.
-->
<property name="ConsistencyPolicy" type="s" access="read"/>

<!-- BitmapLocation:
The location of a write-intent bitmap (empty if the array is not running), if any.
Expand Down
4 changes: 4 additions & 0 deletions src/udiskslinuxmdraid.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
const gchar *name = NULL;
gchar *sync_action = NULL;
gchar *sync_completed = NULL;
gchar *consistency_policy = NULL;
gchar *bitmap_location = NULL;
guint degraded = 0;
guint64 chunk_size = 0;
Expand Down Expand Up @@ -316,6 +317,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
degraded = udisks_linux_device_read_sysfs_attr_as_int (raid_device, "md/degraded", NULL);
sync_action = udisks_linux_device_read_sysfs_attr (raid_device, "md/sync_action", NULL);
sync_completed = udisks_linux_device_read_sysfs_attr (raid_device, "md/sync_completed", NULL);
consistency_policy = udisks_linux_device_read_sysfs_attr (raid_device, "md/consistency_policy", NULL);
bitmap_location = udisks_linux_device_read_sysfs_attr (raid_device, "md/bitmap/location", NULL);
}

Expand All @@ -326,6 +328,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
}
udisks_mdraid_set_degraded (iface, degraded);
udisks_mdraid_set_sync_action (iface, sync_action);
udisks_mdraid_set_consistency_policy (iface, consistency_policy);
udisks_mdraid_set_bitmap_location (iface, bitmap_location);
udisks_mdraid_set_chunk_size (iface, chunk_size);

Expand Down Expand Up @@ -517,6 +520,7 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid,
bd_md_examine_data_free (raid_data);
g_free (sync_completed);
g_free (sync_action);
g_free (consistency_policy);
g_free (bitmap_location);
g_list_free_full (member_devices, g_object_unref);
g_clear_object (&raid_device);
Expand Down

0 comments on commit e3adc68

Please sign in to comment.