diff options
author | Namhyung Kim <namhyung@gmail.com> | 2011-07-27 11:00:36 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2011-07-27 11:00:36 +1000 |
commit | 36fad858a7404a9656122a9e560a224ae2a00979 (patch) | |
tree | 95f8a7a6b8dad6bb8d7c7735f7845888b5e702db /drivers/md/md.h | |
parent | 8bda470e8ebde35f9349e98ecbce4dfb508a60fa (diff) |
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.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/md/md.h b/drivers/md/md.h index 1c26c7a08ae6..6863f722cd2a 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. |