md: reduce dependence on sysfs.

We will want md devices to live as dm targets where sysfs is not
visible.  So allow md to not connect to sysfs.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown
2010-06-01 19:37:23 +10:00
parent d0c6f62584
commit 00bcb4ac7e
3 changed files with 62 additions and 59 deletions

View File

@@ -382,6 +382,18 @@ struct md_sysfs_entry {
};
extern struct attribute_group md_bitmap_group;
static inline struct sysfs_dirent *sysfs_get_dirent_safe(struct sysfs_dirent *sd, char *name)
{
if (sd)
return sysfs_get_dirent(sd, NULL, name);
return sd;
}
static inline void sysfs_notify_dirent_safe(struct sysfs_dirent *sd)
{
if (sd)
sysfs_notify_dirent(sd);
}
static inline char * mdname (mddev_t * mddev)
{
return mddev->gendisk ? mddev->gendisk->disk_name : "mdX";