From nobody Thu May 15 14:01:54 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1508334767236747.1438653934217; Wed, 18 Oct 2017 06:52:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E80E7C047B8B; Wed, 18 Oct 2017 13:52:45 +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 C72D26A531; Wed, 18 Oct 2017 13:52:45 +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 901171800C9B; Wed, 18 Oct 2017 13:52:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9IDqiWP009702 for ; Wed, 18 Oct 2017 09:52:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id E08CA91D84; Wed, 18 Oct 2017 13:52:44 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03AA69D7CD; Wed, 18 Oct 2017 13:52:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E80E7C047B8B Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Erik Skultety To: libvir-list@redhat.com Date: Wed, 18 Oct 2017 15:52:23 +0200 Message-Id: <1c107d5648efe253e6781b77d5c0fa3f13379ba9.1508333637.git.eskultet@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH v6 1/9] nodedev: Move privileged flag from udev private data to driver's state 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: , MIME-Version: 1.0 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 18 Oct 2017 13:52:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Even though hal doesn't make use of it, the privileged flag is related to the daemon/driver rather than the backend actually used. While at it, get rid of some tab indentation in the driver state struct. Signed-off-by: Erik Skultety --- src/conf/virnodedeviceobj.h | 1 + src/node_device/node_device_udev.c | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h index e7c26abbd..87f908369 100644 --- a/src/conf/virnodedeviceobj.h +++ b/src/conf/virnodedeviceobj.h @@ -40,6 +40,7 @@ struct _virNodeDeviceDriverState { =20 virNodeDeviceObjListPtr devs; /* currently-known devices */ void *privateData; /* driver-specific private data */ + bool privileged; /* whether we run in privileged mo= de */ =20 /* Immutable pointer, self-locking APIs */ virObjectEventStatePtr nodeDeviceEventState; diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index f4177455c..8ea5d1e62 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -56,7 +56,6 @@ VIR_LOG_INIT("node_device.node_device_udev"); struct _udevPrivate { struct udev_monitor *udev_monitor; int watch; - bool privileged; }; =20 =20 @@ -447,9 +446,13 @@ udevProcessPCI(struct udev_device *device, virNodeDevCapPCIDevPtr pci_dev =3D &def->caps->data.pci_dev; virPCIEDeviceInfoPtr pci_express =3D NULL; virPCIDevicePtr pciDev =3D NULL; - udevPrivate *priv =3D driver->privateData; int ret =3D -1; char *p; + bool privileged; + + nodeDeviceLock(); + privileged =3D driver->privileged; + nodeDeviceUnlock(); =20 if (udevGetUintProperty(device, "PCI_CLASS", &pci_dev->class, 16) < 0) goto cleanup; @@ -498,7 +501,7 @@ udevProcessPCI(struct udev_device *device, goto cleanup; =20 /* We need to be root to read PCI device configs */ - if (priv->privileged) { + if (privileged) { if (virPCIGetHeaderType(pciDev, &pci_dev->hdrType) < 0) goto cleanup; =20 @@ -1787,7 +1790,6 @@ nodeStateInitialize(bool privileged, return -1; =20 priv->watch =3D -1; - priv->privileged =3D privileged; =20 if (VIR_ALLOC(driver) < 0) { VIR_FREE(priv); @@ -1802,6 +1804,7 @@ nodeStateInitialize(bool privileged, return -1; } =20 + driver->privileged =3D privileged; driver->privateData =3D priv; nodeDeviceLock(); =20 --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list