From nobody Mon Feb 9 14:03:10 2026 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1552389314491392.7062549399516; Tue, 12 Mar 2019 04:15:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C526307E059; Tue, 12 Mar 2019 11:15:12 +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 383DE1001E6F; Tue, 12 Mar 2019 11:15:12 +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 D45A2181A13B; Tue, 12 Mar 2019 11:15:11 +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 x2CBF5Im007275 for ; Tue, 12 Mar 2019 07:15:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8EFCE27BAD; Tue, 12 Mar 2019 11:15:05 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 889A727BB3 for ; Tue, 12 Mar 2019 11:15:02 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A994B308FB8A for ; Tue, 12 Mar 2019 11:15:00 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1h3fN3-0003r0-K4 for libvir-list@redhat.com; Tue, 12 Mar 2019 14:14:57 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Tue, 12 Mar 2019 14:14:39 +0300 Message-Id: <1552389281-629582-2-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1552389281-629582-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1552389281-629582-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 242 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 12 Mar 2019 11:15:01 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 12 Mar 2019 11:15:01 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/3] conf: don't use "class" as name in _virNodeDevCapPCIDev 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 12 Mar 2019 11:15:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Vim treats *.h files as cpp ones with respect to syntax highlighting. Thus "class" in _virNodeDevCapPCIDev highlighted mistakenly. This can be fixed by filetype detection code tunables but it is more convinient to skip this tuning by every project member. Let's just use "klass" as field name instead of _class or class and add syntax rule. Signed-off-by: Nikolay Shirokovskiy --- cfg.mk | 8 ++++++++ src/conf/node_device_conf.c | 4 ++-- src/conf/node_device_conf.h | 4 ++-- src/node_device/node_device_udev.c | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cfg.mk b/cfg.mk index f99b8ae631..88198037cc 100644 --- a/cfg.mk +++ b/cfg.mk @@ -1075,6 +1075,14 @@ sc_require_attribute_cleanup_initialization: halt=3D'variable declared with a cleanup macro must be initialized' \ $(_sc_search_regexp) =20 +# "class" in headers is not good because by default Vim treats it as a key= word +sc_prohibit_class_in_headers: + @prohibit=3D' +_?class *;' \ + in_vc_files=3D'\.h$$' \ + halt=3D'use klass instead of class or _class as name in header files' \ + $(_sc_search_regexp) + + # We don't use this feature of maint.mk. prev_version_file =3D /dev/null =20 diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 1b1f57d065..5de51d1f6b 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -346,7 +346,7 @@ virNodeDeviceCapUSBInterfaceDefFormat(virBufferPtr buf, virBufferAsprintf(buf, "%d\n", data->usb_if.number); virBufferAsprintf(buf, "%d\n", - data->usb_if._class); + data->usb_if.klass); virBufferAsprintf(buf, "%d\n", data->usb_if.subclass); virBufferAsprintf(buf, "%d\n", @@ -1216,7 +1216,7 @@ virNodeDevCapUSBInterfaceParseXML(xmlXPathContextPtr = ctxt, goto out; =20 if (virNodeDevCapsDefParseULong("number(./class[1])", ctxt, - &usb_if->_class, def, + &usb_if->klass, def, _("no USB interface class supplied for= '%s'"), _("invalid USB interface class supplie= d for '%s'")) < 0) goto out; diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index ce789e9ee9..b13bc13b87 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -153,7 +153,7 @@ struct _virNodeDevCapPCIDev { unsigned int function; unsigned int product; unsigned int vendor; - unsigned int class; + unsigned int klass; char *product_name; char *vendor_name; virPCIDeviceAddressPtr physical_function; @@ -186,7 +186,7 @@ typedef struct _virNodeDevCapUSBIf virNodeDevCapUSBIf; typedef virNodeDevCapUSBIf *virNodeDevCapUSBIfPtr; struct _virNodeDevCapUSBIf { unsigned int number; - unsigned int _class; /* "class" is reserved in C */ + unsigned int klass; unsigned int subclass; unsigned int protocol; char *description; diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 32e762009f..f0e61e4236 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -402,7 +402,7 @@ udevProcessPCI(struct udev_device *device, privileged =3D driver->privileged; nodeDeviceUnlock(); =20 - if (udevGetUintProperty(device, "PCI_CLASS", &pci_dev->class, 16) < 0) + if (udevGetUintProperty(device, "PCI_CLASS", &pci_dev->klass, 16) < 0) goto cleanup; =20 if ((p =3D strrchr(def->sysfs_path, '/')) =3D=3D NULL || @@ -582,7 +582,7 @@ udevProcessUSBInterface(struct udev_device *device, return -1; =20 if (udevGetUintSysfsAttr(device, "bInterfaceClass", - &usb_if->_class, 16) < 0) + &usb_if->klass, 16) < 0) return -1; =20 if (udevGetUintSysfsAttr(device, "bInterfaceSubClass", --=20 2.16.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list