From: Ján Tomko Date: Tue, 13 Aug 2019 13:17:44 +0000 (+0200) Subject: util: default to read-only in virPCIDeviceConfigOpen X-Git-Tag: v5.7.0-rc1~230 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e95f9459d3ae875d36df1699d919f0651b840109;p=thirdparty%2Flibvirt.git util: default to read-only in virPCIDeviceConfigOpen 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 --- 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);