Commit 486d220fe4909b5745c4faa67faddd30a707abe2

Authored by Peter Rajnoha
Committed by Alasdair G Kergon
1 parent 1b6da75459

dm: sysfs add suspended attribute

Add a file named 'suspended' to each device-mapper device directory in
sysfs.  It holds the value 1 while the device is suspended.  Otherwise
it holds 0.

Signed-off-by: Peter Rajnoha <prajnoha@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

Showing 1 changed file with 9 additions and 0 deletions Side-by-side Diff

drivers/md/dm-sysfs.c
... ... @@ -57,12 +57,21 @@
57 57 return strlen(buf);
58 58 }
59 59  
  60 +static ssize_t dm_attr_suspended_show(struct mapped_device *md, char *buf)
  61 +{
  62 + sprintf(buf, "%d\n", dm_suspended(md));
  63 +
  64 + return strlen(buf);
  65 +}
  66 +
60 67 static DM_ATTR_RO(name);
61 68 static DM_ATTR_RO(uuid);
  69 +static DM_ATTR_RO(suspended);
62 70  
63 71 static struct attribute *dm_attrs[] = {
64 72 &dm_attr_name.attr,
65 73 &dm_attr_uuid.attr,
  74 + &dm_attr_suspended.attr,
66 75 NULL,
67 76 };
68 77