public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Since sysfs_mount is static and used only in sysfs_init function, it could be just an automatic variable.
@ 2007-12-01 20:31 rae l
  2007-12-02  4:48 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: rae l @ 2007-12-01 20:31 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh

---
and I still have questions about this code:
1. Why here kern_mount is needed?
	Or the first time user space `mount -t sysfs` won't do that?
2. If root executes many mounts to mount sysfs on /sys and many other places,
	are there many instances of struct vfsmount those have only
mnt_mountpoint different?

	For most common case, mount a virtual filesystem(proc, sysfs, ...) on
multiple mounting point,
	how to handle it more efficiently?

and where is a detailed explaination on kern_mount? could someone give
some comments or documentation pointers on this?

diff --git a/fs/sysfs/mount.c b/fs/sysfs/mount.c
index 7416826..add0dda 100644
--- a/fs/sysfs/mount.c
+++ b/fs/sysfs/mount.c
@@ -22,7 +22,6 @@
 /* Random magic number */
 #define SYSFS_MAGIC 0x62656572

-static struct vfsmount *sysfs_mount;
 struct super_block * sysfs_sb = NULL;
 struct kmem_cache *sysfs_dir_cachep;

@@ -98,11 +97,10 @@ int __init sysfs_init(void)

 	err = register_filesystem(&sysfs_fs_type);
 	if (!err) {
-		sysfs_mount = kern_mount(&sysfs_fs_type);
+		struct vfsmount *sysfs_mount = kern_mount(&sysfs_fs_type);
 		if (IS_ERR(sysfs_mount)) {
 			printk(KERN_ERR "sysfs: could not mount!\n");
 			err = PTR_ERR(sysfs_mount);
-			sysfs_mount = NULL;
 			unregister_filesystem(&sysfs_fs_type);
 			goto out_err;
 		}

-- 
Denis Cheng

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-12-03  1:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-01 20:31 Since sysfs_mount is static and used only in sysfs_init function, it could be just an automatic variable rae l
2007-12-02  4:48 ` Greg KH
2007-12-02  6:52   ` rae l
2007-12-02  7:54     ` Greg KH
2007-12-02 22:22       ` Eric W. Biederman
2007-12-02 22:53         ` Greg KH
2007-12-03  0:46           ` Kay Sievers
2007-12-03  1:33             ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox