From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Egger Subject: [PATCH 5/6] libxl: portiblity fixes Date: Tue, 27 Jul 2010 14:20:01 +0200 Message-ID: <201007271420.01834.Christoph.Egger@amd.com> References: <201007201831.21416.Christoph.Egger@amd.com> <201007271417.51761.Christoph.Egger@amd.com> <201007271418.52038.Christoph.Egger@amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_x7sTMmQW5anh2kz" Return-path: In-Reply-To: <201007271418.52038.Christoph.Egger@amd.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson Cc: "xen-devel@lists.xensource.com" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org --Boundary-00=_x7sTMmQW5anh2kz Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Signed-off-by: Christoph Egger -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632 --Boundary-00=_x7sTMmQW5anh2kz Content-Type: text/x-diff; charset="iso 8859-15"; name="xen_tools_libxl5.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xen_tools_libxl5.diff" 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; +} --Boundary-00=_x7sTMmQW5anh2kz Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_x7sTMmQW5anh2kz--