57d74bfb8a8e1b80a042429c767535aab4943fdc
[util-vserver.git] / util-vserver / lib / virtual.h
1 #ifndef _LINUX_VIRTUAL_H
2 #define _LINUX_VIRTUAL_H
3
4 #include <linux/types.h>
5
6 #define VC_CATEGORY(c)          (((c) >> 24) & 0x3F)
7 #define VC_COMMAND(c)           (((c) >> 16) & 0xFF)
8 #define VC_VERSION(c)           ((c) & 0xFFF)
9
10 #define VC_CMD(c,i,v)           ((((VC_CAT_ ## c) & 0x3F) << 24) \
11                                 | (((i) & 0xFF) << 16) | ((v) & 0xFFF))
12
13 #define VC_CAT_VERSION          0
14 #define VC_CAT_PROCESS          1
15 #define VC_CAT_MEMORY           2
16 #define VC_CAT_NETWORK          3
17
18 #define VC_CAT_LIMITS           8
19 #define VC_CAT_QUOTA            9
20
21 #define VC_CAT_OTHER            62
22 #define VC_CAT_COMPAT           63
23
24 /*  interface version */
25
26   //#define VC_VERSION                  0x00010000
27
28
29
30 /*  query version */
31
32 #define VCMD_get_version        VC_CMD(VERSION, 0, 0)
33
34
35 /*  compatibiliy vserver commands */
36
37 #define VCMD_new_s_context      VC_CMD(COMPAT, 1, 1)
38 #define VCMD_set_ipv4root       VC_CMD(COMPAT, 2, 3)
39
40 /*  compatibiliy vserver arguments */
41
42 struct  vcmd_new_s_context_v1 {
43         uint32_t remove_cap;
44         uint32_t flags;
45 };
46
47 #define NB_IPV4ROOT 16
48
49 struct  vcmd_set_ipv4root_v3 {
50         /* number of pairs in id */
51         uint32_t broadcast;
52         struct {
53                 uint32_t ip;
54                 uint32_t mask;
55         } ip_mask_pair[NB_IPV4ROOT];
56 };
57
58
59 #endif /* _LINUX_VIRTUAL_H */