Fix vc_get_space_default and add vc_get_space_mask v1.
authorDaniel Hokka Zakrisson <daniel@hozac.com>
Fri, 31 Oct 2008 15:40:01 +0000 (15:40 +0000)
committerDaniel Hokka Zakrisson <daniel@hozac.com>
Fri, 31 Oct 2008 15:40:01 +0000 (15:40 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2818 94cd875c-1c1d-0410-91d2-eb244daf1a30

kernel/space_cmd.h
kernel/switch.h
lib/syscall_getspacemask-v21.hc
lib/syscall_getspacemask-v23.hc [new file with mode: 0644]
lib/syscall_getspacemask.c

index 0be0a58..1635e4d 100644 (file)
 #define VCMD_set_space_v1      VC_CMD(PROCALT, 3, 1)
 #define VCMD_set_space         VC_CMD(PROCALT, 3, 2)
 
-#define VCMD_get_space_mask    VC_CMD(PROCALT, 4, 0)
+#define VCMD_get_space_mask_v0 VC_CMD(PROCALT, 4, 0)
 
-#define VCMD_get_space_default VC_CMD(PROCALT, 7, 0)
+#define VCMD_get_space_mask    VC_CMD(VSPACE, 0, 1)
+#define VCMD_get_space_default VC_CMD(VSPACE, 1, 0)
 
 
 struct vcmd_space_mask_v1 {
index 6836c27..c3c0603 100644 (file)
@@ -25,7 +25,7 @@
   CPU    |       |VPROC  |PROCALT|PROCMIG|PROCTRL|       | |SCHED. |       |
   PROCESS|     08|     09|     10|     11|     12|     13| |     14|     15|
   -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
-  MEMORY |       |       |       |       |       |       | |SWAP   |       |
+  MEMORY |       |       |       |       |MEMCTRL|       | |SWAP   |       |
         |     16|     17|     18|     19|     20|     21| |     22|     23|
   -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
   NETWORK|       |VNET   |NETALT |NETMIG |NETCTL |       | |SERIAL |       |
@@ -37,7 +37,7 @@
   OTHER  |VSTAT  |       |       |       |       |       | |VINFO  |       |
         |     40|     41|     42|     43|     44|     45| |     46|     47|
   =======+=======+=======+=======+=======+=======+=======+ +=======+=======+
-  SPECIAL|EVENT  |       |       |       |FLAGS  |       | |       |       |
+  SPECIAL|EVENT  |       |       |       |FLAGS  |       | |VSPACE |       |
         |     48|     49|     50|     51|     52|     53| |     54|     55|
   -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
   SPECIAL|DEBUG  |       |       |       |RLIMIT |SYSCALL| |       |COMPAT |
@@ -59,7 +59,6 @@
 #define VC_CAT_PROCTRL         12
 
 #define VC_CAT_SCHED           14
-
 #define VC_CAT_MEMCTRL         20
 
 #define VC_CAT_VNET            25
@@ -76,6 +75,7 @@
 #define VC_CAT_EVENT           48
 
 #define VC_CAT_FLAGS           52
+#define VC_CAT_VSPACE          54
 #define VC_CAT_DEBUG           56
 #define VC_CAT_RLIMIT          60
 
index 1511b9d..8c5ebea 100644 (file)
@@ -25,7 +25,7 @@ static inline ALWAYSINLINE uint_least64_t
 vc_get_space_mask_spaces(int UNUSED tmp)
 {
   struct vcmd_space_mask_v1 data = { .mask = 0 };
-  int ret = vserver(VCMD_get_space_mask, 0, &data);
+  int ret = vserver(VCMD_get_space_mask_v0, 0, &data);
   if (ret)
     return ret;
   return data.mask & ~(CLONE_NEWNS|CLONE_FS);
diff --git a/lib/syscall_getspacemask-v23.hc b/lib/syscall_getspacemask-v23.hc
new file mode 100644 (file)
index 0000000..05c42c7
--- /dev/null
@@ -0,0 +1,32 @@
+// $Id$    --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+// Copyright (C) 2006 Daniel Hokka Zakrisson
+//  
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//  
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//  
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+#ifdef HAVE_CONFIG_H
+#  include <config.h>
+#endif
+
+static inline ALWAYSINLINE uint_least64_t
+vc_get_space_mask_v23(int UNUSED tmp)
+{
+  struct vcmd_space_mask_v1 data = { .mask = 0 };
+  int ret = vserver(VCMD_get_space_mask, 0, &data);
+  if (ret)
+    return ret;
+  return data.mask & ~(CLONE_NEWNS|CLONE_FS);
+}
index 55fac58..7316453 100644 (file)
 #endif
 
 #include "vserver.h"
-#include "vserver-internal.h"
 #include "virtual.h"
 
+#if defined(VC_ENABLE_API_V21) && defined(VC_ENABLE_API_V23)
+#  define VC_MULTIVERSION_SYSCALL 1
+#endif
+#include "vserver-internal.h"
+
 #if defined(VC_ENABLE_API_V21)
 #  include "syscall_getspacemask-v21.hc"
 #endif
 
-#if defined(VC_ENABLE_API_V21)
+#if defined(VC_ENABLE_API_V23)
+#  include "syscall_getspacemask-v23.hc"
+#endif
+
+#if defined(VC_ENABLE_API_V21) || defined(VC_ENABLE_API_V23)
 uint_least64_t
 vc_get_space_mask()
 {
-  CALL_VC(CALL_VC_SPACES(vc_get_space_mask, 0));
+  CALL_VC(CALL_VC_V23P  (vc_get_space_mask, 0),
+         CALL_VC_SPACES(vc_get_space_mask, 0));
 }
 #endif