4 #include <linux/types.h>
6 #define MAX_S_CONTEXT 65535 /* Arbitrary limit */
7 #define MIN_D_CONTEXT 49152 /* dynamic contexts start here */
9 #define VX_DYNAMIC_ID ((uint32_t)-1) /* id for dynamic context */
13 #include <linux/list.h>
14 #include <linux/spinlock.h>
15 #include <linux/rcupdate.h>
24 struct hlist_node vx_hlist; /* linked list of contexts */
25 struct rcu_head vx_rcu; /* the rcu head */
26 xid_t vx_id; /* context id */
27 atomic_t vx_usecnt; /* usage count */
28 atomic_t vx_refcnt; /* reference count */
29 struct vx_info *vx_parent; /* parent context */
31 struct namespace *vx_namespace; /* private namespace */
32 struct fs_struct *vx_fs; /* private namespace fs */
33 uint64_t vx_flags; /* VX_INFO_xxx */
34 uint64_t vx_bcaps; /* bounding caps (system) */
35 uint64_t vx_ccaps; /* context caps (vserver) */
37 pid_t vx_initpid; /* PID of fake init process */
39 struct _vx_limit limit; /* vserver limits */
40 struct _vx_sched sched; /* vserver scheduler */
41 struct _vx_cvirt cvirt; /* virtual/bias stuff */
42 struct _vx_cacct cacct; /* context accounting */
44 char vx_name[65]; /* vserver name */
48 #define VX_ADMIN 0x0001
49 #define VX_WATCH 0x0002
50 #define VX_DUMMY 0x0008
52 #define VX_IDENT 0x0010
53 #define VX_EQUIV 0x0020
54 #define VX_PARENT 0x0040
55 #define VX_CHILD 0x0080
57 #define VX_ARG_MASK 0x00F0
59 #define VX_DYNAMIC 0x0100
60 #define VX_STATIC 0x0200
62 #define VX_ATR_MASK 0x0F00
65 extern void rcu_free_vx_info(void *);
66 extern void unhash_vx_info(struct vx_info *);
68 extern struct vx_info *locate_vx_info(int);
69 extern struct vx_info *locate_or_create_vx_info(int);
71 extern int get_xid_list(int, unsigned int *, int);
72 extern int vx_info_is_hashed(xid_t);
74 extern int vx_migrate_task(struct task_struct *, struct vx_info *);
76 #endif /* __KERNEL__ */
82 #define VCMD_task_xid VC_CMD(VINFO, 1, 0)
83 #define VCMD_task_nid VC_CMD(VINFO, 2, 0)
86 extern int vc_task_xid(uint32_t, void __user *);
88 #endif /* __KERNEL__ */
90 #define VCMD_vx_info VC_CMD(VINFO, 5, 0)
91 #define VCMD_nx_info VC_CMD(VINFO, 6, 0)
93 struct vcmd_vx_info_v0 {
100 extern int vc_vx_info(uint32_t, void __user *);
102 #endif /* __KERNEL__ */
104 #define VCMD_ctx_create VC_CMD(VPROC, 1, 0)
105 #define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 0)
108 extern int vc_ctx_create(uint32_t, void __user *);
109 extern int vc_ctx_migrate(uint32_t, void __user *);
111 #endif /* __KERNEL__ */
113 #define VCMD_get_cflags VC_CMD(FLAGS, 1, 0)
114 #define VCMD_set_cflags VC_CMD(FLAGS, 2, 0)
116 struct vcmd_ctx_flags_v0 {
122 extern int vc_get_cflags(uint32_t, void __user *);
123 extern int vc_set_cflags(uint32_t, void __user *);
125 #endif /* __KERNEL__ */
127 #define VXF_INFO_LOCK 0x00000001
128 #define VXF_INFO_SCHED 0x00000002
129 #define VXF_INFO_NPROC 0x00000004
130 #define VXF_INFO_PRIVATE 0x00000008
132 #define VXF_INFO_INIT 0x00000010
133 #define VXF_INFO_HIDE 0x00000020
134 #define VXF_INFO_ULIMIT 0x00000040
135 #define VXF_INFO_NSPACE 0x00000080
137 #define VXF_SCHED_HARD 0x00000100
138 #define VXF_SCHED_PRIO 0x00000200
139 #define VXF_SCHED_PAUSE 0x00000400
141 #define VXF_VIRT_MEM 0x00010000
142 #define VXF_VIRT_UPTIME 0x00020000
143 #define VXF_VIRT_CPU 0x00040000
145 #define VXF_HIDE_MOUNT 0x01000000
146 #define VXF_HIDE_NETIF 0x02000000
148 #define VXF_STATE_SETUP (1ULL<<32)
149 #define VXF_STATE_INIT (1ULL<<33)
151 #define VXF_FORK_RSS (1ULL<<48)
152 #define VXF_PROLIFIC (1ULL<<49)
154 #define VXF_ONE_TIME (0x0003ULL<<32)
156 #define VCMD_get_ccaps VC_CMD(FLAGS, 3, 0)
157 #define VCMD_set_ccaps VC_CMD(FLAGS, 4, 0)
159 struct vcmd_ctx_caps_v0 {
166 extern int vc_get_ccaps(uint32_t, void __user *);
167 extern int vc_set_ccaps(uint32_t, void __user *);
169 #endif /* __KERNEL__ */
171 #define VXC_SET_UTSNAME 0x00000001
172 #define VXC_SET_RLIMIT 0x00000002
174 #define VXC_RAW_ICMP 0x00000100
176 #define VXC_SECURE_MOUNT 0x00010000
179 #endif /* _VX_CONTEXT_H */