Commit b053262f authored by Patrick Mochel's avatar Patrick Mochel

kobject: don't create directory for kobject/subsystem if name is NULL.

This allows subsystems to exist the hierarchy, but not be exported via
the filesystem. This fixes a minor flaw with partitions, as partition
objects are children of block devices, though they register with the 
partition subsystem. Really, the partition subsystem shouldn't have 
presence in the tree at all, yet still exist.
parent 24555ac2
......@@ -355,7 +355,6 @@ static struct attribute * default_attrs[] = {
extern struct subsystem block_subsys;
static struct subsystem part_subsys = {
.kobj = { .name = "part" },
.parent = &block_subsys,
.default_attrs = default_attrs,
.sysfs_ops = &part_sysfs_ops,
......
......@@ -5,6 +5,7 @@
#define DEBUG 0
#include <linux/kobject.h>
#include <linux/string.h>
#include <linux/module.h>
#include <linux/stat.h>
......@@ -76,12 +77,14 @@ int kobject_register(struct kobject * kobj)
}
up_write(&s->rwsem);
}
if (strlen(kobj->name)) {
error = sysfs_create_dir(kobj);
if (!error) {
error = kobject_populate_dir(kobj);
if (error)
sysfs_remove_dir(kobj);
}
}
return error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment