From e95f9459d3ae875d36df1699d919f0651b840109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 13 Aug 2019 15:17:44 +0200 Subject: [PATCH] util: default to read-only in virPCIDeviceConfigOpen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All the callers left require virPCIDeviceConfigOpen to be fatal and only use read-only access to the config file. Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- src/util/virpci.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 2758ee6f49..7ca755c1a8 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -315,9 +315,9 @@ virPCIDeviceConfigOpenInternal(virPCIDevicePtr dev, bool readonly, bool fatal) } static int -virPCIDeviceConfigOpen(virPCIDevicePtr dev, bool fatal) +virPCIDeviceConfigOpen(virPCIDevicePtr dev) { - return virPCIDeviceConfigOpenInternal(dev, false, fatal); + return virPCIDeviceConfigOpenInternal(dev, true, true); } static int @@ -2426,7 +2426,7 @@ virPCIDeviceDownstreamLacksACS(virPCIDevicePtr dev) int ret = 0; uint16_t device_class; - if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0) + if ((fd = virPCIDeviceConfigOpen(dev)) < 0) return -1; if (virPCIDeviceInit(dev, fd) < 0) { @@ -3168,7 +3168,7 @@ virPCIDeviceIsPCIExpress(virPCIDevicePtr dev) int fd; int ret = -1; - if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0) + if ((fd = virPCIDeviceConfigOpen(dev)) < 0) return ret; if (virPCIDeviceInit(dev, fd) < 0) @@ -3188,7 +3188,7 @@ virPCIDeviceHasPCIExpressLink(virPCIDevicePtr dev) int ret = -1; uint16_t cap, type; - if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0) + if ((fd = virPCIDeviceConfigOpen(dev)) < 0) return ret; if (virPCIDeviceInit(dev, fd) < 0) @@ -3216,7 +3216,7 @@ virPCIDeviceGetLinkCapSta(virPCIDevicePtr dev, int fd; int ret = -1; - if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0) + if ((fd = virPCIDeviceConfigOpen(dev)) < 0) return ret; if (virPCIDeviceInit(dev, fd) < 0) @@ -3254,7 +3254,7 @@ int virPCIGetHeaderType(virPCIDevicePtr dev, int *hdrType) *hdrType = -1; - if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0) + if ((fd = virPCIDeviceConfigOpen(dev)) < 0) return -1; type = virPCIDeviceRead8(dev, fd, PCI_HEADER_TYPE);