Refactor virDomainCCWAddressIncrement into virccw and rename method as virCCWDeviceAddressIncrement. Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxx> --- src/conf/domain_addr.c | 16 +--------------- src/libvirt_private.syms | 1 + src/util/virccw.c | 13 +++++++++++++ src/util/virccw.h | 1 + 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 65b438f13c..edc254a6ee 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -1303,20 +1303,6 @@ virDomainPCIAddressSetAllMulti(virDomainDef *def) } -static int -virDomainCCWAddressIncrement(virCCWDeviceAddress *addr) -{ - virCCWDeviceAddress ccwaddr = *addr; - - /* We are not touching subchannel sets and channel subsystems */ - if (++ccwaddr.devno > VIR_CCW_DEVICE_MAX_DEVNO) - return -1; - - *addr = ccwaddr; - return 0; -} - - int virDomainCCWAddressAssign(virDomainDeviceInfo *dev, virDomainCCWAddressSet *addrs, @@ -1342,7 +1328,7 @@ virDomainCCWAddressAssign(virDomainDeviceInfo *dev, return -1; while (virHashLookup(addrs->defined, addr)) { - if (virDomainCCWAddressIncrement(&addrs->next) < 0) { + if (virCCWDeviceAddressIncrement(&addrs->next) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("There are no more free CCW devnos.")); return -1; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index eaf4a1da9c..fae8edb6cd 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1926,6 +1926,7 @@ virBufferVasprintf; # util/virccw.h virCCWDeviceAddressAsString; +virCCWDeviceAddressIncrement; # util/vircgroup.h diff --git a/src/util/virccw.c b/src/util/virccw.c index 5a19d3a112..d14d432414 100644 --- a/src/util/virccw.c +++ b/src/util/virccw.c @@ -27,3 +27,16 @@ virCCWDeviceAddressAsString(virCCWDeviceAddress *addr) { return g_strdup_printf(VIR_CCW_DEVICE_ADDRESS_FMT, addr->cssid, addr->ssid, addr->devno); } + +int +virCCWDeviceAddressIncrement(virCCWDeviceAddress *addr) +{ + virCCWDeviceAddress ccwaddr = *addr; + + /* We are not touching subchannel sets and channel subsystems */ + if (++ccwaddr.devno > VIR_CCW_DEVICE_MAX_DEVNO) + return -1; + + *addr = ccwaddr; + return 0; +} diff --git a/src/util/virccw.h b/src/util/virccw.h index c3a47127f1..4c48c9605e 100644 --- a/src/util/virccw.h +++ b/src/util/virccw.h @@ -37,3 +37,4 @@ struct _virCCWDeviceAddress { char* virCCWDeviceAddressAsString(virCCWDeviceAddress *addr) ATTRIBUTE_NONNULL(1); +int virCCWDeviceAddressIncrement(virCCWDeviceAddress *addr); -- 2.33.1