summaryrefslogtreecommitdiff
path: root/drivers/md/md.h
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2011-07-27 01:00:36 (GMT)
committerNeilBrown <neilb@suse.de>2011-07-27 01:00:36 (GMT)
commit36fad858a7404a9656122a9e560a224ae2a00979 (patch)
tree95f8a7a6b8dad6bb8d7c7735f7845888b5e702db /drivers/md/md.h
parent8bda470e8ebde35f9349e98ecbce4dfb508a60fa (diff)
downloadlinux-36fad858a7404a9656122a9e560a224ae2a00979.tar.xz
md: introduce link/unlink_rdev() helpers
There are places where sysfs links to rdev are handled in a same way. Add the helper functions to consolidate them. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.h')
-rw-r--r--drivers/md/md.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h
index 1c26c7a..6863f72 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -413,6 +413,20 @@ static inline char * mdname (mddev_t * mddev)
return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
}
+static inline int sysfs_link_rdev(mddev_t *mddev, mdk_rdev_t *rdev)
+{
+ char nm[20];
+ sprintf(nm, "rd%d", rdev->raid_disk);
+ return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
+}
+
+static inline void sysfs_unlink_rdev(mddev_t *mddev, mdk_rdev_t *rdev)
+{
+ char nm[20];
+ sprintf(nm, "rd%d", rdev->raid_disk);
+ sysfs_remove_link(&mddev->kobj, nm);
+}
+
/*
* iterates through some rdev ringlist. It's safe to remove the
* current 'rdev'. Dont touch 'tmp' though.