4 #include <linux/types.h>
7 #define MAX_S_CONTEXT 65535 /* Arbitrary limit */
8 #define MIN_D_CONTEXT 49152 /* dynamic contexts start here */
10 #define VX_DYNAMIC_ID ((uint32_t)-1) /* id for dynamic context */
14 #include <linux/utsname.h>
20 unsigned long total_forks;
22 unsigned int bias_cswtch;
26 struct new_utsname utsname;
30 #include <linux/list.h>
31 #include <linux/spinlock.h>
32 #include <asm/atomic.h>
40 struct list_head vx_list; /* linked list of contexts */
41 xid_t vx_id; /* context id */
42 atomic_t vx_refcount; /* refcount */
43 struct vx_info *vx_parent; /* parent context */
45 struct namespace *vx_namespace; /* private namespace */
46 struct fs_struct *vx_fs; /* private namespace fs */
47 uint64_t vx_flags; /* VX_INFO_xxx */
48 uint64_t vx_bcaps; /* bounding caps (system) */
49 uint64_t vx_ccaps; /* context caps (vserver) */
51 pid_t vx_initpid; /* PID of fake init process */
53 struct _vx_virt virt; /* virtual/bias stuff */
54 struct _vx_limit limit; /* vserver limits */
55 struct _vx_sched sched; /* vserver scheduler */
57 char vx_name[65]; /* vserver name */
61 extern spinlock_t vxlist_lock;
62 extern struct list_head vx_infos;
65 #define VX_ADMIN 0x0001
66 #define VX_WATCH 0x0002
67 #define VX_DUMMY 0x0008
69 #define VX_IDENT 0x0010
70 #define VX_EQUIV 0x0020
71 #define VX_PARENT 0x0040
72 #define VX_CHILD 0x0080
74 #define VX_ARG_MASK 0x00F0
76 #define VX_DYNAMIC 0x0100
77 #define VX_STATIC 0x0200
79 #define VX_ATR_MASK 0x0F00
82 void free_vx_info(struct vx_info *);
84 extern struct vx_info *find_vx_info(int);
85 extern struct vx_info *find_or_create_vx_info(int);
87 extern int vx_migrate_task(struct task_struct *, struct vx_info *);
89 #endif /* __KERNEL__ */
95 #define VCMD_task_xid VC_CMD(VINFO, 1, 0)
96 #define VCMD_task_nid VC_CMD(VINFO, 2, 0)
99 extern int vc_task_xid(uint32_t, void *);
101 #endif /* __KERNEL__ */
103 #define VCMD_vx_info VC_CMD(VINFO, 5, 0)
104 #define VCMD_nx_info VC_CMD(VINFO, 6, 0)
106 struct vcmd_vx_info_v0 {
113 extern int vc_vx_info(uint32_t, void *);
115 #endif /* __KERNEL__ */
117 #define VCMD_create_context VC_CMD(VSETUP, 1, 0)
118 #define VCMD_migrate_context VC_CMD(PROCMIG, 1, 0)
121 extern int vc_create_context(uint32_t, void *);
122 extern int vc_migrate_context(uint32_t, void *);
124 #endif /* __KERNEL__ */
126 #define VCMD_get_flags VC_CMD(FLAGS, 1, 0)
127 #define VCMD_set_flags VC_CMD(FLAGS, 2, 0)
129 struct vcmd_ctx_flags_v0 {
135 extern int vc_get_flags(uint32_t, void *);
136 extern int vc_set_flags(uint32_t, void *);
138 #endif /* __KERNEL__ */
140 #define VXF_INFO_LOCK 0x00000001
141 #define VXF_INFO_NPROC 0x00000002
142 #define VXF_INFO_PRIVATE 0x00000004
143 #define VXF_INFO_INIT 0x00000008
145 #define VXF_INFO_HIDE 0x00000010
146 #define VXF_INFO_ULIMIT 0x00000020
147 #define VXF_INFO_NSPACE 0x00000040
149 #define VXF_SCHED_HARD 0x00000100
150 #define VXF_SCHED_PRIO 0x00000200
151 #define VXF_SCHED_PAUSE 0x00000400
153 #define VXF_VIRT_MEM 0x00010000
154 #define VXF_VIRT_UPTIME 0x00020000
156 #define VXF_STATE_SETUP (1ULL<<32)
157 #define VXF_STATE_INIT (1ULL<<33)
159 #define VCMD_get_ccaps VC_CMD(FLAGS, 3, 0)
160 #define VCMD_set_ccaps VC_CMD(FLAGS, 4, 0)
162 struct vcmd_ctx_caps_v0 {
169 extern int vc_get_ccaps(uint32_t, void *);
170 extern int vc_set_ccaps(uint32_t, void *);
172 #endif /* __KERNEL__ */
174 #define VXC_SET_UTSNAME 0x00000001
175 #define VXC_SET_RLIMIT 0x00000002
177 #define VXC_ICMP_PING 0x00000100
179 #define VXC_SECURE_MOUNT 0x00010000
182 #endif /* _VX_CONTEXT_H */