1 // $Id: wrappers-vserver.hc 2416 2006-12-08 13:25:29Z dhozac $ --*- c++ -*--
3 // Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; version 2 of the License.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef H_ENSC_IN_WRAPPERS_H
20 # error wrappers_handler.hc can not be used in this way
23 #if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
25 inline static WRAPPER_DECL xid_t
26 Evc_new_s_context(xid_t ctx, unsigned int remove_cap, unsigned int flags)
28 register xid_t res = vc_new_s_context(ctx,remove_cap,flags);
29 FatalErrnoError(res==VC_NOCTX, "vc_new_s_context()");
35 inline static WRAPPER_DECL xid_t
36 Evc_get_task_xid(pid_t pid)
38 register xid_t res = vc_get_task_xid(pid);
39 FatalErrnoError(res==VC_NOCTX, "vc_get_task_xid()");
43 inline static WRAPPER_DECL nid_t
44 Evc_get_task_nid(pid_t pid)
46 register nid_t res = vc_get_task_nid(pid);
47 FatalErrnoError(res==VC_NOCTX, "vc_get_task_nid()");
51 inline static WRAPPER_DECL xid_t
52 Evc_ctx_create(xid_t xid)
54 register xid_t res = vc_ctx_create(xid);
55 FatalErrnoError(res==VC_NOCTX, "vc_ctx_create()");
59 inline static WRAPPER_DECL nid_t
60 Evc_net_create(nid_t nid)
62 register nid_t res = vc_net_create(nid);
63 FatalErrnoError(res==VC_NOCTX, "vc_net_create()");
67 inline static WRAPPER_DECL void
68 Evc_ctx_migrate(xid_t xid)
70 FatalErrnoError(vc_ctx_migrate(xid)==-1, "vc_ctx_migrate()");
73 inline static WRAPPER_DECL void
74 Evc_net_migrate(nid_t nid)
76 FatalErrnoError(vc_net_migrate(nid)==-1, "vc_net_migrate()");
79 inline static WRAPPER_DECL void
80 Evc_get_cflags(xid_t xid, struct vc_ctx_flags *flags)
82 FatalErrnoError(vc_get_cflags(xid, flags)==-1, "vc_get_cflags()");
85 inline static WRAPPER_DECL void
86 Evc_set_cflags(xid_t xid, struct vc_ctx_flags const *flags)
88 FatalErrnoError(vc_set_cflags(xid, flags)==-1, "vc_set_cflags()");
91 inline static WRAPPER_DECL void
92 Evc_get_nflags(nid_t nid, struct vc_net_flags *flags)
94 FatalErrnoError(vc_get_nflags(nid, flags)==-1, "vc_get_nflags()");
97 inline static WRAPPER_DECL void
98 Evc_set_nflags(nid_t nid, struct vc_net_flags const *flags)
100 FatalErrnoError(vc_set_nflags(nid, flags)==-1, "vc_set_nflags()");
103 inline static WRAPPER_DECL void
104 Evc_set_vhi_name(xid_t xid, vc_uts_type type,
105 char const *val, size_t len)
107 FatalErrnoError(vc_set_vhi_name(xid,type,val,len)==-1, "vc_set_vhi_name()");
110 inline static WRAPPER_DECL void
111 Evc_get_ccaps(xid_t xid, struct vc_ctx_caps *caps)
113 FatalErrnoError(vc_get_ccaps(xid, caps)==-1, "vc_get_ccaps()");
116 inline static WRAPPER_DECL void
117 Evc_set_ccaps(xid_t xid, struct vc_ctx_caps const *caps)
119 FatalErrnoError(vc_set_ccaps(xid, caps)==-1, "vc_set_ccaps()");
122 inline static WRAPPER_DECL void
123 Evc_get_ncaps(nid_t nid, struct vc_net_caps *caps)
125 FatalErrnoError(vc_get_ncaps(nid, caps)==-1, "vc_get_ncaps()");
128 inline static WRAPPER_DECL void
129 Evc_set_ncaps(nid_t nid, struct vc_net_caps const *caps)
131 FatalErrnoError(vc_set_ncaps(nid, caps)==-1, "vc_set_ncaps()");
134 inline static WRAPPER_DECL void
135 Evc_set_namespace(xid_t xid, uint_least64_t mask)
137 FatalErrnoError(vc_set_namespace(xid, mask)==-1, "vc_set_namespace()");
140 inline static WRAPPER_DECL void
141 Evc_enter_namespace(xid_t xid, uint_least64_t mask)
143 FatalErrnoError(vc_enter_namespace(xid, mask)==-1, "vc_enter_namespace()");
146 inline static WRAPPER_DECL xid_t
147 Evc_xidopt2xid(char const *id, bool honor_static)
150 xid_t rc = vc_xidopt2xid(id, honor_static, &err);
151 if (__builtin_expect(rc==VC_NOCTX,0)) {
152 ENSC_DETAIL1(msg, "vc_xidopt2xid", id, 1);
154 FatalErrnoErrorFail(msg);
157 size_t l1 = strlen(msg);
158 size_t l2 = strlen(err);
159 char buf[l1 + l2 + sizeof(": ")];
160 memcpy(buf, msg, l1);
161 memcpy(buf+l1, ": ", 2);
162 memcpy(buf+l1+2, err, l2+1);
164 FatalErrnoErrorFail(buf);
172 inline static WRAPPER_DECL nid_t
173 Evc_nidopt2nid(char const *id, bool honor_static)
176 nid_t rc = vc_nidopt2nid(id, honor_static, &err);
177 if (__builtin_expect(rc==VC_NOCTX,0)) {
178 ENSC_DETAIL1(msg, "vc_nidopt2nid", id, 1);
179 FatalErrnoErrorFail(msg);