diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-29 15:13:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:14 -0500 |
commit | bd35b93d8049ab47b5bfaf6b10ba39badf21d1c3 (patch) | |
tree | bac82e14d960b2c7011b7f660a93f07e922f8a97 | |
parent | e5e38a86c0bbe8475543f10f0a48393a45df5182 (diff) |
kset: convert kernel_subsys to use kset_create
Dynamically create the kset instead of declaring it statically. We also
rename kernel_subsys to kernel_kset to catch all users of this symbol
with a build error instead of an easy-to-ignore build warning.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | fs/configfs/mount.c | 2 | ||||
-rw-r--r-- | fs/debugfs/inode.c | 2 | ||||
-rw-r--r-- | fs/dlm/lockspace.c | 2 | ||||
-rw-r--r-- | fs/gfs2/locking/dlm/sysfs.c | 3 | ||||
-rw-r--r-- | include/linux/kobject.h | 4 | ||||
-rw-r--r-- | kernel/ksysfs.c | 42 | ||||
-rw-r--r-- | kernel/user.c | 4 | ||||
-rw-r--r-- | security/inode.c | 2 |
8 files changed, 39 insertions, 22 deletions
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index 13300466464b..c4ee7f05de8b 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
@@ -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 | config_kobj = kobject_create_and_add("config", &kernel_subsys.kobj); | 143 | config_kobj = kobject_create_and_add("config", &kernel_kset->kobj); |
144 | if (!config_kobj) { | 144 | if (!config_kobj) { |
145 | kmem_cache_destroy(configfs_dir_cachep); | 145 | kmem_cache_destroy(configfs_dir_cachep); |
146 | configfs_dir_cachep = NULL; | 146 | configfs_dir_cachep = NULL; |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 667214200b03..5ce92c3d3b59 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -432,7 +432,7 @@ static int __init debugfs_init(void) | |||
432 | { | 432 | { |
433 | int retval; | 433 | int retval; |
434 | 434 | ||
435 | debug_kobj = kobject_create_and_add("debug", &kernel_subsys.kobj); | 435 | debug_kobj = kobject_create_and_add("debug", &kernel_kset->kobj); |
436 | if (!debug_kobj) | 436 | if (!debug_kobj) |
437 | return -EINVAL; | 437 | return -EINVAL; |
438 | 438 | ||
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c index 83a9c4dd5114..0828beb2d35d 100644 --- a/fs/dlm/lockspace.c +++ b/fs/dlm/lockspace.c | |||
@@ -223,7 +223,7 @@ int dlm_lockspace_init(void) | |||
223 | INIT_LIST_HEAD(&lslist); | 223 | INIT_LIST_HEAD(&lslist); |
224 | spin_lock_init(&lslist_lock); | 224 | spin_lock_init(&lslist_lock); |
225 | 225 | ||
226 | dlm_kset = kset_create_and_add("dlm", NULL, &kernel_subsys.kobj); | 226 | dlm_kset = kset_create_and_add("dlm", NULL, &kernel_kset->kobj); |
227 | if (!dlm_kset) { | 227 | if (!dlm_kset) { |
228 | printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__); | 228 | printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__); |
229 | return -ENOMEM; | 229 | return -ENOMEM; |
diff --git a/fs/gfs2/locking/dlm/sysfs.c b/fs/gfs2/locking/dlm/sysfs.c index 0a8614088ec6..1a92b6f7bc10 100644 --- a/fs/gfs2/locking/dlm/sysfs.c +++ b/fs/gfs2/locking/dlm/sysfs.c | |||
@@ -219,8 +219,7 @@ void gdlm_kobject_release(struct gdlm_ls *ls) | |||
219 | 219 | ||
220 | int gdlm_sysfs_init(void) | 220 | int gdlm_sysfs_init(void) |
221 | { | 221 | { |
222 | gdlm_kset = kset_create_and_add("lock_dlm", NULL, | 222 | gdlm_kset = kset_create_and_add("lock_dlm", NULL, &kernel_kset->kobj); |
223 | &kernel_subsys.kobj); | ||
224 | if (!gdlm_kset) { | 223 | if (!gdlm_kset) { |
225 | printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__); | 224 | printk(KERN_WARNING "%s: can not create kset\n", __FUNCTION__); |
226 | return -ENOMEM; | 225 | return -ENOMEM; |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 390ae14b73e8..bd741e86c11e 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -194,8 +194,8 @@ struct kset _name##_subsys = { \ | |||
194 | .uevent_ops =_uevent_ops, \ | 194 | .uevent_ops =_uevent_ops, \ |
195 | } | 195 | } |
196 | 196 | ||
197 | /* The global /sys/kernel/ subsystem for people to chain off of */ | 197 | /* The global /sys/kernel/ kset for people to chain off of */ |
198 | extern struct kset kernel_subsys; | 198 | extern struct kset *kernel_kset; |
199 | /* The global /sys/hypervisor/ subsystem */ | 199 | /* The global /sys/hypervisor/ subsystem */ |
200 | extern struct kset hypervisor_subsys; | 200 | extern struct kset hypervisor_subsys; |
201 | 201 | ||
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index 094e2bc101a8..cf02d4ba9add 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c | |||
@@ -94,8 +94,8 @@ static struct bin_attribute notes_attr = { | |||
94 | .read = ¬es_read, | 94 | .read = ¬es_read, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | decl_subsys(kernel, NULL); | 97 | struct kset *kernel_kset; |
98 | EXPORT_SYMBOL_GPL(kernel_subsys); | 98 | EXPORT_SYMBOL_GPL(kernel_kset); |
99 | 99 | ||
100 | static struct attribute * kernel_attrs[] = { | 100 | static struct attribute * kernel_attrs[] = { |
101 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) | 101 | #if defined(CONFIG_HOTPLUG) && defined(CONFIG_NET) |
@@ -116,24 +116,42 @@ static struct attribute_group kernel_attr_group = { | |||
116 | 116 | ||
117 | static int __init ksysfs_init(void) | 117 | static int __init ksysfs_init(void) |
118 | { | 118 | { |
119 | int error = subsystem_register(&kernel_subsys); | 119 | int error; |
120 | if (!error) | ||
121 | error = sysfs_create_group(&kernel_subsys.kobj, | ||
122 | &kernel_attr_group); | ||
123 | 120 | ||
124 | if (!error && notes_size > 0) { | 121 | kernel_kset = kset_create_and_add("kernel", NULL, NULL); |
122 | if (!kernel_kset) { | ||
123 | error = -ENOMEM; | ||
124 | goto exit; | ||
125 | } | ||
126 | error = sysfs_create_group(&kernel_kset->kobj, &kernel_attr_group); | ||
127 | if (error) | ||
128 | goto kset_exit; | ||
129 | |||
130 | if (notes_size > 0) { | ||
125 | notes_attr.size = notes_size; | 131 | notes_attr.size = notes_size; |
126 | error = sysfs_create_bin_file(&kernel_subsys.kobj, | 132 | error = sysfs_create_bin_file(&kernel_kset->kobj, ¬es_attr); |
127 | ¬es_attr); | 133 | if (error) |
134 | goto group_exit; | ||
128 | } | 135 | } |
129 | 136 | ||
130 | /* | 137 | /* |
131 | * Create "/sys/kernel/uids" directory and corresponding root user's | 138 | * Create "/sys/kernel/uids" directory and corresponding root user's |
132 | * directory under it. | 139 | * directory under it. |
133 | */ | 140 | */ |
134 | if (!error) | 141 | error = uids_kobject_init(); |
135 | error = uids_kobject_init(); | 142 | if (error) |
136 | 143 | goto notes_exit; | |
144 | |||
145 | return 0; | ||
146 | |||
147 | notes_exit: | ||
148 | if (notes_size > 0) | ||
149 | sysfs_remove_bin_file(&kernel_kset->kobj, ¬es_attr); | ||
150 | group_exit: | ||
151 | sysfs_remove_group(&kernel_kset->kobj, &kernel_attr_group); | ||
152 | kset_exit: | ||
153 | kset_unregister(kernel_kset); | ||
154 | exit: | ||
137 | return error; | 155 | return error; |
138 | } | 156 | } |
139 | 157 | ||
diff --git a/kernel/user.c b/kernel/user.c index 8320a87f3e5a..80f1116b8fcd 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
@@ -198,8 +198,8 @@ int __init uids_kobject_init(void) | |||
198 | int error; | 198 | int error; |
199 | 199 | ||
200 | /* create under /sys/kernel dir */ | 200 | /* create under /sys/kernel dir */ |
201 | uids_kobject.parent = &kernel_subsys.kobj; | 201 | uids_kobject.parent = &kernel_kset->kobj; |
202 | uids_kobject.kset = &kernel_subsys; | 202 | uids_kobject.kset = kernel_kset; |
203 | kobject_set_name(&uids_kobject, "uids"); | 203 | kobject_set_name(&uids_kobject, "uids"); |
204 | kobject_init(&uids_kobject); | 204 | kobject_init(&uids_kobject); |
205 | 205 | ||
diff --git a/security/inode.c b/security/inode.c index dfc5978d4298..dbe040ac0549 100644 --- a/security/inode.c +++ b/security/inode.c | |||
@@ -321,7 +321,7 @@ static int __init securityfs_init(void) | |||
321 | { | 321 | { |
322 | int retval; | 322 | int retval; |
323 | 323 | ||
324 | security_kobj = kobject_create_and_add("security", &kernel_subsys.kobj); | 324 | security_kobj = kobject_create_and_add("security", &kernel_kset->kobj); |
325 | if (!security_kobj) | 325 | if (!security_kobj) |
326 | return -EINVAL; | 326 | return -EINVAL; |
327 | 327 | ||