From 9ad119f4db5c4f9cc60e2e51cb5cfd9633b13eee Mon Sep 17 00:00:00 2001 From: Andrea Bolognani Date: Fri, 17 Aug 2018 15:35:19 +0200 Subject: [PATCH] conf: Move some device_conf predicates Turn virPCIDeviceAddressIsEmpty() virDeviceInfoPCIAddressIsWanted() virDeviceInfoPCIAddressIsPresent() from inline functions to regular functions. Signed-off-by: Andrea Bolognani Reviewed-by: John Ferlan --- src/conf/device_conf.c | 22 ++++++++++++++++++++++ src/conf/device_conf.h | 23 +++-------------------- src/libvirt_private.syms | 3 +++ 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index d69f94fadf..7a8f84e036 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -191,6 +191,28 @@ int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr, } +bool +virPCIDeviceAddressIsEmpty(const virPCIDeviceAddress *addr) +{ + return !(addr->domain || addr->bus || addr->slot); +} + +bool +virDeviceInfoPCIAddressIsWanted(const virDomainDeviceInfo *info) +{ + return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE || + (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && + virPCIDeviceAddressIsEmpty(&info->addr.pci)); +} + +bool +virDeviceInfoPCIAddressIsPresent(const virDomainDeviceInfo *info) +{ + return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && + !virPCIDeviceAddressIsEmpty(&info->addr.pci); +} + + int virPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddressPtr addr) diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index 8c2bda2f4f..ff7d6c9d5f 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -188,27 +188,10 @@ bool virDomainDeviceInfoAddressIsEqual(const virDomainDeviceInfo *a, int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr, bool report); +bool virPCIDeviceAddressIsEmpty(const virPCIDeviceAddress *addr); -static inline bool -virPCIDeviceAddressIsEmpty(const virPCIDeviceAddress *addr) -{ - return !(addr->domain || addr->bus || addr->slot); -} - -static inline bool -virDeviceInfoPCIAddressIsWanted(const virDomainDeviceInfo *info) -{ - return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE || - (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && - virPCIDeviceAddressIsEmpty(&info->addr.pci)); -} - -static inline bool -virDeviceInfoPCIAddressIsPresent(const virDomainDeviceInfo *info) -{ - return info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && - !virPCIDeviceAddressIsEmpty(&info->addr.pci); -} +bool virDeviceInfoPCIAddressIsWanted(const virDomainDeviceInfo *info); +bool virDeviceInfoPCIAddressIsPresent(const virDomainDeviceInfo *info); int virPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddressPtr addr); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 47ea35f864..954ab4b66c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -93,12 +93,15 @@ virCPUModeTypeToString; # conf/device_conf.h +virDeviceInfoPCIAddressIsPresent; +virDeviceInfoPCIAddressIsWanted; virDomainDeviceInfoAddressIsEqual; virDomainDeviceInfoCopy; virInterfaceLinkFormat; virInterfaceLinkParseXML; virPCIDeviceAddressEqual; virPCIDeviceAddressFormat; +virPCIDeviceAddressIsEmpty; virPCIDeviceAddressIsValid; virPCIDeviceAddressParseXML; -- GitLab