aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2015-05-13 18:35:41 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-07-21 13:10:01 -0400
commit28dd1f346b2f0fc2ab8285046ed0bd91e9b808d3 (patch)
tree7c2a4337b103067684f0345283d19c8e8e62afb2 /fs
parent9924f6e89823a41bfd272ab759636276b9f9ee9c (diff)
sysfs: Create mountpoints with sysfs_create_mount_point
commit f9bb48825a6b5d02f4cabcc78967c75db903dcdc upstream. This allows for better documentation in the code and it allows for a simpler and fully correct version of fs_fully_visible to be written. The mount points converted and their filesystems are: /sys/hypervisor/s390/ s390_hypfs /sys/kernel/config/ configfs /sys/kernel/debug/ debugfs /sys/firmware/efi/efivars/ efivarfs /sys/fs/fuse/connections/ fusectl /sys/fs/pstore/ pstore /sys/kernel/tracing/ tracefs /sys/fs/cgroup/ cgroup /sys/kernel/security/ securityfs /sys/fs/selinux/ selinuxfs /sys/fs/smackfs/ smackfs Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/configfs/mount.c10
-rw-r--r--fs/debugfs/inode.c11
-rw-r--r--fs/fuse/inode.c9
-rw-r--r--fs/pstore/inode.c12
-rw-r--r--fs/tracefs/inode.c6
5 files changed, 17 insertions, 31 deletions
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c
index 537356742091..a8f3b589a2df 100644
--- a/fs/configfs/mount.c
+++ b/fs/configfs/mount.c
@@ -129,8 +129,6 @@ void configfs_release_fs(void)
129} 129}
130 130
131 131
132static struct kobject *config_kobj;
133
134static int __init configfs_init(void) 132static int __init configfs_init(void)
135{ 133{
136 int err = -ENOMEM; 134 int err = -ENOMEM;
@@ -141,8 +139,8 @@ static int __init configfs_init(void)
141 if (!configfs_dir_cachep) 139 if (!configfs_dir_cachep)
142 goto out; 140 goto out;
143 141
144 config_kobj = kobject_create_and_add("config", kernel_kobj); 142 err = sysfs_create_mount_point(kernel_kobj, "config");
145 if (!config_kobj) 143 if (err)
146 goto out2; 144 goto out2;
147 145
148 err = register_filesystem(&configfs_fs_type); 146 err = register_filesystem(&configfs_fs_type);
@@ -152,7 +150,7 @@ static int __init configfs_init(void)
152 return 0; 150 return 0;
153out3: 151out3:
154 pr_err("Unable to register filesystem!\n"); 152 pr_err("Unable to register filesystem!\n");
155 kobject_put(config_kobj); 153 sysfs_remove_mount_point(kernel_kobj, "config");
156out2: 154out2:
157 kmem_cache_destroy(configfs_dir_cachep); 155 kmem_cache_destroy(configfs_dir_cachep);
158 configfs_dir_cachep = NULL; 156 configfs_dir_cachep = NULL;
@@ -163,7 +161,7 @@ out:
163static void __exit configfs_exit(void) 161static void __exit configfs_exit(void)
164{ 162{
165 unregister_filesystem(&configfs_fs_type); 163 unregister_filesystem(&configfs_fs_type);
166 kobject_put(config_kobj); 164 sysfs_remove_mount_point(kernel_kobj, "config");
167 kmem_cache_destroy(configfs_dir_cachep); 165 kmem_cache_destroy(configfs_dir_cachep);
168 configfs_dir_cachep = NULL; 166 configfs_dir_cachep = NULL;
169} 167}
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index c1e7ffb0dab6..12756040ca20 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -716,20 +716,17 @@ bool debugfs_initialized(void)
716} 716}
717EXPORT_SYMBOL_GPL(debugfs_initialized); 717EXPORT_SYMBOL_GPL(debugfs_initialized);
718 718
719
720static struct kobject *debug_kobj;
721
722static int __init debugfs_init(void) 719static int __init debugfs_init(void)
723{ 720{
724 int retval; 721 int retval;
725 722
726 debug_kobj = kobject_create_and_add("debug", kernel_kobj); 723 retval = sysfs_create_mount_point(kernel_kobj, "debug");
727 if (!debug_kobj) 724 if (retval)
728 return -EINVAL; 725 return retval;
729 726
730 retval = register_filesystem(&debug_fs_type); 727 retval = register_filesystem(&debug_fs_type);
731 if (retval) 728 if (retval)
732 kobject_put(debug_kobj); 729 sysfs_remove_mount_point(kernel_kobj, "debug");
733 else 730 else
734 debugfs_registered = true; 731 debugfs_registered = true;
735 732
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 082ac1c97f39..18dacf9ed8ff 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1238,7 +1238,6 @@ static void fuse_fs_cleanup(void)
1238} 1238}
1239 1239
1240static struct kobject *fuse_kobj; 1240static struct kobject *fuse_kobj;
1241static struct kobject *connections_kobj;
1242 1241
1243static int fuse_sysfs_init(void) 1242static int fuse_sysfs_init(void)
1244{ 1243{
@@ -1250,11 +1249,9 @@ static int fuse_sysfs_init(void)
1250 goto out_err; 1249 goto out_err;
1251 } 1250 }
1252 1251
1253 connections_kobj = kobject_create_and_add("connections", fuse_kobj); 1252 err = sysfs_create_mount_point(fuse_kobj, "connections");
1254 if (!connections_kobj) { 1253 if (err)
1255 err = -ENOMEM;
1256 goto out_fuse_unregister; 1254 goto out_fuse_unregister;
1257 }
1258 1255
1259 return 0; 1256 return 0;
1260 1257
@@ -1266,7 +1263,7 @@ static int fuse_sysfs_init(void)
1266 1263
1267static void fuse_sysfs_cleanup(void) 1264static void fuse_sysfs_cleanup(void)
1268{ 1265{
1269 kobject_put(connections_kobj); 1266 sysfs_remove_mount_point(fuse_kobj, "connections");
1270 kobject_put(fuse_kobj); 1267 kobject_put(fuse_kobj);
1271} 1268}
1272 1269
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c
index dc43b5f29305..3adcc4669fac 100644
--- a/fs/pstore/inode.c
+++ b/fs/pstore/inode.c
@@ -461,22 +461,18 @@ static struct file_system_type pstore_fs_type = {
461 .kill_sb = pstore_kill_sb, 461 .kill_sb = pstore_kill_sb,
462}; 462};
463 463
464static struct kobject *pstore_kobj;
465
466static int __init init_pstore_fs(void) 464static int __init init_pstore_fs(void)
467{ 465{
468 int err = 0; 466 int err;
469 467
470 /* Create a convenient mount point for people to access pstore */ 468 /* Create a convenient mount point for people to access pstore */
471 pstore_kobj = kobject_create_and_add("pstore", fs_kobj); 469 err = sysfs_create_mount_point(fs_kobj, "pstore");
472 if (!pstore_kobj) { 470 if (err)
473 err = -ENOMEM;
474 goto out; 471 goto out;
475 }
476 472
477 err = register_filesystem(&pstore_fs_type); 473 err = register_filesystem(&pstore_fs_type);
478 if (err < 0) 474 if (err < 0)
479 kobject_put(pstore_kobj); 475 sysfs_remove_mount_point(fs_kobj, "pstore");
480 476
481out: 477out:
482 return err; 478 return err;
diff --git a/fs/tracefs/inode.c b/fs/tracefs/inode.c
index d92bdf3b079a..a43df11a163f 100644
--- a/fs/tracefs/inode.c
+++ b/fs/tracefs/inode.c
@@ -631,14 +631,12 @@ bool tracefs_initialized(void)
631 return tracefs_registered; 631 return tracefs_registered;
632} 632}
633 633
634static struct kobject *trace_kobj;
635
636static int __init tracefs_init(void) 634static int __init tracefs_init(void)
637{ 635{
638 int retval; 636 int retval;
639 637
640 trace_kobj = kobject_create_and_add("tracing", kernel_kobj); 638 retval = sysfs_create_mount_point(kernel_kobj, "tracing");
641 if (!trace_kobj) 639 if (retval)
642 return -EINVAL; 640 return -EINVAL;
643 641
644 retval = register_filesystem(&trace_fs_type); 642 retval = register_filesystem(&trace_fs_type);