mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemu: Move functions around
Make sure related functions, eg. all qemuDomainIs*(), are close together instead of being sprinkled throughout both the header and implementation file, and also that all qemuDomainMachine*() functions are declared first since we're going to make a bunch of them static later on. Signed-off-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
616beb17d4
commit
4028d7a46a
@ -9875,13 +9875,6 @@ qemuFindAgentConfig(virDomainDefPtr def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainIsQ35(const virDomainDef *def)
|
|
||||||
{
|
|
||||||
return qemuDomainMachineIsQ35(def->os.machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
qemuDomainMachineIsQ35(const char *machine)
|
qemuDomainMachineIsQ35(const char *machine)
|
||||||
{
|
{
|
||||||
@ -9890,13 +9883,6 @@ qemuDomainMachineIsQ35(const char *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainIsI440FX(const virDomainDef *def)
|
|
||||||
{
|
|
||||||
return qemuDomainMachineIsI440FX(def->os.machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
qemuDomainMachineIsI440FX(const char *machine)
|
qemuDomainMachineIsI440FX(const char *machine)
|
||||||
{
|
{
|
||||||
@ -9908,6 +9894,130 @@ qemuDomainMachineIsI440FX(const char *machine)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainMachineIsS390CCW(const char *machine)
|
||||||
|
{
|
||||||
|
return STRPREFIX(machine, "s390-ccw");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainMachineIsARMVirt(const char *machine,
|
||||||
|
const virArch arch)
|
||||||
|
{
|
||||||
|
if (arch != VIR_ARCH_ARMV6L &&
|
||||||
|
arch != VIR_ARCH_ARMV7L &&
|
||||||
|
arch != VIR_ARCH_AARCH64)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (STRNEQ(machine, "virt") &&
|
||||||
|
!STRPREFIX(machine, "virt-"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainMachineIsRISCVVirt(const char *machine,
|
||||||
|
const virArch arch)
|
||||||
|
{
|
||||||
|
if (!ARCH_IS_RISCV(arch))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (STRNEQ(machine, "virt") &&
|
||||||
|
!STRPREFIX(machine, "virt-"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainMachineIsPSeries(const char *machine,
|
||||||
|
const virArch arch)
|
||||||
|
{
|
||||||
|
if (!ARCH_IS_PPC64(arch))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (STRNEQ(machine, "pseries") &&
|
||||||
|
!STRPREFIX(machine, "pseries-"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainMachineHasBuiltinIDE(const char *machine)
|
||||||
|
{
|
||||||
|
return qemuDomainMachineIsI440FX(machine) ||
|
||||||
|
STREQ(machine, "malta") ||
|
||||||
|
STREQ(machine, "sun4u") ||
|
||||||
|
STREQ(machine, "g3beige");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainMachineNeedsFDC(const char *machine)
|
||||||
|
{
|
||||||
|
const char *p = STRSKIP(machine, "pc-q35-");
|
||||||
|
|
||||||
|
if (p) {
|
||||||
|
if (STRPREFIX(p, "1.") ||
|
||||||
|
STREQ(p, "2.0") ||
|
||||||
|
STREQ(p, "2.1") ||
|
||||||
|
STREQ(p, "2.2") ||
|
||||||
|
STREQ(p, "2.3"))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainIsQ35(const virDomainDef *def)
|
||||||
|
{
|
||||||
|
return qemuDomainMachineIsQ35(def->os.machine);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainIsI440FX(const virDomainDef *def)
|
||||||
|
{
|
||||||
|
return qemuDomainMachineIsI440FX(def->os.machine);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainIsS390CCW(const virDomainDef *def)
|
||||||
|
{
|
||||||
|
return qemuDomainMachineIsS390CCW(def->os.machine);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainIsARMVirt(const virDomainDef *def)
|
||||||
|
{
|
||||||
|
return qemuDomainMachineIsARMVirt(def->os.machine, def->os.arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainIsRISCVVirt(const virDomainDef *def)
|
||||||
|
{
|
||||||
|
return qemuDomainMachineIsRISCVVirt(def->os.machine, def->os.arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainIsPSeries(const virDomainDef *def)
|
||||||
|
{
|
||||||
|
return qemuDomainMachineIsPSeries(def->os.machine, def->os.arch);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
qemuDomainHasPCIRoot(const virDomainDef *def)
|
qemuDomainHasPCIRoot(const virDomainDef *def)
|
||||||
{
|
{
|
||||||
@ -9938,6 +10048,13 @@ qemuDomainHasPCIeRoot(const virDomainDef *def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
qemuDomainHasBuiltinIDE(const virDomainDef *def)
|
||||||
|
{
|
||||||
|
return qemuDomainMachineHasBuiltinIDE(def->os.machine);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
qemuDomainNeedsFDC(const virDomainDef *def)
|
qemuDomainNeedsFDC(const virDomainDef *def)
|
||||||
{
|
{
|
||||||
@ -9945,106 +10062,6 @@ qemuDomainNeedsFDC(const virDomainDef *def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainMachineNeedsFDC(const char *machine)
|
|
||||||
{
|
|
||||||
const char *p = STRSKIP(machine, "pc-q35-");
|
|
||||||
|
|
||||||
if (p) {
|
|
||||||
if (STRPREFIX(p, "1.") ||
|
|
||||||
STREQ(p, "2.0") ||
|
|
||||||
STREQ(p, "2.1") ||
|
|
||||||
STREQ(p, "2.2") ||
|
|
||||||
STREQ(p, "2.3"))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainIsS390CCW(const virDomainDef *def)
|
|
||||||
{
|
|
||||||
return qemuDomainMachineIsS390CCW(def->os.machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainMachineIsS390CCW(const char *machine)
|
|
||||||
{
|
|
||||||
return STRPREFIX(machine, "s390-ccw");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainIsARMVirt(const virDomainDef *def)
|
|
||||||
{
|
|
||||||
return qemuDomainMachineIsARMVirt(def->os.machine, def->os.arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainMachineIsARMVirt(const char *machine,
|
|
||||||
const virArch arch)
|
|
||||||
{
|
|
||||||
if (arch != VIR_ARCH_ARMV6L &&
|
|
||||||
arch != VIR_ARCH_ARMV7L &&
|
|
||||||
arch != VIR_ARCH_AARCH64)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (STRNEQ(machine, "virt") &&
|
|
||||||
!STRPREFIX(machine, "virt-"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainIsRISCVVirt(const virDomainDef *def)
|
|
||||||
{
|
|
||||||
return qemuDomainMachineIsRISCVVirt(def->os.machine, def->os.arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainMachineIsRISCVVirt(const char *machine,
|
|
||||||
const virArch arch)
|
|
||||||
{
|
|
||||||
if (!ARCH_IS_RISCV(arch))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (STRNEQ(machine, "virt") &&
|
|
||||||
!STRPREFIX(machine, "virt-"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainIsPSeries(const virDomainDef *def)
|
|
||||||
{
|
|
||||||
return qemuDomainMachineIsPSeries(def->os.machine, def->os.arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainMachineIsPSeries(const char *machine,
|
|
||||||
const virArch arch)
|
|
||||||
{
|
|
||||||
if (!ARCH_IS_PPC64(arch))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (STRNEQ(machine, "pseries") &&
|
|
||||||
!STRPREFIX(machine, "pseries-"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
qemuCheckMemoryDimmConflict(const virDomainDef *def,
|
qemuCheckMemoryDimmConflict(const virDomainDef *def,
|
||||||
const virDomainMemoryDef *mem)
|
const virDomainMemoryDef *mem)
|
||||||
@ -10239,23 +10256,6 @@ qemuDomainDefValidateMemoryHotplug(const virDomainDef *def,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainHasBuiltinIDE(const virDomainDef *def)
|
|
||||||
{
|
|
||||||
return qemuDomainMachineHasBuiltinIDE(def->os.machine);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
qemuDomainMachineHasBuiltinIDE(const char *machine)
|
|
||||||
{
|
|
||||||
return qemuDomainMachineIsI440FX(machine) ||
|
|
||||||
STREQ(machine, "malta") ||
|
|
||||||
STREQ(machine, "sun4u") ||
|
|
||||||
STREQ(machine, "g3beige");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemuDomainUpdateCurrentMemorySize:
|
* qemuDomainUpdateCurrentMemorySize:
|
||||||
*
|
*
|
||||||
|
@ -828,20 +828,8 @@ void qemuDomainMemoryDeviceAlignSize(virDomainDefPtr def,
|
|||||||
|
|
||||||
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
|
virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
|
||||||
|
|
||||||
bool qemuDomainIsQ35(const virDomainDef *def);
|
|
||||||
bool qemuDomainIsI440FX(const virDomainDef *def);
|
|
||||||
bool qemuDomainHasPCIRoot(const virDomainDef *def);
|
|
||||||
bool qemuDomainHasPCIeRoot(const virDomainDef *def);
|
|
||||||
bool qemuDomainNeedsFDC(const virDomainDef *def);
|
|
||||||
bool qemuDomainIsS390CCW(const virDomainDef *def);
|
|
||||||
bool qemuDomainIsARMVirt(const virDomainDef *def);
|
|
||||||
bool qemuDomainIsRISCVVirt(const virDomainDef *def);
|
|
||||||
bool qemuDomainIsPSeries(const virDomainDef *def);
|
|
||||||
bool qemuDomainHasBuiltinIDE(const virDomainDef *def);
|
|
||||||
|
|
||||||
bool qemuDomainMachineIsQ35(const char *machine);
|
bool qemuDomainMachineIsQ35(const char *machine);
|
||||||
bool qemuDomainMachineIsI440FX(const char *machine);
|
bool qemuDomainMachineIsI440FX(const char *machine);
|
||||||
bool qemuDomainMachineNeedsFDC(const char *machine);
|
|
||||||
bool qemuDomainMachineIsS390CCW(const char *machine);
|
bool qemuDomainMachineIsS390CCW(const char *machine);
|
||||||
bool qemuDomainMachineIsARMVirt(const char *machine,
|
bool qemuDomainMachineIsARMVirt(const char *machine,
|
||||||
const virArch arch);
|
const virArch arch);
|
||||||
@ -850,6 +838,18 @@ bool qemuDomainMachineIsRISCVVirt(const char *machine,
|
|||||||
bool qemuDomainMachineIsPSeries(const char *machine,
|
bool qemuDomainMachineIsPSeries(const char *machine,
|
||||||
const virArch arch);
|
const virArch arch);
|
||||||
bool qemuDomainMachineHasBuiltinIDE(const char *machine);
|
bool qemuDomainMachineHasBuiltinIDE(const char *machine);
|
||||||
|
bool qemuDomainMachineNeedsFDC(const char *machine);
|
||||||
|
|
||||||
|
bool qemuDomainIsQ35(const virDomainDef *def);
|
||||||
|
bool qemuDomainIsI440FX(const virDomainDef *def);
|
||||||
|
bool qemuDomainIsS390CCW(const virDomainDef *def);
|
||||||
|
bool qemuDomainIsARMVirt(const virDomainDef *def);
|
||||||
|
bool qemuDomainIsRISCVVirt(const virDomainDef *def);
|
||||||
|
bool qemuDomainIsPSeries(const virDomainDef *def);
|
||||||
|
bool qemuDomainHasPCIRoot(const virDomainDef *def);
|
||||||
|
bool qemuDomainHasPCIeRoot(const virDomainDef *def);
|
||||||
|
bool qemuDomainHasBuiltinIDE(const virDomainDef *def);
|
||||||
|
bool qemuDomainNeedsFDC(const virDomainDef *def);
|
||||||
|
|
||||||
void qemuDomainUpdateCurrentMemorySize(virDomainObjPtr vm);
|
void qemuDomainUpdateCurrentMemorySize(virDomainObjPtr vm);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user