diff options
author | NeilBrown <neilb@suse.de> | 2006-01-06 03:20:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:34:09 -0500 |
commit | 93c8cad03f02dbd1532a5413bdced25f000d5728 (patch) | |
tree | 80930b6670c21088ed78362fe9281deba82ff7dd /drivers/md/md.c | |
parent | 014236d2b8ec6faea2a6134ab8e019d84d67b524 (diff) |
[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/md.c')
-rw-r--r-- | drivers/md/md.c | 23 |
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) | |||
1664 | static struct rdev_sysfs_entry rdev_slot = | 1664 | static struct rdev_sysfs_entry rdev_slot = |
1665 | __ATTR(slot, 0644, slot_show, slot_store); | 1665 | __ATTR(slot, 0644, slot_show, slot_store); |
1666 | 1666 | ||
1667 | static ssize_t | ||
1668 | offset_show(mdk_rdev_t *rdev, char *page) | ||
1669 | { | ||
1670 | return sprintf(page, "%llu\n", rdev->data_offset); | ||
1671 | } | ||
1672 | |||
1673 | static ssize_t | ||
1674 | offset_store(mdk_rdev_t *rdev, const char *buf, size_t len) | ||
1675 | { | ||
1676 | char *e; | ||
1677 | unsigned long long offset = simple_strtoull(buf, &e, 10); | ||
1678 | if (e==buf || (*e && *e != '\n')) | ||
1679 | return -EINVAL; | ||
1680 | if (rdev->mddev->pers) | ||
1681 | return -EBUSY; | ||
1682 | rdev->data_offset = offset; | ||
1683 | return len; | ||
1684 | } | ||
1685 | |||
1686 | static struct rdev_sysfs_entry rdev_offset = | ||
1687 | __ATTR(offset, 0644, offset_show, offset_store); | ||
1688 | |||
1667 | static struct attribute *rdev_default_attrs[] = { | 1689 | static struct attribute *rdev_default_attrs[] = { |
1668 | &rdev_state.attr, | 1690 | &rdev_state.attr, |
1669 | &rdev_super.attr, | 1691 | &rdev_super.attr, |
1670 | &rdev_errors.attr, | 1692 | &rdev_errors.attr, |
1671 | &rdev_slot.attr, | 1693 | &rdev_slot.attr, |
1694 | &rdev_offset.attr, | ||
1672 | NULL, | 1695 | NULL, |
1673 | }; | 1696 | }; |
1674 | static ssize_t | 1697 | static ssize_t |