aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.h
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@gmail.com>2011-07-26 21:00:36 -0400
committerNeilBrown <neilb@suse.de>2011-07-26 21:00:36 -0400
commit36fad858a7404a9656122a9e560a224ae2a00979 (patch)
tree95f8a7a6b8dad6bb8d7c7735f7845888b5e702db /drivers/md/md.h
parent8bda470e8ebde35f9349e98ecbce4dfb508a60fa (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.h14
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)
413 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX"; 413 return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";
414} 414}
415 415
416static inline int sysfs_link_rdev(mddev_t *mddev, mdk_rdev_t *rdev)
417{
418 char nm[20];
419 sprintf(nm, "rd%d", rdev->raid_disk);
420 return sysfs_create_link(&mddev->kobj, &rdev->kobj, nm);
421}
422
423static inline void sysfs_unlink_rdev(mddev_t *mddev, mdk_rdev_t *rdev)
424{
425 char nm[20];
426 sprintf(nm, "rd%d", rdev->raid_disk);
427 sysfs_remove_link(&mddev->kobj, nm);
428}
429
416/* 430/*
417 * iterates through some rdev ringlist. It's safe to remove the 431 * iterates through some rdev ringlist. It's safe to remove the
418 * current 'rdev'. Dont touch 'tmp' though. 432 * current 'rdev'. Dont touch 'tmp' though.