mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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 <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
17317a4bc6
commit
e95f9459d3
@ -315,9 +315,9 @@ virPCIDeviceConfigOpenInternal(virPCIDevicePtr dev, bool readonly, bool fatal)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virPCIDeviceConfigOpen(virPCIDevicePtr dev, bool fatal)
|
virPCIDeviceConfigOpen(virPCIDevicePtr dev)
|
||||||
{
|
{
|
||||||
return virPCIDeviceConfigOpenInternal(dev, false, fatal);
|
return virPCIDeviceConfigOpenInternal(dev, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2426,7 +2426,7 @@ virPCIDeviceDownstreamLacksACS(virPCIDevicePtr dev)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
uint16_t device_class;
|
uint16_t device_class;
|
||||||
|
|
||||||
if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0)
|
if ((fd = virPCIDeviceConfigOpen(dev)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (virPCIDeviceInit(dev, fd) < 0) {
|
if (virPCIDeviceInit(dev, fd) < 0) {
|
||||||
@ -3168,7 +3168,7 @@ virPCIDeviceIsPCIExpress(virPCIDevicePtr dev)
|
|||||||
int fd;
|
int fd;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0)
|
if ((fd = virPCIDeviceConfigOpen(dev)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (virPCIDeviceInit(dev, fd) < 0)
|
if (virPCIDeviceInit(dev, fd) < 0)
|
||||||
@ -3188,7 +3188,7 @@ virPCIDeviceHasPCIExpressLink(virPCIDevicePtr dev)
|
|||||||
int ret = -1;
|
int ret = -1;
|
||||||
uint16_t cap, type;
|
uint16_t cap, type;
|
||||||
|
|
||||||
if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0)
|
if ((fd = virPCIDeviceConfigOpen(dev)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (virPCIDeviceInit(dev, fd) < 0)
|
if (virPCIDeviceInit(dev, fd) < 0)
|
||||||
@ -3216,7 +3216,7 @@ virPCIDeviceGetLinkCapSta(virPCIDevicePtr dev,
|
|||||||
int fd;
|
int fd;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0)
|
if ((fd = virPCIDeviceConfigOpen(dev)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (virPCIDeviceInit(dev, fd) < 0)
|
if (virPCIDeviceInit(dev, fd) < 0)
|
||||||
@ -3254,7 +3254,7 @@ int virPCIGetHeaderType(virPCIDevicePtr dev, int *hdrType)
|
|||||||
|
|
||||||
*hdrType = -1;
|
*hdrType = -1;
|
||||||
|
|
||||||
if ((fd = virPCIDeviceConfigOpen(dev, true)) < 0)
|
if ((fd = virPCIDeviceConfigOpen(dev)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
type = virPCIDeviceRead8(dev, fd, PCI_HEADER_TYPE);
|
type = virPCIDeviceRead8(dev, fd, PCI_HEADER_TYPE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user