conf: Separate domain post parse code into domain_postparse.c

The domain post parse functions currently live in domain_conf.c
which thus grows always larger. Mimic what we've done for the
validation code and move the post parse code into a separate
file: domain_postparse.c.

I've started by moving every function with PostParse in its name
into the new file and then compile hunting for helper functions
only to move them as well.

In the end, I've moved virDomainDefPostParse symbol in
libvirt_private.syms into a new section. And while
virDomainDeviceDefPostParseOne() is made 'public' in
domain_postparse.h too, I'm not exporting it because it has no
caller outside src/conf/ and it's unlikely it ever will.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2022-07-07 10:03:33 +02:00
parent 531b62950f
commit d9916c3519
13 changed files with 1533 additions and 1457 deletions

View File

@ -32,6 +32,7 @@ src/conf/domain_addr.c
src/conf/domain_capabilities.c
src/conf/domain_conf.c
src/conf/domain_event.c
src/conf/domain_postparse.c
src/conf/domain_validate.c
src/conf/interface_conf.c
src/conf/netdev_bandwidth_conf.c

File diff suppressed because it is too large Load Diff

View File

@ -3306,10 +3306,6 @@ bool
virDomainSCSIDriveAddressIsUsed(const virDomainDef *def,
const virDomainDeviceDriveAddress *addr);
int virDomainDefPostParse(virDomainDef *def,
unsigned int parseFlags,
virDomainXMLOption *xmlopt,
void *parseOpaque);
bool virDomainDefHasUSB(const virDomainDef *def);
bool virDomainDeviceAliasIsUserAlias(const char *aliasStr);

1483
src/conf/domain_postparse.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
/*
* domain_postparse.h: domain post parsing helpers
*
* Copyright (C) 2022 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "domain_conf.h"
#include "virconftypes.h"
int
virDomainDeviceDefPostParseOne(virDomainDeviceDef *dev,
const virDomainDef *def,
unsigned int flags,
virDomainXMLOption *xmlopt,
void *parseOpaque);
int
virDomainDefPostParse(virDomainDef *def,
unsigned int parseFlags,
virDomainXMLOption *xmlopt,
void *parseOpaque);

View File

@ -14,6 +14,7 @@ domain_conf_sources = [
'domain_capabilities.c',
'domain_conf.c',
'domain_nwfilter.c',
'domain_postparse.c',
'domain_validate.c',
'moment_conf.c',
'numa_conf.c',

View File

@ -343,7 +343,6 @@ virDomainDefNew;
virDomainDefParseFile;
virDomainDefParseNode;
virDomainDefParseString;
virDomainDefPostParse;
virDomainDefSave;
virDomainDefSetMemoryTotal;
virDomainDefSetVcpus;
@ -774,6 +773,10 @@ virDomainConfNWFilterTeardown;
virDomainConfVMNWFilterTeardown;
# conf/domain_postparse.h
virDomainDefPostParse;
# conf/domain_validate.h
virDomainActualNetDefValidate;
virDomainDefValidate;

View File

@ -27,6 +27,7 @@
#include "virerror.h"
#include "virlog.h"
#include "domain_conf.h"
#include "domain_postparse.h"
#include "viralloc.h"
#include "virstring.h"
#include "storage_source_backingstore.h"

View File

@ -29,6 +29,7 @@
#include "xenxs_private.h"
#include "xen_xm.h"
#include "domain_conf.h"
#include "domain_postparse.h"
#include "xen_common.h"
#define VIR_FROM_THIS VIR_FROM_XENXM

View File

@ -29,6 +29,7 @@
#include "util/virstring.h"
#include "util/virconf.h"
#include "conf/domain_conf.h"
#include "conf/domain_postparse.h"
#include "virutil.h"
#define VIR_FROM_THIS VIR_FROM_LXC

View File

@ -67,6 +67,7 @@
#include "domain_audit.h"
#include "domain_cgroup.h"
#include "domain_driver.h"
#include "domain_postparse.h"
#include "domain_validate.h"
#include "virpci.h"
#include "virpidfile.h"

View File

@ -75,6 +75,7 @@
#include "domain_audit.h"
#include "domain_cgroup.h"
#include "domain_nwfilter.h"
#include "domain_postparse.h"
#include "domain_validate.h"
#include "locking/domain_lock.h"
#include "viruuid.h"

View File

@ -31,6 +31,7 @@
#include "viruri.h"
#include "virstring.h"
#include "virutil.h"
#include "domain_postparse.h"
VIR_LOG_INIT("vmx.vmx");