aboutsummaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-10-16 10:11:44 -0600
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 20:40:10 -0800
commit3514faca19a6fdc209734431c509631ea92b094e (patch)
treef6d102e6dec276f8e8d1044b47c74a02b901554f /fs
parentc11c4154e7ff4cebfadad849b1e22689d759c3f4 (diff)
kobject: remove struct kobj_type from struct kset
We don't need a "default" ktype for a kset. We should set this explicitly every time for each kset. This change is needed so that we can make ksets dynamic, and cleans up one of the odd, undocumented assumption that the kset/kobject/ktype model has. This patch is based on a lot of help from Kay Sievers. Nasty bug in the block code was found by Dave Young <hidave.darkstar@gmail.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/configfs/mount.c4
-rw-r--r--fs/debugfs/inode.c4
-rw-r--r--fs/dlm/lockspace.c6
-rw-r--r--fs/ecryptfs/main.c4
-rw-r--r--fs/fuse/inode.c8
-rw-r--r--fs/gfs2/locking/dlm/sysfs.c6
-rw-r--r--fs/gfs2/sys.c6
-rw-r--r--fs/namespace.c2
-rw-r--r--fs/ocfs2/cluster/masklog.c2
-rw-r--r--fs/ocfs2/cluster/sys.c2
-rw-r--r--fs/sysfs/file.c4
11 files changed, 20 insertions, 28 deletions
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 3bf0278ea84..374ddbd6648 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -128,7 +128,7 @@ void configfs_release_fs(void)
}
-static decl_subsys(config, NULL, NULL);
+static decl_subsys(config, NULL);
static int __init configfs_init(void)
{
@@ -140,7 +140,7 @@ static int __init configfs_init(void)
if (!configfs_dir_cachep)
goto out;
- kobj_set_kset_s(&config_subsys, kernel_subsys);
+ config_subsys.kobj.kset = &kernel_subsys;
err = subsystem_register(&config_subsys);
if (err) {
kmem_cache_destroy(configfs_dir_cachep);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 6a713b33992..f7f13516fc1 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -426,13 +426,13 @@ exit:
}
EXPORT_SYMBOL_GPL(debugfs_rename);
-static decl_subsys(debug, NULL, NULL);
+static decl_subsys(debug, NULL);
static int __init debugfs_init(void)
{
int retval;
- kobj_set_kset_s(&debug_subsys, kernel_subsys);
+ debug_subsys.kobj.kset = &kernel_subsys;
retval = subsystem_register(&debug_subsys);
if (retval)
return retval;
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 6353a838452..18e4a17b9be 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -166,9 +166,7 @@ static struct kobj_type dlm_ktype = {
.release = lockspace_kobj_release,
};
-static struct kset dlm_kset = {
- .ktype = &dlm_ktype,
-};
+static struct kset dlm_kset;
static int kobject_setup(struct dlm_ls *ls)
{
@@ -228,7 +226,7 @@ int dlm_lockspace_init(void)
spin_lock_init(&lslist_lock);
kobject_set_name(&dlm_kset.kobj, "dlm");
- kobj_set_kset_s(&dlm_kset, kernel_subsys);
+ dlm_kset.kobj.kset = &kernel_subsys;
error = kset_register(&dlm_kset);
if (error)
printk("dlm_lockspace_init: cannot register kset %d\n", error);
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index f9f32472c50..fe2f44fa17c 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -734,7 +734,7 @@ static int ecryptfs_init_kmem_caches(void)
return 0;
}
-static decl_subsys(ecryptfs, NULL, NULL);
+static decl_subsys(ecryptfs, NULL);
static ssize_t version_show(struct kset *kset, char *buff)
{
@@ -798,6 +798,7 @@ static int do_sysfs_registration(void)
{
int rc;
+ ecryptfs_subsys.kobj.kset = &fs_subsys;
rc = subsystem_register(&ecryptfs_subsys);
if (rc) {
printk(KERN_ERR
@@ -845,7 +846,6 @@ static int __init ecryptfs_init(void)
printk(KERN_ERR "Failed to register filesystem\n");
goto out_free_kmem_caches;
}
- kobj_set_kset_s(&ecryptfs_subsys, fs_subsys);
rc = do_sysfs_registration();
if (rc) {
printk(KERN_ERR "sysfs registration failed\n");
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 84f9f7dfdf5..f5e4182c482 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -744,8 +744,8 @@ static inline void unregister_fuseblk(void)
}
#endif
-static decl_subsys(fuse, NULL, NULL);
-static decl_subsys(connections, NULL, NULL);
+static decl_subsys(fuse, NULL);
+static decl_subsys(connections, NULL);
static void fuse_inode_init_once(struct kmem_cache *cachep, void *foo)
{
@@ -795,12 +795,12 @@ static int fuse_sysfs_init(void)
{
int err;
- kobj_set_kset_s(&fuse_subsys, fs_subsys);
+ fuse_subsys.kobj.kset = &fs_subsys;
err = subsystem_register(&fuse_subsys);
if (err)
goto out_err;
- kobj_set_kset_s(&connections_subsys, fuse_subsys);
+ connections_subsys.kobj.kset = &fuse_subsys;
err = subsystem_register(&connections_subsys);
if (err)
goto out_fuse_unregister;
diff --git a/fs/gfs2/locking/dlm/sysfs.c b/fs/gfs2/locking/dlm/sysfs.c
index ae9e6a25fe2..93e66b22757 100644
--- a/fs/gfs2/locking/dlm/sysfs.c
+++ b/fs/gfs2/locking/dlm/sysfs.c
@@ -189,9 +189,7 @@ static struct kobj_type gdlm_ktype = {
.sysfs_ops = &gdlm_attr_ops,
};
-static struct kset gdlm_kset = {
- .ktype = &gdlm_ktype,
-};
+static struct kset gdlm_kset;
int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj)
{
@@ -224,7 +222,7 @@ int gdlm_sysfs_init(void)
int error;
kobject_set_name(&gdlm_kset.kobj, "lock_dlm");
- kobj_set_kset_s(&gdlm_kset, kernel_subsys);
+ gdlm_kset.kobj.kset = &kernel_subsys;
error = kset_register(&gdlm_kset);
if (error)
printk("lock_dlm: cannot register kset %d\n", error);
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 06e0b7768d9..d7fa54443f0 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -221,9 +221,7 @@ static struct kobj_type gfs2_ktype = {
.sysfs_ops = &gfs2_attr_ops,
};
-static struct kset gfs2_kset = {
- .ktype = &gfs2_ktype,
-};
+static struct kset gfs2_kset;
/*
* display struct lm_lockstruct fields
@@ -551,7 +549,7 @@ int gfs2_sys_init(void)
gfs2_sys_margs = NULL;
spin_lock_init(&gfs2_sys_margs_lock);
kobject_set_name(&gfs2_kset.kobj, "gfs2");
- kobj_set_kset_s(&gfs2_kset, fs_subsys);
+ gfs2_kset.kobj.kset = &fs_subsys;
return kset_register(&gfs2_kset);
}
diff --git a/fs/namespace.c b/fs/namespace.c
index 06083885b21..a4a3f70e7e2 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -41,7 +41,7 @@ static struct kmem_cache *mnt_cache __read_mostly;
static struct rw_semaphore namespace_sem;
/* /sys/fs */
-decl_subsys(fs, NULL, NULL);
+decl_subsys(fs, NULL);
EXPORT_SYMBOL_GPL(fs_subsys);
static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry)
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index a4882c8df94..dead319932b 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -157,7 +157,7 @@ int mlog_sys_init(struct kset *o2cb_subsys)
mlog_attr_ptrs[i] = NULL;
kobject_set_name(&mlog_kset.kobj, "logmask");
- kobj_set_kset_s(&mlog_kset, *o2cb_subsys);
+ mlog_kset.kobj.kset = o2cb_subsys;
return kset_register(&mlog_kset);
}
diff --git a/fs/ocfs2/cluster/sys.c b/fs/ocfs2/cluster/sys.c
index 64f6f378fd0..880d0138bb0 100644
--- a/fs/ocfs2/cluster/sys.c
+++ b/fs/ocfs2/cluster/sys.c
@@ -72,7 +72,7 @@ static struct kobj_type o2cb_subsys_type = {
};
/* gives us o2cb_subsys */
-static decl_subsys(o2cb, NULL, NULL);
+static decl_subsys(o2cb, NULL);
static ssize_t
o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer)
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 09a0611b336..387a6366279 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -365,9 +365,7 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
/* if the kobject has no ktype, then we assume that it is a subsystem
* itself, and use ops for it.
*/
- if (kobj->kset && kobj->kset->ktype)
- ops = kobj->kset->ktype->sysfs_ops;
- else if (kobj->ktype)
+ if (kobj->ktype)
ops = kobj->ktype->sysfs_ops;
else
ops = &subsys_sysfs_ops;