aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-10-16 12:11:44 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:10 -0500
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 3bf0278ea843..374ddbd6648d 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -128,7 +128,7 @@ void configfs_release_fs(void)
128} 128}
129 129
130 130
131static decl_subsys(config, NULL, NULL); 131static decl_subsys(config, NULL);
132 132
133static int __init configfs_init(void) 133static int __init configfs_init(void)
134{ 134{
@@ -140,7 +140,7 @@ static int __init configfs_init(void)
140 if (!configfs_dir_cachep) 140 if (!configfs_dir_cachep)
141 goto out; 141 goto out;
142 142
143 kobj_set_kset_s(&config_subsys, kernel_subsys); 143 config_subsys.kobj.kset = &kernel_subsys;
144 err = subsystem_register(&config_subsys); 144 err = subsystem_register(&config_subsys);
145 if (err) { 145 if (err) {
146 kmem_cache_destroy(configfs_dir_cachep); 146 kmem_cache_destroy(configfs_dir_cachep);
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 6a713b33992f..f7f13516fc1a 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -426,13 +426,13 @@ exit:
426} 426}
427EXPORT_SYMBOL_GPL(debugfs_rename); 427EXPORT_SYMBOL_GPL(debugfs_rename);
428 428
429static decl_subsys(debug, NULL, NULL); 429static decl_subsys(debug, NULL);
430 430
431static int __init debugfs_init(void) 431static int __init debugfs_init(void)
432{ 432{
433 int retval; 433 int retval;
434 434
435 kobj_set_kset_s(&debug_subsys, kernel_subsys); 435 debug_subsys.kobj.kset = &kernel_subsys;
436 retval = subsystem_register(&debug_subsys); 436 retval = subsystem_register(&debug_subsys);
437 if (retval) 437 if (retval)
438 return retval; 438 return retval;
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 6353a8384520..18e4a17b9bee 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -166,9 +166,7 @@ static struct kobj_type dlm_ktype = {
166 .release = lockspace_kobj_release, 166 .release = lockspace_kobj_release,
167}; 167};
168 168
169static struct kset dlm_kset = { 169static struct kset dlm_kset;
170 .ktype = &dlm_ktype,
171};
172 170
173static int kobject_setup(struct dlm_ls *ls) 171static int kobject_setup(struct dlm_ls *ls)
174{ 172{
@@ -228,7 +226,7 @@ int dlm_lockspace_init(void)
228 spin_lock_init(&lslist_lock); 226 spin_lock_init(&lslist_lock);
229 227
230 kobject_set_name(&dlm_kset.kobj, "dlm"); 228 kobject_set_name(&dlm_kset.kobj, "dlm");
231 kobj_set_kset_s(&dlm_kset, kernel_subsys); 229 dlm_kset.kobj.kset = &kernel_subsys;
232 error = kset_register(&dlm_kset); 230 error = kset_register(&dlm_kset);
233 if (error) 231 if (error)
234 printk("dlm_lockspace_init: cannot register kset %d\n", error); 232 printk("dlm_lockspace_init: cannot register kset %d\n", error);
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index f9f32472c505..fe2f44fa17cc 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -734,7 +734,7 @@ static int ecryptfs_init_kmem_caches(void)
734 return 0; 734 return 0;
735} 735}
736 736
737static decl_subsys(ecryptfs, NULL, NULL); 737static decl_subsys(ecryptfs, NULL);
738 738
739static ssize_t version_show(struct kset *kset, char *buff) 739static ssize_t version_show(struct kset *kset, char *buff)
740{ 740{
@@ -798,6 +798,7 @@ static int do_sysfs_registration(void)
798{ 798{
799 int rc; 799 int rc;
800 800
801 ecryptfs_subsys.kobj.kset = &fs_subsys;
801 rc = subsystem_register(&ecryptfs_subsys); 802 rc = subsystem_register(&ecryptfs_subsys);
802 if (rc) { 803 if (rc) {
803 printk(KERN_ERR 804 printk(KERN_ERR
@@ -845,7 +846,6 @@ static int __init ecryptfs_init(void)
845 printk(KERN_ERR "Failed to register filesystem\n"); 846 printk(KERN_ERR "Failed to register filesystem\n");
846 goto out_free_kmem_caches; 847 goto out_free_kmem_caches;
847 } 848 }
848 kobj_set_kset_s(&ecryptfs_subsys, fs_subsys);
849 rc = do_sysfs_registration(); 849 rc = do_sysfs_registration();
850 if (rc) { 850 if (rc) {
851 printk(KERN_ERR "sysfs registration failed\n"); 851 printk(KERN_ERR "sysfs registration failed\n");
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 84f9f7dfdf5b..f5e4182c482e 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -744,8 +744,8 @@ static inline void unregister_fuseblk(void)
744} 744}
745#endif 745#endif
746 746
747static decl_subsys(fuse, NULL, NULL); 747static decl_subsys(fuse, NULL);
748static decl_subsys(connections, NULL, NULL); 748static decl_subsys(connections, NULL);
749 749
750static void fuse_inode_init_once(struct kmem_cache *cachep, void *foo) 750static void fuse_inode_init_once(struct kmem_cache *cachep, void *foo)
751{ 751{
@@ -795,12 +795,12 @@ static int fuse_sysfs_init(void)
795{ 795{
796 int err; 796 int err;
797 797
798 kobj_set_kset_s(&fuse_subsys, fs_subsys); 798 fuse_subsys.kobj.kset = &fs_subsys;
799 err = subsystem_register(&fuse_subsys); 799 err = subsystem_register(&fuse_subsys);
800 if (err) 800 if (err)
801 goto out_err; 801 goto out_err;
802 802
803 kobj_set_kset_s(&connections_subsys, fuse_subsys); 803 connections_subsys.kobj.kset = &fuse_subsys;
804 err = subsystem_register(&connections_subsys); 804 err = subsystem_register(&connections_subsys);
805 if (err) 805 if (err)
806 goto out_fuse_unregister; 806 goto out_fuse_unregister;
diff --git a/fs/gfs2/locking/dlm/sysfs.c b/fs/gfs2/locking/dlm/sysfs.c
index ae9e6a25fe2b..93e66b22757f 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 = {
189 .sysfs_ops = &gdlm_attr_ops, 189 .sysfs_ops = &gdlm_attr_ops,
190}; 190};
191 191
192static struct kset gdlm_kset = { 192static struct kset gdlm_kset;
193 .ktype = &gdlm_ktype,
194};
195 193
196int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj) 194int gdlm_kobject_setup(struct gdlm_ls *ls, struct kobject *fskobj)
197{ 195{
@@ -224,7 +222,7 @@ int gdlm_sysfs_init(void)
224 int error; 222 int error;
225 223
226 kobject_set_name(&gdlm_kset.kobj, "lock_dlm"); 224 kobject_set_name(&gdlm_kset.kobj, "lock_dlm");
227 kobj_set_kset_s(&gdlm_kset, kernel_subsys); 225 gdlm_kset.kobj.kset = &kernel_subsys;
228 error = kset_register(&gdlm_kset); 226 error = kset_register(&gdlm_kset);
229 if (error) 227 if (error)
230 printk("lock_dlm: cannot register kset %d\n", error); 228 printk("lock_dlm: cannot register kset %d\n", error);
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 06e0b7768d97..d7fa54443f0c 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -221,9 +221,7 @@ static struct kobj_type gfs2_ktype = {
221 .sysfs_ops = &gfs2_attr_ops, 221 .sysfs_ops = &gfs2_attr_ops,
222}; 222};
223 223
224static struct kset gfs2_kset = { 224static struct kset gfs2_kset;
225 .ktype = &gfs2_ktype,
226};
227 225
228/* 226/*
229 * display struct lm_lockstruct fields 227 * display struct lm_lockstruct fields
@@ -551,7 +549,7 @@ int gfs2_sys_init(void)
551 gfs2_sys_margs = NULL; 549 gfs2_sys_margs = NULL;
552 spin_lock_init(&gfs2_sys_margs_lock); 550 spin_lock_init(&gfs2_sys_margs_lock);
553 kobject_set_name(&gfs2_kset.kobj, "gfs2"); 551 kobject_set_name(&gfs2_kset.kobj, "gfs2");
554 kobj_set_kset_s(&gfs2_kset, fs_subsys); 552 gfs2_kset.kobj.kset = &fs_subsys;
555 return kset_register(&gfs2_kset); 553 return kset_register(&gfs2_kset);
556} 554}
557 555
diff --git a/fs/namespace.c b/fs/namespace.c
index 06083885b21e..a4a3f70e7e26 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -41,7 +41,7 @@ static struct kmem_cache *mnt_cache __read_mostly;
41static struct rw_semaphore namespace_sem; 41static struct rw_semaphore namespace_sem;
42 42
43/* /sys/fs */ 43/* /sys/fs */
44decl_subsys(fs, NULL, NULL); 44decl_subsys(fs, NULL);
45EXPORT_SYMBOL_GPL(fs_subsys); 45EXPORT_SYMBOL_GPL(fs_subsys);
46 46
47static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry) 47static 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 a4882c8df945..dead319932b3 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)
157 mlog_attr_ptrs[i] = NULL; 157 mlog_attr_ptrs[i] = NULL;
158 158
159 kobject_set_name(&mlog_kset.kobj, "logmask"); 159 kobject_set_name(&mlog_kset.kobj, "logmask");
160 kobj_set_kset_s(&mlog_kset, *o2cb_subsys); 160 mlog_kset.kobj.kset = o2cb_subsys;
161 return kset_register(&mlog_kset); 161 return kset_register(&mlog_kset);
162} 162}
163 163
diff --git a/fs/ocfs2/cluster/sys.c b/fs/ocfs2/cluster/sys.c
index 64f6f378fd09..880d0138bb0a 100644
--- a/fs/ocfs2/cluster/sys.c
+++ b/fs/ocfs2/cluster/sys.c
@@ -72,7 +72,7 @@ static struct kobj_type o2cb_subsys_type = {
72}; 72};
73 73
74/* gives us o2cb_subsys */ 74/* gives us o2cb_subsys */
75static decl_subsys(o2cb, NULL, NULL); 75static decl_subsys(o2cb, NULL);
76 76
77static ssize_t 77static ssize_t
78o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer) 78o2cb_show(struct kobject * kobj, struct attribute * attr, char * buffer)
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index 09a0611b3364..387a63662793 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)
365 /* if the kobject has no ktype, then we assume that it is a subsystem 365 /* if the kobject has no ktype, then we assume that it is a subsystem
366 * itself, and use ops for it. 366 * itself, and use ops for it.
367 */ 367 */
368 if (kobj->kset && kobj->kset->ktype) 368 if (kobj->ktype)
369 ops = kobj->kset->ktype->sysfs_ops;
370 else if (kobj->ktype)
371 ops = kobj->ktype->sysfs_ops; 369 ops = kobj->ktype->sysfs_ops;
372 else 370 else
373 ops = &subsys_sysfs_ops; 371 ops = &subsys_sysfs_ops;