• Eric W. Biederman's avatar
    sysfs: Shadow directory support · b592fcfe
    Eric W. Biederman authored
    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: default avatarEric W. Biederman <ebiederm@xmission.com>
    Cc: Maneesh Soni <maneesh@in.ibm.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
    b592fcfe
mount.c 2.64 KB