|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 5/5] libxc: rumpxen: provide xc_osdep_info
This allows programs which use the bulk of libxc to link. We use
/dev/xenevt for event channels, the raw minios functions for privcmd
and gnttab, and the netbsd versions of discard_file_cache and
xc_memalign.
Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
tools/libxc/Makefile | 2 ++
tools/libxc/xc_minios_common.c | 34 ++++++++++++++++++++++-
tools/libxc/xc_netbsd_rumpkern.c | 59 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+), 1 deletion(-)
create mode 100644 tools/libxc/xc_netbsd_rumpkern.c
diff --git a/tools/libxc/Makefile b/tools/libxc/Makefile
index 8bf7344..c8a5442 100644
--- a/tools/libxc/Makefile
+++ b/tools/libxc/Makefile
@@ -48,6 +48,8 @@ CTRL_SRCS-$(CONFIG_FreeBSD) += xc_freebsd.c xc_freebsd_osdep.c
CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
CTRL_SRCS-$(CONFIG_NetBSD) += xc_netbsd.c xc_netbsd_evtchn.c
CTRL_SRCS-$(CONFIG_MiniOS) += xc_minios.c xc_minios_common.c
+CTRL_SRCS-$(CONFIG_NetBSDRump) += xc_netbsd_rumpkern.c xc_netbsd_evtchn.c
+CTRL_SRCS-$(CONFIG_NetBSDRump) += xc_minios_common.c
GUEST_SRCS-y :=
GUEST_SRCS-y += xg_private.c xc_suspend.c
diff --git a/tools/libxc/xc_minios_common.c b/tools/libxc/xc_minios_common.c
index c38b5f2..fd201fd 100644
--- a/tools/libxc/xc_minios_common.c
+++ b/tools/libxc/xc_minios_common.c
@@ -43,7 +43,17 @@
#ifdef __RUMPRUN__
# define map_frames_ex minios_map_frames_ex
-#endif /* __RUMPRUN__ */
+
+static xc_osdep_handle minios_privcmd_open(xc_interface *xch)
+{
+ return 1;
+}
+static int minios_privcmd_close(xc_interface *xch, xc_osdep_handle h)
+{
+ return 0;
+}
+
+#else /* !__RUMPRUN__ */
void minios_interface_close_fd(int fd);
void minios_gnttab_close_fd(int fd);
@@ -69,6 +79,8 @@ void minios_interface_close_fd(int fd)
files[fd].type = FTYPE_NONE;
}
+#endif /* !__RUMPRUN__ */
+
static void *minios_privcmd_alloc_hypercall_buffer(xc_interface *xch,
xc_osdep_handle h,
int npages)
@@ -208,6 +220,24 @@ struct xc_osdep_ops xc_privcmd_ops = {
},
};
+#ifdef __RUMPRUN__
+
+static struct gntmap static_gntmap;
+
+#define GNTMAP(h) static_gntmap
+
+static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
+{
+ return 1;
+}
+
+static int minios_gnttab_close(xc_gnttab *xcg, xc_osdep_handle h)
+{
+ return 0;
+}
+
+#else /* !__RUMPRUN__ */
+
#define GNTMAP(h) (files[(int)(h)].gntmap)
static xc_osdep_handle minios_gnttab_open(xc_gnttab *xcg)
@@ -231,6 +261,8 @@ void minios_gnttab_close_fd(int fd)
files[fd].type = FTYPE_NONE;
}
+#endif /* !__RUMPRUN__ */
+
static void *minios_gnttab_grant_map(xc_gnttab *xcg, xc_osdep_handle h,
uint32_t count, int flags, int prot,
uint32_t *domids, uint32_t *refs,
diff --git a/tools/libxc/xc_netbsd_rumpkern.c b/tools/libxc/xc_netbsd_rumpkern.c
new file mode 100644
index 0000000..882374a
--- /dev/null
+++ b/tools/libxc/xc_netbsd_rumpkern.c
@@ -0,0 +1,59 @@
+/******************************************************************************
+ *
+ * Copyright 2013 Citrix.
+ * Use is subject to license terms.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
+ */
+
+#include "xc_private.h"
+
+#include <xen/sys/evtchn.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <malloc.h>
+#include <sys/mman.h>
+
+static struct xc_osdep_ops *rumpxen_osdep_init(xc_interface *xch,
+ enum xc_osdep_type type)
+{
+ switch ( type )
+ {
+ case XC_OSDEP_PRIVCMD:
+ return &xc_privcmd_ops;
+ case XC_OSDEP_EVTCHN:
+ return &xc_evtchn_ops;
+ case XC_OSDEP_GNTTAB:
+ return &xc_gnttab_ops;
+ default:
+ return NULL;
+ }
+}
+
+xc_osdep_info_t xc_osdep_info = {
+ .name = "Rump kernel OS interface",
+ .init = &rumpxen_osdep_init,
+ .fake = 0,
+};
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |