Merge 0.30.214.
[util-vserver.git] / lib / vserver-internal.h
index c937320..eb0504a 100644 (file)
@@ -1,4 +1,4 @@
-// $Id: vserver-internal.h 2446 2007-01-09 13:22:11Z dhozac $    --*- c++ -*--
+// $Id: vserver-internal.h 2589 2007-08-16 03:06:50Z dhozac $    --*- c++ -*--
 
 // Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
 //  
@@ -50,7 +50,7 @@ inline static ALWAYSINLINE void vc_noop0() {}
 #  define CALL_VC(...)                                 \
   do {                                                 \
     int        ver = utilvserver_checkCompatVersion();         \
-    uint_least32_t conf = utilvserver_checkCompatConfig();     \
+    vc_vci_t UNUSED conf = utilvserver_checkCompatConfig();    \
     if (ver==-1) return -1;                            \
     VC_SUFFIX, __VA_ARGS__, VC_PREFIX;                 \
     errno = ENOSYS;                                    \
@@ -114,18 +114,42 @@ inline static ALWAYSINLINE void vc_noop0() {}
 #  define CALL_VC_V21(F,...)   CALL_VC_NOOP
 #endif
 
-#ifdef VC_ENABLE_API_V21
+#if defined(VC_ENABLE_API_V21) || defined(VC_ENABLE_API_V22) || defined(VC_ENABLE_API_V23)
 #  define CALL_VC_SPACES(F,...)        CALL_VC_GENERAL_CONFIG(VC_VCI_SPACES, spaces, F, __VA_ARGS__)
 #else
 #  define CALL_VC_SPACES(F,...)        CALL_VC_NOOP
 #endif
 
+#if defined(VC_ENABLE_API_V23)
+#  define CALL_VC_TAG(F,...)   CALL_VC_GENERAL_CONFIG(VC_VCI_PPTAG, tag, F, __VA_ARGS__)
+#else
+#  define CALL_VC_TAG(F,...)   CALL_VC_NOOP
+#endif
+
+#ifdef VC_ENABLE_API_V22
+#  define CALL_VC_V22(F,...)   CALL_VC_GENERAL(0x00020200, v22, F, __VA_ARGS__)
+#else
+#  define CALL_VC_V22(F,...)   CALL_VC_NOOP
+#endif
+
+#ifdef VC_ENABLE_API_V23
+#  define CALL_VC_V23(F,...)   CALL_VC_GENERAL(0x00020300, v23, F, __VA_ARGS__)
+#else
+#  define CALL_VC_V23(F,...)   CALL_VC_NOOP
+#endif
+
 #ifdef VC_ENABLE_API_NET
 #  define CALL_VC_NET(F,...)   CALL_VC_GENERAL(0x00010016, net, F, __VA_ARGS__)
 #else
 #  define CALL_VC_NET(F,...)   CALL_VC_NOOP
 #endif
 
+#if defined(VC_ENABLE_API_NETV2)
+#  define CALL_VC_NETV2(F,...) CALL_VC_GENERAL_CONFIG(VC_VCI_NETV2, netv2, F, __VA_ARGS__)
+#else
+#  define CALL_VC_NETV2(F,...) CALL_VC_NOOP
+#endif
+
 #ifdef VC_ENABLE_API_FSCOMPAT
 #  define CALL_VC_FSCOMPAT(F,...)      CALL_VC_GENERAL(0x00010000, fscompat, F, __VA_ARGS__)
 #else
@@ -161,6 +185,19 @@ inline static ALWAYSINLINE void vc_noop0() {}
 #endif
 
 #if 1
+#  define TAG_KERNEL2USER(X)   (((X)==(uint32_t)(-1)) ? VC_NOCTX   : \
+                                ((X)==(uint32_t)(-2)) ? VC_SAMECTX : \
+                                (tag_t)(X))
+
+#  define TAG_USER2KERNEL(X)   (((X)==VC_DYNAMIC_XID) ? (uint32_t)(-1) : \
+                                ((X)==VC_SAMECTX)     ? (uint32_t)(-2) : \
+                                (uint32_t)(X))
+#else
+#  define TAG_USER2KERNEL(X)   (X)
+#  define TAG_KERNEL2USER(X)   (X)
+#endif
+
+#if 1
 #  define EXT2FLAGS_USER2KERNEL(X)     (((X) & ~(VC_IMMUTABLE_FILE_FL|VC_IMMUTABLE_LINK_FL)) | \
                                         ((X) & VC_IMMUTABLE_FILE_FL ? EXT2_IMMUTABLE_FILE_FL : 0) | \
                                         ((X) & VC_IMMUTABLE_LINK_FL ? EXT2_IMMUTABLE_LINK_FL : 0))
@@ -205,26 +242,6 @@ inline static ALWAYSINLINE void vc_noop0() {}
 #  define NID_KERNEL2USER(X)   (X)
 #endif
 
-#if 1
-#  define NETTYPE_USER2KERNEL(X)       ((X)==vcNET_IPV4   ? NXA_TYPE_IPV4     : \
-                                        (X)==vcNET_IPV6   ? NXA_TYPE_IPV6     : \
-                                        (X)==vcNET_IPV4B  ? (NXA_TYPE_IPV4 | NXA_MOD_BCAST) : \
-                                        (X)==vcNET_IPV6B  ? (NXA_TYPE_IPV6 | NXA_MOD_BCAST) : \
-                                        (X)==vcNET_IPV4A  ? (NXA_TYPE_IPV4 | NXA_MOD_ALL) : \
-                                        (X)==vcNET_IPV6A  ? (NXA_TYPE_IPV6 | NXA_MOD_ALL) : \
-                                        (X)==vcNET_ANY    ? NXA_TYPE_ANY      : \
-                                        (X))
-#  define NETTYPE_KERNEL2USER(X)       ((X)==NXA_TYPE_IPV4     ? vcNET_IPV4   : \
-                                        (X)==NXA_TYPE_IPV6     ? vcNET_IPV6   : \
-                                        (X)==(NXA_TYPE_IPV4|NXA_MOD_BCAST) ? vcNET_IPV4B : \
-                                        (X)==(NXA_TYPE_IPV6|NXA_MOD_BCAST) ? vcNET_IPV6B : \
-                                        (X)==NXA_TYPE_ANY      ? vcNET_ANY    : \
-                                        (X))
-#else
-#  define NETTYPE_USER2KERNEL(X)       (X)
-#  define NETTYPE_KERNEL2USER(X)       (X)
-#endif
-
 #define CDLIM_USER2KERNEL(X)           ((X)==VC_CDLIM_UNSET    ? CDLIM_UNSET    : \
                                         (X)==VC_CDLIM_INFINITY ? CDLIM_INFINITY : \
                                         (X)==VC_CDLIM_KEEP     ? CDLIM_KEEP     : \