The virDomainDefPostParseDeviceIteratorData struct is exported in domain_conf.h because it's used in both domain_conf.c and domain_validate.c. However, the latter usage is not warranted, it's just a shortcut so that we don't have to introduce a similar struct just for domain_validate.c. Well, do the extra step and introduce a separate structure for domain_validate.c. This allows us to move post parse code later on. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/conf/domain_conf.c | 7 +++++++ src/conf/domain_conf.h | 6 ------ src/conf/domain_validate.c | 11 +++++++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2c2f23242e..c67fcd337d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6031,6 +6031,13 @@ virDomainDeviceDefPostParseOne(virDomainDeviceDef *dev, } +struct virDomainDefPostParseDeviceIteratorData { + virDomainXMLOption *xmlopt; + void *parseOpaque; + unsigned int parseFlags; +}; + + static int virDomainDefPostParseDeviceIterator(virDomainDef *def, virDomainDeviceDef *dev, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 4c8c42b7eb..543b343be9 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3302,12 +3302,6 @@ struct _virDomainXMLOption { }; G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainXMLOption, virObjectUnref); -struct virDomainDefPostParseDeviceIteratorData { - virDomainXMLOption *xmlopt; - void *parseOpaque; - unsigned int parseFlags; -}; - bool virDomainSCSIDriveAddressIsUsed(const virDomainDef *def, const virDomainDeviceDriveAddress *addr); diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 57d4e63a26..814922cd46 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1889,13 +1889,20 @@ virDomainDefValidateInternal(const virDomainDef *def, } +struct virDomainDefValidateDeviceIteratorData { + virDomainXMLOption *xmlopt; + void *parseOpaque; + unsigned int parseFlags; +}; + + static int virDomainDefValidateDeviceIterator(virDomainDef *def, virDomainDeviceDef *dev, virDomainDeviceInfo *info G_GNUC_UNUSED, void *opaque) { - struct virDomainDefPostParseDeviceIteratorData *data = opaque; + struct virDomainDefValidateDeviceIteratorData *data = opaque; return virDomainDeviceDefValidate(dev, def, data->parseFlags, data->xmlopt, data->parseOpaque); @@ -1924,7 +1931,7 @@ virDomainDefValidate(virDomainDef *def, virDomainXMLOption *xmlopt, void *parseOpaque) { - struct virDomainDefPostParseDeviceIteratorData data = { + struct virDomainDefValidateDeviceIteratorData data = { .xmlopt = xmlopt, .parseFlags = parseFlags, .parseOpaque = parseOpaque, -- 2.35.1