From nobody Fri Mar 29 13:20:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557414997; cv=none; d=zoho.com; s=zohoarc; b=P3EJ28yfCc8SCtoew5Mr32wVq5x/YWV7xizKX6uQ779nVMtCZxo9I2kkcIcN+jGBqTR5s/GNak4vEyq6Wg5DVPJtn+ry+BuFcDj0lLOvv/rUmdosZRfCr4yKFnT95gUglGtTtYOt0V4GDQSpEZLgRiysx0tP1kaG1YnpfjZjKtg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557414997; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=WbJ9DWadyihItzdTfEeZPPxgC/FZ5x6ReVBoc+F1i+s=; b=gOwr8nlC/MbPuWNnSm9kJMDw2VIiwvx5FrwSlzSapru5QdNvd9s/49WfKTCyv00wGaJEMkJnHNrGWb8ILY4TklJtwZD4LPBrEyJFH4gwJFKl7kamBYNRDlnUPxVmDaW9/sKu7yRFphghaCyO9K9V3o85y4EU5ziroyUNmLQZ8+w= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1557414997658881.7567819189406; Thu, 9 May 2019 08:16:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9FD2EC070E13; Thu, 9 May 2019 15:16:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 41C045DE78; Thu, 9 May 2019 15:16:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7FB2D18089D1; Thu, 9 May 2019 15:16:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x49FGMws019202 for ; Thu, 9 May 2019 11:16:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7A3FB27BCE; Thu, 9 May 2019 15:16:22 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02CBD27BBF for ; Thu, 9 May 2019 15:16:21 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 9 May 2019 17:16:15 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] node_device_udev: remove deprecated logging function X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 09 May 2019 15:16:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The function was deprecated in udev 219 and all the supported OSes don't have older version of udev or systemd. Signed-off-by: Pavel Hrdina Reviewed-by: J=C3=A1n Tomko --- m4/virt-udev.m4 | 5 ---- src/node_device/node_device_udev.c | 41 ------------------------------ 2 files changed, 46 deletions(-) diff --git a/m4/virt-udev.m4 b/m4/virt-udev.m4 index be7dba5d2d..cf977c650b 100644 --- a/m4/virt-udev.m4 +++ b/m4/virt-udev.m4 @@ -30,11 +30,6 @@ AC_DEFUN([LIBVIRT_CHECK_UDEV],[ fi =20 if test "$with_udev" =3D "yes" ; then - PKG_CHECK_EXISTS([libudev >=3D 218], [with_udev_logging=3Dno], [with_= udev_logging=3Dyes]) - if test "$with_udev_logging" =3D "yes" ; then - AC_DEFINE_UNQUOTED([HAVE_UDEV_LOGGING], 1, [whether libudev loggin= g can be used]) - fi - old_CFLAGS=3D"$CFLAGS" old_LIBS=3D"$LIBS" CFLAGS=3D"$CFLAGS $UDEV_CFLAGS" diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 7dd9804a0e..5df2fd72f3 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -318,43 +318,6 @@ udevGenerateDeviceName(struct udev_device *device, } =20 =20 -#if HAVE_UDEV_LOGGING -typedef void -(*udevLogFunctionPtr)(struct udev *udev, - int priority, - const char *file, - int line, - const char *fn, - const char *format, - va_list args); - -static void -ATTRIBUTE_FMT_PRINTF(6, 0) -udevLogFunction(struct udev *udev ATTRIBUTE_UNUSED, - int priority, - const char *file, - int line, - const char *fn, - const char *fmt, - va_list args) -{ - virBuffer buf =3D VIR_BUFFER_INITIALIZER; - char *format =3D NULL; - - virBufferAdd(&buf, fmt, -1); - virBufferTrim(&buf, "\n", -1); - - format =3D virBufferContentAndReset(&buf); - - virLogVMessage(&virLogSelf, - virLogPriorityFromSyslog(priority), - file, line, fn, NULL, format ? format : fmt, args); - - VIR_FREE(format); -} -#endif - - static int udevTranslatePCIIds(unsigned int vendor, unsigned int product, @@ -1872,10 +1835,6 @@ nodeStateInitialize(bool privileged, _("failed to create udev context")); goto cleanup; } -#if HAVE_UDEV_LOGGING - /* cast to get rid of missing-format-attribute warning */ - udev_set_log_fn(udev, (udevLogFunctionPtr) udevLogFunction); -#endif =20 virObjectLock(priv); =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 13:20:21 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557415018; cv=none; d=zoho.com; s=zohoarc; b=Qw/9bABJAxub8O8ynGJO4xm1Fr2imCLHm7HjALy5E6HagDEEDwT1qTjfKZy16K/QnKp43PR5W/4FgE5FC23RQOKgjL41kCTZKf5s1sek5GLv9gv18/DX3qdjPM6mCxCzA7j/XVt9JodB1Heac1vf99p7GaoGuPrbkSKSNK/ISJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557415018; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=GJ+8K8QeoG/MXEdyMVOlO8p4CJjISXyyalZYmUiof3Y=; b=CBDITb/aDgmVtlwPH3E1saDkrVmKSV3IFR231NVxayrU1mQRRirnU8UmIDAYEKXgkgBXEYWq0/e5RlEUaAGbrmdB+cEBqexujVJJgP6Cm4RKZlWtKPYfJ+5domC+gIM0Ns8ilRQbpn5WmgGRCOGaOdN4XiLvaWovvsk09xgKT0E= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1557415018269119.8624665330691; Thu, 9 May 2019 08:16:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D7E2308A100; Thu, 9 May 2019 15:16:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 067B160C10; Thu, 9 May 2019 15:16:56 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BC3B141F58; Thu, 9 May 2019 15:16:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x49FGNE1019212 for ; Thu, 9 May 2019 11:16:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9A6B216D20; Thu, 9 May 2019 15:16:23 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.63]) by smtp.corp.redhat.com (Postfix) with ESMTP id C912027BBF for ; Thu, 9 May 2019 15:16:22 +0000 (UTC) From: Pavel Hrdina To: libvir-list@redhat.com Date: Thu, 9 May 2019 17:16:16 +0200 Message-Id: <856cf5b7ea83c6dada7f554de2df2953c5498cc6.1557414812.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] src: remove HAL node device driver X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 09 May 2019 15:16:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The HAL driver is not used by any supported Linux, the only possible user could be FreeBSD, but the official libvirt port disables HAL driver unconditionally which means probably nobody is using it there. Signed-off-by: Pavel Hrdina --- HAL was deprecated on FreeBSD as well and the current supported device manager is *devd*. If there will be need to implement node device support on FreeBSD we can add a new DEVD driver or we can use libudev-devd project to support UDEV driver on FreeBSD. configure.ac | 3 +- docs/drvnodedev.html.in | 3 +- docs/hvsupport.pl | 2 +- libvirt.spec.in | 1 - m4/virt-hal.m4 | 10 +- po/POTFILES | 1 - src/node_device/Makefile.inc.am | 12 - src/node_device/node_device_driver.c | 10 +- src/node_device/node_device_driver.h | 5 - src/node_device/node_device_hal.c | 804 --------------------------- src/node_device/node_device_hal.h | 22 - 11 files changed, 9 insertions(+), 864 deletions(-) delete mode 100644 src/node_device/node_device_hal.c delete mode 100644 src/node_device/node_device_hal.h diff --git a/configure.ac b/configure.ac index fabec815db..cbec6b9e14 100644 --- a/configure.ac +++ b/configure.ac @@ -794,7 +794,7 @@ AC_SUBST([LV_LIBTOOL_OBJDIR]) =20 =20 with_nodedev=3Dno; -if test "$with_hal" =3D "yes" || test "$with_udev" =3D "yes"; +if test "$with_udev" =3D "yes"; then with_nodedev=3Dyes AC_DEFINE_UNQUOTED([WITH_NODE_DEVICES], 1, [with node device driver]) @@ -995,7 +995,6 @@ LIBVIRT_RESULT_FIREWALLD_ZONE LIBVIRT_RESULT_FUSE LIBVIRT_RESULT_GLUSTER LIBVIRT_RESULT_GNUTLS -LIBVIRT_RESULT_HAL LIBVIRT_RESULT_LIBISCSI LIBVIRT_RESULT_LIBNL LIBVIRT_RESULT_LIBPCAP diff --git a/docs/drvnodedev.html.in b/docs/drvnodedev.html.in index 71a8a57b0c..8582f18655 100644 --- a/docs/drvnodedev.html.in +++ b/docs/drvnodedev.html.in @@ -23,8 +23,7 @@ (more info = about NPIV)). Devices on the host system are arranged in a tree-like hierarchy, wi= th the root node being called computer. The node device dr= iver - supports two backends to manage the devices, HAL and udev, with the = former - being deprecated in favour of the latter. + supports one backend to manage the devices, udev.

=20

diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl index a2b980c502..1554e9985e 100755 --- a/docs/hvsupport.pl +++ b/docs/hvsupport.pl @@ -38,7 +38,7 @@ my %groupheaders =3D ( my @srcs; find({ wanted =3D> sub { - if (m!$srcdir/.*/\w+_(driver|common|tmpl|monitor|hal|udev)\.c$!) { + if (m!$srcdir/.*/\w+_(driver|common|tmpl|monitor|udev)\.c$!) { push @srcs, $_ if $_ !~ /vbox_driver\.c/; } }, no_chdir =3D> 1}, $srcdir); diff --git a/libvirt.spec.in b/libvirt.spec.in index e07041c0b9..c90c1a0f2c 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -1198,7 +1198,6 @@ rm -f po/stamp-po --with-selinux \ %{?arg_selinux_mount} \ --without-apparmor \ - --without-hal \ --with-udev \ --with-yajl \ %{?arg_sanlock} \ diff --git a/m4/virt-hal.m4 b/m4/virt-hal.m4 index e37bbf979b..35391f0d2b 100644 --- a/m4/virt-hal.m4 +++ b/m4/virt-hal.m4 @@ -18,13 +18,11 @@ dnl . dnl =20 AC_DEFUN([LIBVIRT_ARG_HAL],[ - LIBVIRT_ARG_WITH_FEATURE([HAL], [hal], [check], [0.5.0]) + LIBVIRT_ARG_WITH([HAL], [hal was removed], [no]) ]) =20 AC_DEFUN([LIBVIRT_CHECK_HAL],[ - LIBVIRT_CHECK_PKG([HAL], [hal], [0.5.0]) -]) - -AC_DEFUN([LIBVIRT_RESULT_HAL],[ - LIBVIRT_RESULT_LIB([HAL]) + if test "$with_hal" !=3D "no" ; then + AC_MSG_ERROR([HAL node device driver was removed from libvirt]) + fi ]) diff --git a/po/POTFILES b/po/POTFILES index 9dd4ee7d99..aff1ecfee2 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -110,7 +110,6 @@ src/network/bridge_driver.c src/network/bridge_driver_linux.c src/network/leaseshelper.c src/node_device/node_device_driver.c -src/node_device/node_device_hal.c src/node_device/node_device_udev.c src/nwfilter/nwfilter_dhcpsnoop.c src/nwfilter/nwfilter_driver.c diff --git a/src/node_device/Makefile.inc.am b/src/node_device/Makefile.inc= .am index 3e04651e8c..9163ab53cf 100644 --- a/src/node_device/Makefile.inc.am +++ b/src/node_device/Makefile.inc.am @@ -5,11 +5,6 @@ NODE_DEVICE_DRIVER_SOURCES =3D \ node_device/node_device_driver.h \ $(NULL) =20 -NODE_DEVICE_DRIVER_HAL_SOURCES =3D \ - node_device/node_device_hal.c \ - node_device/node_device_hal.h \ - $(NULL) - NODE_DEVICE_DRIVER_UDEV_SOURCES =3D \ node_device/node_device_udev.c \ node_device/node_device_udev.h \ @@ -17,7 +12,6 @@ NODE_DEVICE_DRIVER_UDEV_SOURCES =3D \ =20 DRIVER_SOURCE_FILES +=3D \ $(NODE_DEVICE_DRIVER_SOURCES) \ - $(NODE_DEVICE_DRIVER_HAL_SOURCES) \ $(NODE_DEVICE_DRIVER_UDEV_SOURCES) \ $(NULL) =20 @@ -27,7 +21,6 @@ STATEFUL_DRIVER_SOURCE_FILES +=3D \ =20 EXTRA_DIST +=3D \ $(NODE_DEVICE_DRIVER_SOURCES) \ - $(NODE_DEVICE_DRIVER_HAL_SOURCES) \ $(NODE_DEVICE_DRIVER_UDEV_SOURCES) \ $(NULL) =20 @@ -46,11 +39,6 @@ libvirt_driver_nodedev_la_CFLAGS =3D \ libvirt_driver_nodedev_la_LDFLAGS =3D $(AM_LDFLAGS_MOD_NOUNDEF) libvirt_driver_nodedev_la_LIBADD =3D libvirt.la =20 -if WITH_HAL -libvirt_driver_nodedev_la_SOURCES +=3D $(NODE_DEVICE_DRIVER_HAL_SOURCES) -libvirt_driver_nodedev_la_CFLAGS +=3D $(HAL_CFLAGS) -libvirt_driver_nodedev_la_LIBADD +=3D $(HAL_LIBS) -endif WITH_HAL if WITH_UDEV libvirt_driver_nodedev_la_SOURCES +=3D $(NODE_DEVICE_DRIVER_UDEV_SOURCES) libvirt_driver_nodedev_la_CFLAGS +=3D \ diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_de= vice_driver.c index 8fb00d0c86..8608d6ade0 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -34,7 +34,6 @@ #include "node_device_conf.h" #include "node_device_event.h" #include "node_device_driver.h" -#include "node_device_hal.h" #include "node_device_util.h" #include "virvhba.h" #include "viraccessapicheck.h" @@ -105,14 +104,13 @@ int nodeConnectIsAlive(virConnectPtr conn ATTRIBUTE_U= NUSED) return 1; } =20 -#if defined (__linux__) && ( defined (WITH_HAL) || defined(WITH_UDEV)) +#if defined (__linux__) && defined(WITH_UDEV) /* NB: It was previously believed that changes in driver name were * relayed to libvirt as "change" events by udev, and the udev event * notification is setup to recognize such events and effectively * recreate the device entry in the cache. However, neither the kernel * nor udev sends such an event, so it is necessary to manually update - * the driver name for a device each time its entry is used, both for - * udev *and* HAL backends. + * the driver name for a device each time its entry is used. */ static int nodeDeviceUpdateDriverName(virNodeDeviceDefPtr def) @@ -632,9 +630,5 @@ nodedevRegister(void) { #ifdef WITH_UDEV return udevNodeRegister(); -#else -# ifdef WITH_HAL - return halNodeRegister(); -# endif #endif } diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_de= vice_driver.h index eae5e2cb17..bd5da485e4 100644 --- a/src/node_device/node_device_driver.h +++ b/src/node_device/node_device_driver.h @@ -27,11 +27,6 @@ =20 #define LINUX_NEW_DEVICE_WAIT_TIME 60 =20 -#ifdef WITH_HAL -int -halNodeRegister(void); -#endif - #ifdef WITH_UDEV int udevNodeRegister(void); diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_devic= e_hal.c deleted file mode 100644 index d1eb6c7851..0000000000 --- a/src/node_device/node_device_hal.c +++ /dev/null @@ -1,804 +0,0 @@ -/* - * node_device_hal.c: node device enumeration - HAL-based implementation - * - * Copyright (C) 2011-2015 Red Hat, Inc. - * Copyright (C) 2008 Virtual Iron Software, Inc. - * Copyright (C) 2008 David F. Lively - * - * 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; either - * version 2.1 of the License, or (at your option) any later version. - * - * 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, see - * . - */ - -#include - -#include - -#include "node_device_conf.h" -#include "node_device_driver.h" -#include "node_device_hal.h" -#include "virerror.h" -#include "driver.h" -#include "datatypes.h" -#include "viralloc.h" -#include "viruuid.h" -#include "virpci.h" -#include "virlog.h" -#include "virdbus.h" -#include "virstring.h" - -#define VIR_FROM_THIS VIR_FROM_NODEDEV - -VIR_LOG_INIT("node_device.node_device_hal"); - -/* - * Host device enumeration (HAL implementation) - */ - -#define DRV_STATE_HAL_CTX(ds) ((LibHalContext *)((ds)->privateData)) - - -static const char * -hal_name(const char *udi) -{ - const char *name =3D strrchr(udi, '/'); - if (name) - return name + 1; - return udi; -} - - -static int -get_str_prop(LibHalContext *ctxt, const char *udi, - const char *prop, char **val_p) -{ - char *val =3D libhal_device_get_property_string(ctxt, udi, prop, NULL); - - if (val) { - if (*val) { - *val_p =3D val; - return 0; - } else { - /* Treat empty strings as NULL values */ - VIR_FREE(val); - } - } - - return -1; -} - -static int -get_int_prop(LibHalContext *ctxt, const char *udi, - const char *prop, int *val_p) -{ - DBusError err; - int val; - int rv; - - dbus_error_init(&err); - val =3D libhal_device_get_property_int(ctxt, udi, prop, &err); - rv =3D dbus_error_is_set(&err); - dbus_error_free(&err); - if (rv =3D=3D 0) - *val_p =3D val; - - return rv; -} - -static int -get_bool_prop(LibHalContext *ctxt, const char *udi, - const char *prop, int *val_p) -{ - DBusError err; - int val; - int rv; - - dbus_error_init(&err); - val =3D libhal_device_get_property_bool(ctxt, udi, prop, &err); - rv =3D dbus_error_is_set(&err); - dbus_error_free(&err); - if (rv =3D=3D 0) - *val_p =3D val; - - return rv; -} - -static int -get_uint64_prop(LibHalContext *ctxt, const char *udi, - const char *prop, unsigned long long *val_p) -{ - DBusError err; - unsigned long long val; - int rv; - - dbus_error_init(&err); - val =3D libhal_device_get_property_uint64(ctxt, udi, prop, &err); - rv =3D dbus_error_is_set(&err); - dbus_error_free(&err); - if (rv =3D=3D 0) - *val_p =3D val; - - return rv; -} - -static int -gather_pci_cap(LibHalContext *ctx, const char *udi, - virNodeDevCapDataPtr d) -{ - char *sysfs_path; - - if (get_str_prop(ctx, udi, "pci.linux.sysfs_path", &sysfs_path) =3D=3D= 0) { - char *p =3D strrchr(sysfs_path, '/'); - if (p) { - ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.domain)); - ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.bus)); - ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.slot)); - ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.function= )); - } - - if (virNodeDeviceGetPCIDynamicCaps(sysfs_path, &d->pci_dev) < 0) { - VIR_FREE(sysfs_path); - return -1; - } - VIR_FREE(sysfs_path); - } - - (void)get_int_prop(ctx, udi, "pci.vendor_id", (int *)&d->pci_dev.vendo= r); - if (get_str_prop(ctx, udi, "pci.vendor", &d->pci_dev.vendor_name) !=3D= 0) - (void)get_str_prop(ctx, udi, "info.vendor", &d->pci_dev.vendor_nam= e); - (void)get_int_prop(ctx, udi, "pci.product_id", (int *)&d->pci_dev.prod= uct); - if (get_str_prop(ctx, udi, "pci.product", &d->pci_dev.product_name) != =3D 0) - (void)get_str_prop(ctx, udi, "info.product", &d->pci_dev.product_n= ame); - - return 0; -} - - -static int -gather_usb_cap(LibHalContext *ctx, const char *udi, - virNodeDevCapDataPtr d) -{ - (void)get_int_prop(ctx, udi, "usb.interface.number", - (int *)&d->usb_if.number); - (void)get_int_prop(ctx, udi, "usb.interface.class", - (int *)&d->usb_if.klass); - (void)get_int_prop(ctx, udi, "usb.interface.subclass", - (int *)&d->usb_if.subclass); - (void)get_int_prop(ctx, udi, "usb.interface.protocol", - (int *)&d->usb_if.protocol); - (void)get_str_prop(ctx, udi, "usb.interface.description", - &d->usb_if.description); - return 0; -} - - -static int -gather_usb_device_cap(LibHalContext *ctx, const char *udi, - virNodeDevCapDataPtr d) -{ - (void)get_int_prop(ctx, udi, "usb_device.bus_number", - (int *)&d->usb_dev.bus); - (void)get_int_prop(ctx, udi, "usb_device.linux.device_number", - (int *)&d->usb_dev.device); - (void)get_int_prop(ctx, udi, "usb_device.vendor_id", - (int *)&d->usb_dev.vendor); - if (get_str_prop(ctx, udi, "usb_device.vendor", - &d->usb_dev.vendor_name) !=3D 0) - (void)get_str_prop(ctx, udi, "info.vendor", &d->usb_dev.vendor_nam= e); - (void)get_int_prop(ctx, udi, "usb_device.product_id", - (int *)&d->usb_dev.product); - if (get_str_prop(ctx, udi, "usb_device.product", - &d->usb_dev.product_name) !=3D 0) - (void)get_str_prop(ctx, udi, "info.product", &d->usb_dev.product_n= ame); - return 0; -} - - -static int -gather_net_cap(LibHalContext *ctx, const char *udi, - virNodeDevCapDataPtr d) -{ - unsigned long long dummy; - (void)get_str_prop(ctx, udi, "net.interface", &d->net.ifname); - (void)get_str_prop(ctx, udi, "net.address", &d->net.address); - if (get_uint64_prop(ctx, udi, "net.80203.mac_address", - &dummy) =3D=3D 0) - d->net.subtype =3D VIR_NODE_DEV_CAP_NET_80203; - else if (get_uint64_prop(ctx, udi, "net.80211.mac_address", - &dummy) =3D=3D 0) - d->net.subtype =3D VIR_NODE_DEV_CAP_NET_80211; - else - d->net.subtype =3D VIR_NODE_DEV_CAP_NET_LAST; - - return 0; -} - - -static int -gather_scsi_host_cap(LibHalContext *ctx, const char *udi, - virNodeDevCapDataPtr d) -{ - int retval =3D 0; - - (void)get_int_prop(ctx, udi, "scsi_host.host", (int *)&d->scsi_host.ho= st); - - retval =3D virNodeDeviceGetSCSIHostCaps(&d->scsi_host); - - if (retval =3D=3D -1) - goto out; - - out: - return retval; -} - - -static int -gather_scsi_cap(LibHalContext *ctx, const char *udi, - virNodeDevCapDataPtr d) -{ - (void)get_int_prop(ctx, udi, "scsi.host", (int *)&d->scsi.host); - (void)get_int_prop(ctx, udi, "scsi.bus", (int *)&d->scsi.bus); - (void)get_int_prop(ctx, udi, "scsi.target", (int *)&d->scsi.target); - (void)get_int_prop(ctx, udi, "scsi.lun", (int *)&d->scsi.lun); - (void)get_str_prop(ctx, udi, "scsi.type", &d->scsi.type); - return 0; -} - - -static int -gather_storage_cap(LibHalContext *ctx, const char *udi, - virNodeDevCapDataPtr d) -{ - int val; - (void)get_str_prop(ctx, udi, "block.device", &d->storage.block); - (void)get_str_prop(ctx, udi, "storage.bus", &d->storage.bus); - (void)get_str_prop(ctx, udi, "storage.drive_type", &d->storage.drive_t= ype); - (void)get_str_prop(ctx, udi, "storage.model", &d->storage.model); - (void)get_str_prop(ctx, udi, "storage.vendor", &d->storage.vendor); - (void)get_str_prop(ctx, udi, "storage.serial", &d->storage.serial); - if (get_bool_prop(ctx, udi, "storage.removable", &val) =3D=3D 0 && val= ) { - d->storage.flags |=3D VIR_NODE_DEV_CAP_STORAGE_REMOVABLE; - if (get_bool_prop(ctx, udi, "storage.removable.media_available", - &val) =3D=3D 0 && val) { - d->storage.flags |=3D - VIR_NODE_DEV_CAP_STORAGE_REMOVABLE_MEDIA_AVAILABLE; - (void)get_uint64_prop(ctx, udi, "storage.removable.media_size", - &d->storage.removable_media_size); - } - } else { - (void)get_uint64_prop(ctx, udi, "storage.size", &d->storage.size); - } - if (get_bool_prop(ctx, udi, "storage.hotpluggable", &val) =3D=3D 0 && = val) - d->storage.flags |=3D VIR_NODE_DEV_CAP_STORAGE_HOTPLUGGABLE; - return 0; -} - -static int -gather_scsi_generic_cap(LibHalContext *ctx, const char *udi, - virNodeDevCapDataPtr d) -{ - (void)get_str_prop(ctx, udi, "scsi_generic.device", &d->sg.path); - return 0; -} - - -static int -gather_system_cap(LibHalContext *ctx, const char *udi, - virNodeDevCapDataPtr d) -{ - char *uuidstr; - - (void)get_str_prop(ctx, udi, "system.product", &d->system.product_name= ); - (void)get_str_prop(ctx, udi, "system.hardware.vendor", - &d->system.hardware.vendor_name); - (void)get_str_prop(ctx, udi, "system.hardware.version", - &d->system.hardware.version); - (void)get_str_prop(ctx, udi, "system.hardware.serial", - &d->system.hardware.serial); - if (get_str_prop(ctx, udi, "system.hardware.uuid", &uuidstr) =3D=3D 0)= { - ignore_value(virUUIDParse(uuidstr, d->system.hardware.uuid)); - VIR_FREE(uuidstr); - } - (void)get_str_prop(ctx, udi, "system.firmware.vendor", - &d->system.firmware.vendor_name); - (void)get_str_prop(ctx, udi, "system.firmware.version", - &d->system.firmware.version); - (void)get_str_prop(ctx, udi, "system.firmware.release_date", - &d->system.firmware.release_date); - return 0; -} - - -struct _caps_tbl_entry { - const char *cap_name; - virNodeDevCapType type; - int (*gather_fn)(LibHalContext *ctx, - const char *udi, - virNodeDevCapDataPtr data); -}; - -typedef struct _caps_tbl_entry caps_tbl_entry; - -static caps_tbl_entry caps_tbl[] =3D { - { "system", VIR_NODE_DEV_CAP_SYSTEM, gather_system_cap }, - { "pci", VIR_NODE_DEV_CAP_PCI_DEV, gather_pci_cap }, - { "usb", VIR_NODE_DEV_CAP_USB_INTERFACE, gather_usb_cap }, - { "usb_device", VIR_NODE_DEV_CAP_USB_DEV, gather_usb_device_cap = }, - { "net", VIR_NODE_DEV_CAP_NET, gather_net_cap }, - { "scsi_host", VIR_NODE_DEV_CAP_SCSI_HOST, gather_scsi_host_cap }, - { "scsi", VIR_NODE_DEV_CAP_SCSI, gather_scsi_cap }, - { "storage", VIR_NODE_DEV_CAP_STORAGE, gather_storage_cap }, - { "scsi_generic", VIR_NODE_DEV_CAP_SCSI_GENERIC, gather_scsi_generic_c= ap }, -}; - - -/* qsort/bsearch string comparator */ -static int -cmpstringp(const void *p1, const void *p2) -{ - /* from man 3 qsort */ - return strcmp(* (char * const *) p1, * (char * const *) p2); -} - - -static int -gather_capability(LibHalContext *ctx, const char *udi, - const char *cap_name, - virNodeDevCapsDefPtr *caps_p) -{ - caps_tbl_entry *entry; - - entry =3D bsearch(&cap_name, caps_tbl, ARRAY_CARDINALITY(caps_tbl), - sizeof(caps_tbl[0]), cmpstringp); - - if (entry) { - virNodeDevCapsDefPtr caps; - if (VIR_ALLOC(caps) < 0) - return ENOMEM; - caps->data.type =3D entry->type; - if (entry->gather_fn) { - int rv =3D (*entry->gather_fn)(ctx, udi, &caps->data); - if (rv !=3D 0) { - virNodeDevCapsDefFree(caps); - return rv; - } - } - caps->next =3D *caps_p; - *caps_p =3D caps; - } - - return 0; -} - - -static int -gather_capabilities(LibHalContext *ctx, const char *udi, - virNodeDevCapsDefPtr *caps_p) -{ - char *bus_name =3D NULL; - virNodeDevCapsDefPtr caps =3D NULL; - char **hal_cap_names =3D NULL; - int rv; - size_t i; - - if (STREQ(udi, "/org/freedesktop/Hal/devices/computer")) { - rv =3D gather_capability(ctx, udi, "system", &caps); - if (rv !=3D 0) - goto failure; - } - - if (get_str_prop(ctx, udi, "info.subsystem", &bus_name) =3D=3D 0 || - get_str_prop(ctx, udi, "linux.subsystem", &bus_name) =3D=3D 0) { - rv =3D gather_capability(ctx, udi, bus_name, &caps); - if (rv !=3D 0) - goto failure; - } - - hal_cap_names =3D libhal_device_get_property_strlist(ctx, udi, - "info.capabilities", - NULL); - if (hal_cap_names) { - for (i =3D 0; hal_cap_names[i]; i++) { - if (! (bus_name && STREQ(hal_cap_names[i], bus_name))) { - rv =3D gather_capability(ctx, udi, hal_cap_names[i], &caps= ); - if (rv !=3D 0) - goto failure; - } - } - for (i =3D 0; hal_cap_names[i]; i++) - VIR_FREE(hal_cap_names[i]); - VIR_FREE(hal_cap_names); - } - VIR_FREE(bus_name); - - *caps_p =3D caps; - return 0; - - failure: - VIR_FREE(bus_name); - if (hal_cap_names) { - for (i =3D 0; hal_cap_names[i]; i++) - VIR_FREE(hal_cap_names[i]); - VIR_FREE(hal_cap_names); - } - while (caps) { - virNodeDevCapsDefPtr next =3D caps->next; - virNodeDevCapsDefFree(caps); - caps =3D next; - } - return rv; -} - -static void -dev_create(const char *udi) -{ - LibHalContext *ctx; - char *parent_key =3D NULL; - virNodeDeviceObjPtr obj =3D NULL; - virNodeDeviceDefPtr def =3D NULL; - virNodeDeviceDefPtr objdef; - const char *name =3D hal_name(udi); - int rv; - char *devicePath =3D NULL; - - nodeDeviceLock(); - ctx =3D DRV_STATE_HAL_CTX(driver); - - if (VIR_ALLOC(def) < 0) - goto failure; - - if (VIR_STRDUP(def->name, name) < 0) - goto failure; - - if (get_str_prop(ctx, udi, "info.parent", &parent_key) =3D=3D 0) { - if (VIR_STRDUP(def->parent, hal_name(parent_key)) < 0) { - VIR_FREE(parent_key); - goto failure; - } - VIR_FREE(parent_key); - } - - rv =3D gather_capabilities(ctx, udi, &def->caps); - if (rv !=3D 0) goto failure; - - if (def->caps =3D=3D NULL) - goto cleanup; - - /* Some devices don't have a path in sysfs, so ignore failure */ - (void)get_str_prop(ctx, udi, "linux.sysfs_path", &devicePath); - - if (!(obj =3D virNodeDeviceObjListAssignDef(driver->devs, def))) { - VIR_FREE(devicePath); - goto failure; - } - objdef =3D virNodeDeviceObjGetDef(obj); - - objdef->sysfs_path =3D devicePath; - - virNodeDeviceObjEndAPI(&obj); - - nodeDeviceUnlock(); - return; - - failure: - VIR_DEBUG("FAILED TO ADD dev %s", name); - cleanup: - virNodeDeviceDefFree(def); - nodeDeviceUnlock(); -} - -static void -dev_refresh(const char *udi) -{ - const char *name =3D hal_name(udi); - virNodeDeviceObjPtr obj; - - if ((obj =3D virNodeDeviceObjListFindByName(driver->devs, name))) { - /* Simply "rediscover" device -- incrementally handling changes - * to sub-capabilities (like net.80203) is nasty ... so avoid it. - */ - virNodeDeviceObjListRemove(driver->devs, obj); - virObjectUnref(obj); - dev_create(udi); - } else { - VIR_DEBUG("no device named %s", name); - } -} - -static void -device_added(LibHalContext *ctx ATTRIBUTE_UNUSED, - const char *udi) -{ - VIR_DEBUG("%s", hal_name(udi)); - dev_create(udi); -} - - -static void -device_removed(LibHalContext *ctx ATTRIBUTE_UNUSED, - const char *udi) -{ - const char *name =3D hal_name(udi); - virNodeDeviceObjPtr obj; - - obj =3D virNodeDeviceObjListFindByName(driver->devs, name); - VIR_DEBUG("%s", name); - if (obj) - virNodeDeviceObjListRemove(driver->devs, obj); - else - VIR_DEBUG("no device named %s", name); - virObjectUnref(obj); -} - - -static void -device_cap_added(LibHalContext *ctx, - const char *udi, const char *cap) -{ - const char *name =3D hal_name(udi); - virNodeDeviceObjPtr obj; - virNodeDeviceDefPtr def; - - VIR_DEBUG("%s %s", cap, name); - if ((obj =3D virNodeDeviceObjListFindByName(driver->devs, name))) { - def =3D virNodeDeviceObjGetDef(obj); - (void)gather_capability(ctx, udi, cap, &def->caps); - virNodeDeviceObjEndAPI(&obj); - } else { - VIR_DEBUG("no device named %s", name); - } -} - - -static void -device_cap_lost(LibHalContext *ctx ATTRIBUTE_UNUSED, - const char *udi, - const char *cap) -{ - const char *name =3D hal_name(udi); - VIR_DEBUG("%s %s", cap, name); - - dev_refresh(udi); -} - - -static void -device_prop_modified(LibHalContext *ctx ATTRIBUTE_UNUSED, - const char *udi, - const char *key, - dbus_bool_t is_removed ATTRIBUTE_UNUSED, - dbus_bool_t is_added ATTRIBUTE_UNUSED) -{ - const char *name =3D hal_name(udi); - VIR_DEBUG("%s %s", name, key); - - dev_refresh(udi); -} - - -static int -nodeStateInitialize(bool privileged ATTRIBUTE_UNUSED, - virStateInhibitCallback callback ATTRIBUTE_UNUSED, - void *opaque ATTRIBUTE_UNUSED) -{ - LibHalContext *hal_ctx =3D NULL; - char **udi =3D NULL; - int num_devs; - size_t i; - int ret =3D -1; - DBusConnection *sysbus; - DBusError err; - - /* Ensure caps_tbl is sorted by capability name */ - qsort(caps_tbl, ARRAY_CARDINALITY(caps_tbl), sizeof(caps_tbl[0]), - cmpstringp); - - if (VIR_ALLOC(driver) < 0) - return -1; - - if (virMutexInit(&driver->lock) < 0) { - VIR_FREE(driver); - return -1; - } - nodeDeviceLock(); - - if (!(driver->devs =3D virNodeDeviceObjListNew())) - goto failure; - - dbus_error_init(&err); - if (!(sysbus =3D virDBusGetSystemBus())) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("DBus not available, disabling HAL driver: %s"), - virGetLastErrorMessage()); - ret =3D 0; - goto failure; - } - - hal_ctx =3D libhal_ctx_new(); - if (hal_ctx =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libhal_ctx_new returned NULL")); - goto failure; - } - - if (!libhal_ctx_set_dbus_connection(hal_ctx, sysbus)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libhal_ctx_set_dbus_connection failed")); - goto failure; - } - if (!libhal_ctx_init(hal_ctx, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libhal_ctx_init failed, haldaemon is probably " - "not running")); - /* We don't want to show a fatal error here, - otherwise entire libvirtd shuts down when - hald isn't running */ - ret =3D 0; - goto failure; - } - - /* Populate with known devices */ - driver->privateData =3D hal_ctx; - - /* We need to unlock state now, since setting these callbacks cause - * a dbus RPC call, and while this call is waiting for the reply, - * a signal may already arrive, triggering the callback and thus - * requiring the lock ! - */ - nodeDeviceUnlock(); - - /* Register HAL event callbacks */ - if (!libhal_ctx_set_device_added(hal_ctx, device_added) || - !libhal_ctx_set_device_removed(hal_ctx, device_removed) || - !libhal_ctx_set_device_new_capability(hal_ctx, device_cap_added) || - !libhal_ctx_set_device_lost_capability(hal_ctx, device_cap_lost) || - !libhal_ctx_set_device_property_modified(hal_ctx, device_prop_modi= fied) || - !libhal_device_property_watch_all(hal_ctx, &err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("setting up HAL callbacks failed")); - goto failure; - } - - udi =3D libhal_get_all_devices(hal_ctx, &num_devs, &err); - if (udi =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libhal_get_all_devices failed")); - goto failure; - } - for (i =3D 0; i < num_devs; i++) { - dev_create(udi[i]); - VIR_FREE(udi[i]); - } - VIR_FREE(udi); - - return 0; - - failure: - if (dbus_error_is_set(&err)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s: %s"), err.name, err.message); - dbus_error_free(&err); - } - virNodeDeviceObjListFree(driver->devs); - if (hal_ctx) - (void)libhal_ctx_free(hal_ctx); - nodeDeviceUnlock(); - VIR_FREE(driver); - - return ret; -} - - -static int -nodeStateCleanup(void) -{ - if (driver) { - nodeDeviceLock(); - LibHalContext *hal_ctx =3D DRV_STATE_HAL_CTX(driver); - virNodeDeviceObjListFree(driver->devs); - (void)libhal_ctx_shutdown(hal_ctx, NULL); - (void)libhal_ctx_free(hal_ctx); - nodeDeviceUnlock(); - virMutexDestroy(&driver->lock); - VIR_FREE(driver); - return 0; - } - return -1; -} - - -static int -nodeStateReload(void) -{ - DBusError err; - char **udi =3D NULL; - int num_devs; - size_t i; - LibHalContext *hal_ctx; - - VIR_INFO("Reloading HAL device state"); - nodeDeviceLock(); - VIR_INFO("Removing existing objects"); - virNodeDeviceObjListFree(driver->devs); - nodeDeviceUnlock(); - - hal_ctx =3D DRV_STATE_HAL_CTX(driver); - VIR_INFO("Creating new objects"); - dbus_error_init(&err); - udi =3D libhal_get_all_devices(hal_ctx, &num_devs, &err); - if (udi =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libhal_get_all_devices failed")); - return -1; - } - for (i =3D 0; i < num_devs; i++) { - dev_create(udi[i]); - VIR_FREE(udi[i]); - } - VIR_FREE(udi); - VIR_INFO("HAL device reload complete"); - - return 0; -} - - -static virNodeDeviceDriver halNodeDeviceDriver =3D { - .name =3D "HAL", - .nodeNumOfDevices =3D nodeNumOfDevices, /* 0.5.0 */ - .nodeListDevices =3D nodeListDevices, /* 0.5.0 */ - .connectListAllNodeDevices =3D nodeConnectListAllNodeDevices, /* 0.10.= 2 */ - .nodeDeviceLookupByName =3D nodeDeviceLookupByName, /* 0.5.0 */ - .nodeDeviceLookupSCSIHostByWWN =3D nodeDeviceLookupSCSIHostByWWN, /* 1= .0.2 */ - .nodeDeviceGetXMLDesc =3D nodeDeviceGetXMLDesc, /* 0.5.0 */ - .nodeDeviceGetParent =3D nodeDeviceGetParent, /* 0.5.0 */ - .nodeDeviceNumOfCaps =3D nodeDeviceNumOfCaps, /* 0.5.0 */ - .nodeDeviceListCaps =3D nodeDeviceListCaps, /* 0.5.0 */ - .nodeDeviceCreateXML =3D nodeDeviceCreateXML, /* 0.6.5 */ - .nodeDeviceDestroy =3D nodeDeviceDestroy, /* 0.6.5 */ -}; - - -static virHypervisorDriver halHypervisorDriver =3D { - .name =3D "nodedev", - .connectOpen =3D nodeConnectOpen, /* 4.1.0 */ - .connectClose =3D nodeConnectClose, /* 4.1.0 */ - .connectIsEncrypted =3D nodeConnectIsEncrypted, /* 4.1.0 */ - .connectIsSecure =3D nodeConnectIsSecure, /* 4.1.0 */ - .connectIsAlive =3D nodeConnectIsAlive, /* 4.1.0 */ -}; - - -static virConnectDriver halConnectDriver =3D { - .localOnly =3D true, - .uriSchemes =3D (const char *[]){ "nodedev", NULL }, - .hypervisorDriver =3D &halHypervisorDriver, - .nodeDeviceDriver =3D &halNodeDeviceDriver, -}; - - -static virStateDriver halStateDriver =3D { - .name =3D "HAL", - .stateInitialize =3D nodeStateInitialize, /* 0.5.0 */ - .stateCleanup =3D nodeStateCleanup, /* 0.5.0 */ - .stateReload =3D nodeStateReload, /* 0.5.0 */ -}; - -int -halNodeRegister(void) -{ - if (virRegisterConnectDriver(&halConnectDriver, false) < 0) - return -1; - if (virSetSharedNodeDeviceDriver(&halNodeDeviceDriver) < 0) - return -1; - return virRegisterStateDriver(&halStateDriver); -} diff --git a/src/node_device/node_device_hal.h b/src/node_device/node_devic= e_hal.h deleted file mode 100644 index 5e9c25ae34..0000000000 --- a/src/node_device/node_device_hal.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * node_device_hal.h: node device enumeration - HAL-based implementation - * - * Copyright (C) 2009 Red Hat, Inc. - * - * 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; either - * version 2.1 of the License, or (at your option) any later version. - * - * 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, see - * . - * - */ - -#pragma once --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list