This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / linux / vs_tag.h
1 #ifndef _VS_TAG_H
2 #define _VS_TAG_H
3
4 #include <linux/vserver/tag.h>
5
6 /* check conditions */
7
8 #define DX_ADMIN        0x0001
9 #define DX_WATCH        0x0002
10 #define DX_HOSTID       0x0008
11
12 #define DX_IDENT        0x0010
13
14 #define DX_ARG_MASK     0x0010
15
16
17 #define dx_task_tag(t)  ((t)->xid)
18
19 #define dx_current_tag() dx_task_tag(current)
20
21 #define dx_check(c,m)   __dx_check(dx_current_tag(),c,m)
22
23 #define dx_weak_check(c,m)      ((m) ? dx_check(c,m) : 1)
24
25
26 /*
27  * check current context for ADMIN/WATCH and
28  * optionally against supplied argument
29  */
30 static inline int __dx_check(tag_t cid, tag_t id, unsigned int mode)
31 {
32         if (mode & DX_ARG_MASK) {
33                 if ((mode & DX_IDENT) &&
34                         (id == cid))
35                         return 1;
36         }
37         return (((mode & DX_ADMIN) && (cid == 0)) ||
38                 ((mode & DX_WATCH) && (cid == 1)) ||
39                 ((mode & DX_HOSTID) && (id == 0)));
40 }
41
42 #else
43 #warning duplicate inclusion
44 #endif