WSL2-Linux-Kernel/fs/sysfs
Eric W. Biederman b592fcfe7f sysfs: Shadow directory support
The problem.  When implementing a network namespace I need to be able
to have multiple network devices with the same name.  Currently this
is a problem for /sys/class/net/*. 

What I want is a separate /sys/class/net directory in sysfs for each
network namespace, and I want to name each of them /sys/class/net.

I looked and the VFS actually allows that.  All that is needed is
for /sys/class/net to implement a follow link method to redirect
lookups to the real directory you want. 

Implementing a follow link method that is sensitive to the current
network namespace turns out to be 3 lines of code so it looks like a
clean approach.  Modifying sysfs so it doesn't get in my was is a bit
trickier. 

I am calling the concept of multiple directories all at the same path
in the filesystem shadow directories.  With the directory entry really
at that location the shadow master. 

The following patch modifies sysfs so it can handle a directory
structure slightly different from the kobject tree so I can implement
the shadow directories for handling /sys/class/net/.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-02-07 10:37:14 -08:00
..
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
bin.c sysfs: kobject_put cleanup 2007-02-07 10:37:13 -08:00
dir.c sysfs: Shadow directory support 2007-02-07 10:37:14 -08:00
file.c sysfs: error handling in sysfs, fill_read_buffer() 2007-02-07 10:37:13 -08:00
group.c sysfs: Shadow directory support 2007-02-07 10:37:14 -08:00
inode.c sysfs: Shadow directory support 2007-02-07 10:37:14 -08:00
mount.c sysfs: Shadow directory support 2007-02-07 10:37:14 -08:00
symlink.c Driver core: fix race in sysfs between sysfs_remove_file() and read()/write() 2007-02-07 10:37:13 -08:00
sysfs.h sysfs: Shadow directory support 2007-02-07 10:37:14 -08:00