diff -r 73082ed01e88 -r 82c7ff060fa3 tools/libxl/Makefile --- a/tools/libxl/Makefile Tue Jul 27 13:56:32 2010 +0200 +++ b/tools/libxl/Makefile Tue Jul 27 13:58:00 2010 +0200 @@ -18,6 +18,8 @@ LIBS = $(LDFLAGS_libxenctrl) $(LDFLAGS_libxenguest) $(LDFLAGS_libxenstore) $(LDFLAGS_libblktapctl) $(UTIL_LIBS) LIBXL_OBJS-y = osdeps.o libxl_paths.o libxl_bootloader.o +LIBXL_OBJS-$(CONFIG_Linux) += libxl_linux.o +LIBXL_OBJS-$(CONFIG_NetBSD) += libxl_netbsd.o LIBXL_OBJS = flexarray.o libxl.o libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o libxl_internal.o xenguest.o libxl_utils.o $(LIBXL_OBJS-y) AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h diff -r 73082ed01e88 -r 82c7ff060fa3 tools/libxl/libxl_linux.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxl/libxl_linux.c Tue Jul 27 13:58:00 2010 +0200 @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Advanced Micro Devices + * Author Christoph Egger + * + * This program 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 only. + * + * 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 Lesser General Public License for more details. + */ + +#include "libxl.h" +#include "libxl_osdeps.h" + +#include "tap-ctl.h" + +int libxl_blktap_enabled(struct libxl_ctx *ctx) +{ + const char *msg; + return !tap_ctl_check(&msg); +} + +const char *libxl_blktap_devpath(struct libxl_ctx *ctx, + const char *disk, + libxl_disk_phystype phystype) +{ + const char *type; + char *params, *devname; + int minor, err; + + type = device_disk_string_of_phystype(phystype); + minor = tap_ctl_find_minor(type, disk); + if (minor >= 0) { + devname = libxl_sprintf(ctx, "/dev/xen/blktap-2/tapdev%d", minor); + if (devname) + return devname; + } + + params = libxl_sprintf(ctx, "%s:%s", type, disk); + err = tap_ctl_create(params, &devname); + if (!err) { + libxl_ptr_add(ctx, devname); + return devname; + } + + return NULL; +} diff -r 73082ed01e88 -r 82c7ff060fa3 tools/libxl/libxl_netbsd.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxl/libxl_netbsd.c Tue Jul 27 13:58:00 2010 +0200 @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2010 Advanced Micro Devices + * Author Christoph Egger + * + * This program 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 only. + * + * 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 Lesser General Public License for more details. + */ + +#include "libxl.h" +#include "libxl_osdeps.h" + +int libxl_blktap_enabled(struct libxl_ctx *ctx) +{ + return 0; +} + +const char *libxl_blktap_devpath(struct libxl_ctx *ctx, + const char *disk, + libxl_disk_phystype phystype) +{ + return NULL; +}