···33#define _LINUX_NS_COMMON_TYPES_H4455#include <linux/atomic.h>66+#include <linux/ns/nstree_types.h>67#include <linux/rbtree.h>78#include <linux/refcount.h>89#include <linux/types.h>···9998 * Initial namespaces:10099 * Boot-time namespaces (init_net, init_pid_ns, etc.) start with101100 * __ns_ref_active = 1 and remain active forever.101101+ *102102+ * @ns_type: type of namespace (e.g., CLONE_NEWNET)103103+ * @stashed: cached dentry to be used by the vfs104104+ * @ops: namespace operations105105+ * @inum: namespace inode number (quickly recycled for non-initial namespaces)106106+ * @__ns_ref: main reference count (do not use directly)107107+ * @ns_tree: namespace tree nodes and active reference count102108 */103109struct ns_common {104110 u32 ns_type;···114106 unsigned int inum;115107 refcount_t __ns_ref; /* do not use directly */116108 union {117117- struct {118118- u64 ns_id;119119- struct /* global namespace rbtree and list */ {120120- struct rb_node ns_unified_tree_node;121121- struct list_head ns_unified_list_node;122122- };123123- struct /* per type rbtree and list */ {124124- struct rb_node ns_tree_node;125125- struct list_head ns_list_node;126126- };127127- struct /* namespace ownership rbtree and list */ {128128- struct rb_root ns_owner_tree; /* rbtree of namespaces owned by this namespace */129129- struct list_head ns_owner; /* list of namespaces owned by this namespace */130130- struct rb_node ns_owner_tree_node; /* node in the owner namespace's rbtree */131131- struct list_head ns_owner_entry; /* node in the owner namespace's ns_owned list */132132- };133133- atomic_t __ns_ref_active; /* do not use directly */134134- };109109+ struct ns_tree;135110 struct rcu_head ns_rcu;136111 };137112};
+19
include/linux/ns/nstree_types.h
···3333 struct list_head ns_list_entry;3434};35353636+/**3737+ * struct ns_tree - Namespace tree nodes and active reference count3838+ * @ns_id: Unique namespace identifier3939+ * @__ns_ref_active: Active reference count (do not use directly)4040+ * @ns_unified_node: Node in the global namespace tree4141+ * @ns_tree_node: Node in the per-type namespace tree4242+ * @ns_owner_node: Node in the owner namespace's tree of owned namespaces4343+ * @ns_owner_root: Root of the tree of namespaces owned by this namespace4444+ * (only used when this namespace is an owner)4545+ */4646+struct ns_tree {4747+ u64 ns_id;4848+ atomic_t __ns_ref_active;4949+ struct ns_tree_node ns_unified_node;5050+ struct ns_tree_node ns_tree_node;5151+ struct ns_tree_node ns_owner_node;5252+ struct ns_tree_root ns_owner_root;5353+};5454+3655#endif /* _LINUX_NSTREE_TYPES_H */