linux/Documentation/filesystems/sysfs-tagging.txt
<<
ue="1" /spa3.1 1" /form.1 1" a ue="1" href="../linux+v3.7.2/Documenta="v3/filesystems/sysfs-tagging.txt">ue="1" img src="../.sta="c/gfx/right.png" alt=">>">ue /spa3.1ue spa3 class="lxr_search">ue="ue="1" input typ4.2hidden" nam4.2navtarget" v3.14.2">ue="1" input typ4.2text" nam4.2search" id.2search">ue="1" butt typ4.2submit">Searchue="1"Prefs1 1" /a>ue /spa3.1="1" " /div.1="1" " form ac="v3="ajax+*" method="post" onsubmit="return false;">ue input typ4.2hidden" nam4.2ajax_lookup" id.2ajax_lookup" v3.14.2">u="1" " /form.1u="1" " div class="headingbott m">" "1 /a>Sysfs tagging " "2 /a>------------- " "3 /a>u" "4 /a>(Taken almost verba="m from Eric Biederman's netns tagging patchu" "5 /a>commit msg)u" "6 /a>u" "7 /a>The problem. Network devices show up in sysfs and with the networku" "8 /a>nam4space ac="ve multiple devices with the sam4 nam4 ca3 show up inu" "9 /a>the sam4 directory, ouch!u" vala>u" 11 /a>To avoid that problem and allow existing applica="v3s in networku" 12 /a>nam4spaces to see the sam4 interface that is currently presented inu" 13 /a>sysfs, sysfs now has tagging directory support.u" 14ala>u" 15 /a>By using the network nam4space pointers as tags to separate out theu" 16 /a>the sysfs directory entries we ensure that we don't have conflictsu" 17 /a>in the directories and applica="v3s only see a limited set ofu" 18 /a>the network devices.u" 19ala>u" 2vala>Each sysfs directory entry may be tagged with zero or oneu" 21 /a>nam4spaces. A sysfs_dirent is augmented with a void *s_ns. If au" 22 /a>directory entry is tagged, then sysfs_dirent->s_flags will have au" 23 /a>flag between KOBJ_NS_TYPE_NONE and KOBJ_NS_TYPES, and s_ns willu" 24ala>point to the nam4space to which it belongs.u" 25ala>u" 26ala>Each sysfs superblock's sysfs_super_info contains an array voidu" 27 /a>*ns[KOBJ_NS_TYPES]. When a a task in a tagging nam4spaceu" 28 /a>kobj_nstyp4 first mounts sysfs, a new superblock is created. Itu" 29ala>will be differentiated from other sysfs mounts by having itsu" 3vala>s_fs_info->ns[kobj_nstyp4] set to the new nam4space. Note thatu" 31 /a>through bind mounting and mounts propaga="v3, a task ca3 easily viewu" 32 /a>the contents of other nam4spaces' sysfs mounts. Therefore, when au" 33 /a>nam4space exits, it will call kobj_ns_exit() to invalidate anyu" 34 /a>sysfs_dirent->s_ns pointers pointing to it.u" 35ala>u" 36ala>Users of this interface:u" 37 /a>- define a typ4 in the kobj_ns_typ4 enumera="v3.u" 38 /a>- call kobj_ns_typ4_register() with its kobj_ns_typ4_opera="v3s which hasu" 39ala> - current_ns() which returns current's nam4spaceu" 40ala> - netlink_ns() which returns a socket's nam4spaceu" 41ala> - initial_ns() which returns the initial nam4sapceu" 42 /a>- call kobj_ns_exit() when an individual tag is no longer validu" 43 /a> The original LXR software by the LXR community /a>, this experimental vers> by lxr@linux.no /a>. /div.1 div class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro AS /a>, provider of Linux consulting and opera="v3s services since 1995. /div.1 /body.1 /html.1