This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / linux / vs_tag.h
diff --git a/include/linux/vs_tag.h b/include/linux/vs_tag.h
new file mode 100644 (file)
index 0000000..781bcce
--- /dev/null
@@ -0,0 +1,44 @@
+#ifndef _VS_TAG_H
+#define _VS_TAG_H
+
+#include <linux/vserver/tag.h>
+
+/* check conditions */
+
+#define DX_ADMIN       0x0001
+#define DX_WATCH       0x0002
+#define DX_HOSTID      0x0008
+
+#define DX_IDENT       0x0010
+
+#define DX_ARG_MASK    0x0010
+
+
+#define dx_task_tag(t) ((t)->xid)
+
+#define dx_current_tag() dx_task_tag(current)
+
+#define dx_check(c,m)  __dx_check(dx_current_tag(),c,m)
+
+#define dx_weak_check(c,m)     ((m) ? dx_check(c,m) : 1)
+
+
+/*
+ * check current context for ADMIN/WATCH and
+ * optionally against supplied argument
+ */
+static inline int __dx_check(tag_t cid, tag_t id, unsigned int mode)
+{
+       if (mode & DX_ARG_MASK) {
+               if ((mode & DX_IDENT) &&
+                       (id == cid))
+                       return 1;
+       }
+       return (((mode & DX_ADMIN) && (cid == 0)) ||
+               ((mode & DX_WATCH) && (cid == 1)) ||
+               ((mode & DX_HOSTID) && (id == 0)));
+}
+
+#else
+#warning duplicate inclusion
+#endif