It will be used as a replacement for macros code converting params to iotune structure. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx> --- src/conf/domain_conf.c | 32 ++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 6 ++++++ src/libvirt_private.syms | 1 + 3 files changed, 39 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bbe6ae7..aa6a2a8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -31741,6 +31741,38 @@ virDomainBlockIoTuneInfoEqual(const virDomainBlockIoTuneInfo *a, } +int +virDomainBlockIoTuneFromParams(virTypedParameterPtr params, + int nparams, + virDomainBlockIoTuneInfoPtr iotune, + virDomainBlockIoTuneInfoPtr set) +{ + g_autofree unsigned long long **fields = virDomainBlockIoTuneFields(iotune); + g_autofree unsigned long long **set_fields = virDomainBlockIoTuneFields(set); + const char *group_name = NULL; + size_t i; + + for (i = 0; i < G_N_ELEMENTS(virDomainBlockIoTuneFieldNames); i++) { + const char *name = virDomainBlockIoTuneFieldNames[i]; + int rc; + + rc = virTypedParamsGetULLong(params, nparams, name, fields[i]); + if (rc < 0) + return -1; + if (rc == 1) + *set_fields[i] = 1; + } + + if (virTypedParamsGetString(params, nparams, + VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME, + &group_name) < 0) + return -1; + iotune->group_name = g_strdup(group_name); + + return 0; +} + + /** * virHostdevIsSCSIDevice: * @hostdev: host device to check diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 3c42313..e511939 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3949,6 +3949,12 @@ bool virDomainBlockIoTuneInfoEqual(const virDomainBlockIoTuneInfo *a, const virDomainBlockIoTuneInfo *b); +int +virDomainBlockIoTuneFromParams(virTypedParameterPtr params, + int nparams, + virDomainBlockIoTuneInfoPtr iotune, + virDomainBlockIoTuneInfoPtr set); + bool virDomainDriveAddressIsUsedByDisk(const virDomainDef *def, virDomainDiskBus bus_type, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index bfe3ee7..bc42df0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -230,6 +230,7 @@ virDomainAudioTypeTypeFromString; virDomainAudioTypeTypeToString; virDomainBlockedReasonTypeFromString; virDomainBlockedReasonTypeToString; +virDomainBlockIoTuneFromParams; virDomainBlockIoTuneInfoCopy; virDomainBlockIoTuneInfoEqual; virDomainBlockIoTuneInfoHasAny; -- 1.8.3.1