--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <ensc@delenn.intern.sigma-chemnitz.de>
+//
+// 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
+
+#include "vserver.h"
+#include "internal.h"
+#include <lib_internal/util-dimof.h>
+
+#include <string.h>
+#include <assert.h>
+
+#define DECL(STR, VAL) { STR, sizeof(STR)-1, VAL }
+
+static struct Mapping_uint64 const VALUES[] = {
+#warning Add the 'bcap' values here
+};
+
+uint_least64_t
+vc_text2bcap(char const *str, size_t len)
+{
+ ssize_t idx = utilvserver_value2text_uint64(str, len,
+ VALUES, DIM_OF(VALUES));
+ if (idx==-1) return 0;
+ else return VALUES[idx].val;
+}
+
+char const *
+vc_lobcap2text(uint_least64_t *val)
+{
+ ssize_t idx = utilvserver_text2value_uint64(val,
+ VALUES, DIM_OF(VALUES));
+
+ if (idx==-1) return 0;
+ else return VALUES[idx].id;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <>
+//
+// 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
+
+#include "vserver.h"
+#include "internal.h"
+
+#include <string.h>
+
+int
+vc_list2bcap(char const *str, size_t len,
+ struct vc_err_listparser *err,
+ struct vc_ctx_caps *caps)
+{
+ uint_least64_t tmp=0;
+
+ return utilvserver_listparser_uint64(str, len,
+ err ? &err->ptr : 0,
+ err ? &err->len : 0,
+ &caps->bcaps, &tmp,
+ vc_text2bcap);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <ensc@delenn.intern.sigma-chemnitz.de>
+//
+// 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
+
+#include "vserver.h"
+#include "internal.h"
+#include <lib_internal/util-dimof.h>
+
+#include <string.h>
+#include <assert.h>
+
+#define DECL(STR, VAL) { STR, sizeof(STR)-1, VAL }
+
+static struct Mapping_uint64 const VALUES[] = {
+#warning Add the 'ccap' values here
+};
+
+uint_least64_t
+vc_text2ccap(char const *str, size_t len)
+{
+ ssize_t idx = utilvserver_value2text_uint64(str, len,
+ VALUES, DIM_OF(VALUES));
+ if (idx==-1) return 0;
+ else return VALUES[idx].val;
+}
+
+char const *
+vc_loccap2text(uint_least64_t *val)
+{
+ ssize_t idx = utilvserver_text2value_uint64(val,
+ VALUES, DIM_OF(VALUES));
+
+ if (idx==-1) return 0;
+ else return VALUES[idx].id;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <>
+//
+// 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
+
+#include "vserver.h"
+#include "internal.h"
+
+#include <string.h>
+
+int
+vc_list2ccap(char const *str, size_t len,
+ struct vc_err_listparser *err,
+ struct vc_ctx_caps *caps)
+{
+ return utilvserver_listparser_uint64(str, len,
+ err ? &err->ptr : 0,
+ err ? &err->len : 0,
+ &caps->ccaps, &caps->cmask,
+ vc_text2ccap);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// 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 int
+vc_get_ccaps_v13(xid_t xid, struct vc_ctx_caps *caps)
+{
+ struct vcmd_ctx_caps_v0 k_caps;
+ int res;
+
+ res = vserver(VCMD_get_ccaps, CTX_USER2KERNEL(xid), &k_caps);
+ caps->bcaps = k_caps.bcaps;
+ caps->ccaps = k_caps.ccaps;
+ caps->cmask = k_caps.cmask;
+
+ return res;
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// 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
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_V13)
+# include "syscall_getccaps-v13.hc"
+#endif
+
+#if defined(VC_ENABLE_API_V13)
+int
+vc_get_ccaps(xid_t xid, struct vc_ctx_caps *caps)
+{
+ if (caps==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ CALL_VC(CALL_VC_V13A(vc_get_ccaps, xid, caps));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// 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 int
+vc_set_ccaps_v13(xid_t xid, struct vc_ctx_caps const *caps)
+{
+ struct vcmd_ctx_caps_v0 k_caps;
+
+ k_caps.bcaps = caps->bcaps;
+ k_caps.ccaps = caps->ccaps;
+ k_caps.cmask = caps->cmask;
+
+ return vserver(VCMD_set_ccaps, CTX_USER2KERNEL(xid), &k_caps);
+}
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// 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
+
+#include "vserver.h"
+#include "vserver-internal.h"
+#include "linuxvirtual.h"
+
+#if defined(VC_ENABLE_API_V13)
+# include "syscall_setccaps-v13.hc"
+#endif
+
+#if defined(VC_ENABLE_API_V13)
+int
+vc_set_ccaps(xid_t xid, struct vc_ctx_caps const *caps)
+{
+ if (caps==0) {
+ errno = EFAULT;
+ return -1;
+ }
+
+ CALL_VC(CALL_VC_V13A(vc_set_ccaps, xid, caps));
+}
+#endif
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// 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
+
+#include "internal.h"
+#include "val2text.hc"
+
+TEXT2VAL(uint_least32_t, uint32)
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// 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
+
+#include "internal.h"
+#include "val2text.hc"
+
+TEXT2VAL(uint_least64_t, uint64)
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// 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
+
+#include "internal.h"
+#include "val2text.hc"
+
+VAL2TEXT(uint_least32_t, uint32)
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// 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
+
+#include "internal.h"
+#include "val2text.hc"
+
+VAL2TEXT(uint_least64_t, uint64)
--- /dev/null
+// $Id$ --*- c -*--
+
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+//
+// 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
+
+#include <stdlib.h>
+#include <string.h>
+
+#define VAL2TEXT(TYPE,SHORT) \
+ ssize_t \
+ utilvserver_value2text_##SHORT(char const *str, size_t len, \
+ struct Mapping_ ##SHORT const *map, \
+ size_t map_len) \
+ { \
+ size_t i; \
+ if (len==0) len=strlen(str); \
+ \
+ for (i=0; i<map_len; ++i) \
+ if (len==map[i].len && \
+ strncmp(map[i].id, str, len)==0) \
+ return i; \
+ \
+ return -1; \
+ }
+
+#define TEXT2VAL(TYPE,SHORT) \
+ static ssize_t \
+ searchValue(TYPE val, \
+ struct Mapping_##SHORT const *map, size_t map_len) \
+ { \
+ size_t i; \
+ for (i=0; i<map_len; ++i) \
+ if (val == map[i].val) return i; \
+ return -1; \
+ } \
+ \
+ ssize_t \
+ utilvserver_text2value_##SHORT(TYPE *val, \
+ struct Mapping_##SHORT const *map, \
+ size_t map_len) \
+ { \
+ ssize_t idx; \
+ TYPE del_val; \
+ if (*val==0) \
+ return -1; \
+ \
+ del_val = *val; \
+ idx = searchValue(del_val, map, map_len); \
+ \
+ if (idx==-1) { \
+ size_t i; \
+ for (i=0; i<sizeof(*val)*8 && (*val&(1<<i))==0; ++i) {} \
+ del_val = (1<<i); \
+ idx = searchValue(del_val, map, map_len); \
+ } \
+ *val &= ~del_val; \
+ return idx; \
+ }