at master 2.0 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * procfs namespace bits 4 */ 5#ifndef _LINUX_PROC_NS_H 6#define _LINUX_PROC_NS_H 7 8#include <linux/nsfs.h> 9#include <uapi/linux/nsfs.h> 10 11struct pid_namespace; 12struct nsset; 13struct path; 14struct task_struct; 15struct inode; 16 17struct proc_ns_operations { 18 const char *name; 19 const char *real_ns_name; 20 struct ns_common *(*get)(struct task_struct *task); 21 void (*put)(struct ns_common *ns); 22 int (*install)(struct nsset *nsset, struct ns_common *ns); 23 struct user_namespace *(*owner)(struct ns_common *ns); 24 struct ns_common *(*get_parent)(struct ns_common *ns); 25} __randomize_layout; 26 27extern const struct proc_ns_operations netns_operations; 28extern const struct proc_ns_operations utsns_operations; 29extern const struct proc_ns_operations ipcns_operations; 30extern const struct proc_ns_operations pidns_operations; 31extern const struct proc_ns_operations pidns_for_children_operations; 32extern const struct proc_ns_operations userns_operations; 33extern const struct proc_ns_operations mntns_operations; 34extern const struct proc_ns_operations cgroupns_operations; 35extern const struct proc_ns_operations timens_operations; 36extern const struct proc_ns_operations timens_for_children_operations; 37 38/* 39 * We always define these enumerators 40 */ 41enum { 42 PROC_IPC_INIT_INO = IPC_NS_INIT_INO, 43 PROC_UTS_INIT_INO = UTS_NS_INIT_INO, 44 PROC_USER_INIT_INO = USER_NS_INIT_INO, 45 PROC_PID_INIT_INO = PID_NS_INIT_INO, 46 PROC_CGROUP_INIT_INO = CGROUP_NS_INIT_INO, 47 PROC_TIME_INIT_INO = TIME_NS_INIT_INO, 48 PROC_NET_INIT_INO = NET_NS_INIT_INO, 49 PROC_MNT_INIT_INO = MNT_NS_INIT_INO, 50}; 51 52#ifdef CONFIG_PROC_FS 53 54extern int proc_alloc_inum(unsigned int *pino); 55extern void proc_free_inum(unsigned int inum); 56 57#else /* CONFIG_PROC_FS */ 58 59static inline int proc_alloc_inum(unsigned int *inum) 60{ 61 *inum = 1; 62 return 0; 63} 64static inline void proc_free_inum(unsigned int inum) {} 65 66#endif /* CONFIG_PROC_FS */ 67 68#define get_proc_ns(inode) ((struct ns_common *)(inode)->i_private) 69 70#endif /* _LINUX_PROC_NS_H */