summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-01-06 09:20:56 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 17:34:09 +0100
commit93c8cad03f02dbd1532a5413bdced25f000d5728 (patch)
tree80930b6670c21088ed78362fe9281deba82ff7dd /drivers/md
parent[PATCH] md: expose device slot information via sysfs (diff)
downloadlinux-93c8cad03f02dbd1532a5413bdced25f000d5728.tar.xz
linux-93c8cad03f02dbd1532a5413bdced25f000d5728.zip
[PATCH] md: export rdev->data_offset via sysfs
Signed-off-by: Neil Brown <neilb@suse.de> Acked-by: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index a8169564209d..742a82a4d10b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1664,11 +1664,34 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len)
static struct rdev_sysfs_entry rdev_slot =
__ATTR(slot, 0644, slot_show, slot_store);
+static ssize_t
+offset_show(mdk_rdev_t *rdev, char *page)
+{
+ return sprintf(page, "%llu\n", rdev->data_offset);
+}
+
+static ssize_t
+offset_store(mdk_rdev_t *rdev, const char *buf, size_t len)
+{
+ char *e;
+ unsigned long long offset = simple_strtoull(buf, &e, 10);
+ if (e==buf || (*e && *e != '\n'))
+ return -EINVAL;
+ if (rdev->mddev->pers)
+ return -EBUSY;
+ rdev->data_offset = offset;
+ return len;
+}
+
+static struct rdev_sysfs_entry rdev_offset =
+__ATTR(offset, 0644, offset_show, offset_store);
+
static struct attribute *rdev_default_attrs[] = {
&rdev_state.attr,
&rdev_super.attr,
&rdev_errors.attr,
&rdev_slot.attr,
+ &rdev_offset.attr,
NULL,
};
static ssize_t