mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
maint: avoid 'const fooPtr' in qemu
'const fooPtr' is the same as 'foo * const' (the pointer won't change, but it's contents can). But in general, if an interface is trying to be const-correct, it should be using 'const foo *' (the pointer is to data that can't be changed). Fix up offenders in src/qemu. * src/qemu/qemu_bridge_filter.h (networkAllowMacOnPort) (networkDisallowMacOnPort): Use intended type. * src/qemu/qemu_bridge_filter.c (networkAllowMacOnPort) (networkDisallowMacOnPort): Likewise. * src/qemu/qemu_command.c (qemuBuildTPMBackendStr) (qemuBuildTPMDevStr, qemuBuildCpuArgStr) (qemuBuildObsoleteAccelArg, qemuBuildMachineArgStr) (qemuBuildSmpArgStr, qemuBuildNumaArgStr): Likewise. * src/qemu/qemu_conf.c (qemuSharedDeviceEntryCopy): Likewise. * src/qemu/qemu_driver.c (qemuDomainSaveImageStartVM): Likewise. * src/qemu/qemu_hostdev.c (qemuDomainHostdevNetConfigVirtPortProfile): Likewise. * src/qemu/qemu_monitor_json.c (qemuMonitorJSONAttachCharDevCommand): Likewise. Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
84e8091796
commit
9a520a591d
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2009, 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2009 IBM Corp.
|
||||
* Copyright (C) 2007-2009 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
|
||||
@ -65,8 +65,8 @@ networkDisableAllFrames(virQEMUDriverPtr driver) {
|
||||
int
|
||||
networkAllowMacOnPort(virQEMUDriverPtr driver,
|
||||
const char * ifname,
|
||||
const virMacAddrPtr mac) {
|
||||
|
||||
const virMacAddr *mac)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* allow this combination of macaddr and ifname */
|
||||
@ -86,8 +86,8 @@ networkAllowMacOnPort(virQEMUDriverPtr driver,
|
||||
int
|
||||
networkDisallowMacOnPort(virQEMUDriverPtr driver,
|
||||
const char * ifname,
|
||||
const virMacAddrPtr mac) {
|
||||
|
||||
const virMacAddr *mac)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* disallow this combination of macaddr and ifname */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2007-2009, 2013 Red Hat, Inc.
|
||||
* Copyright (C) 2009 IBM Corp.
|
||||
* Copyright (C) 2007-2009 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
|
||||
@ -25,11 +25,11 @@
|
||||
|
||||
|
||||
int networkAllowMacOnPort(virQEMUDriverPtr driver,
|
||||
const char * ifname,
|
||||
const virMacAddrPtr mac);
|
||||
const char *ifname,
|
||||
const virMacAddr *mac);
|
||||
int networkDisallowMacOnPort(virQEMUDriverPtr driver,
|
||||
const char * ifname,
|
||||
const virMacAddrPtr mac);
|
||||
const char *ifname,
|
||||
const virMacAddr *mac);
|
||||
int networkDisableAllFrames(virQEMUDriverPtr driver);
|
||||
int networkAddEbtablesRules(virQEMUDriverPtr driver);
|
||||
|
||||
|
@ -6264,11 +6264,11 @@ cleanup:
|
||||
}
|
||||
|
||||
|
||||
static char *qemuBuildTPMBackendStr(const virDomainDefPtr def,
|
||||
static char *qemuBuildTPMBackendStr(const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
const char *emulator)
|
||||
{
|
||||
const virDomainTPMDefPtr tpm = def->tpm;
|
||||
const virDomainTPMDef *tpm = def->tpm;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
const char *type = virDomainTPMBackendTypeToString(tpm->type);
|
||||
char *cancel_path;
|
||||
@ -6316,12 +6316,12 @@ static char *qemuBuildTPMBackendStr(const virDomainDefPtr def,
|
||||
}
|
||||
|
||||
|
||||
static char *qemuBuildTPMDevStr(const virDomainDefPtr def,
|
||||
static char *qemuBuildTPMDevStr(const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
const char *emulator)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
const virDomainTPMDefPtr tpm = def->tpm;
|
||||
const virDomainTPMDef *tpm = def->tpm;
|
||||
const char *model = virDomainTPMModelTypeToString(tpm->model);
|
||||
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_TIS)) {
|
||||
@ -6532,8 +6532,8 @@ error:
|
||||
|
||||
|
||||
static int
|
||||
qemuBuildCpuArgStr(const virQEMUDriverPtr driver,
|
||||
const virDomainDefPtr def,
|
||||
qemuBuildCpuArgStr(virQEMUDriverPtr driver,
|
||||
const virDomainDef *def,
|
||||
const char *emulator,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
virArch hostarch,
|
||||
@ -6763,7 +6763,7 @@ cleanup:
|
||||
|
||||
static int
|
||||
qemuBuildObsoleteAccelArg(virCommandPtr cmd,
|
||||
const virDomainDefPtr def,
|
||||
const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
bool disableKQEMU = false;
|
||||
@ -6830,7 +6830,7 @@ qemuBuildObsoleteAccelArg(virCommandPtr cmd,
|
||||
|
||||
static int
|
||||
qemuBuildMachineArgStr(virCommandPtr cmd,
|
||||
const virDomainDefPtr def,
|
||||
const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
bool obsoleteAccel = false;
|
||||
@ -6917,7 +6917,7 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
|
||||
}
|
||||
|
||||
static char *
|
||||
qemuBuildSmpArgStr(const virDomainDefPtr def,
|
||||
qemuBuildSmpArgStr(const virDomainDef *def,
|
||||
virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
@ -6958,7 +6958,7 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
|
||||
}
|
||||
|
||||
static int
|
||||
qemuBuildNumaArgStr(const virDomainDefPtr def, virCommandPtr cmd)
|
||||
qemuBuildNumaArgStr(const virDomainDef *def, virCommandPtr cmd)
|
||||
{
|
||||
size_t i;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
@ -837,7 +837,7 @@ qemuSharedDeviceEntryFree(void *payload, const void *name ATTRIBUTE_UNUSED)
|
||||
}
|
||||
|
||||
static qemuSharedDeviceEntryPtr
|
||||
qemuSharedDeviceEntryCopy(const qemuSharedDeviceEntryPtr entry)
|
||||
qemuSharedDeviceEntryCopy(const qemuSharedDeviceEntry *entry)
|
||||
{
|
||||
qemuSharedDeviceEntryPtr ret = NULL;
|
||||
size_t i;
|
||||
|
@ -5323,7 +5323,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn,
|
||||
virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
int *fd,
|
||||
const virQEMUSaveHeaderPtr header,
|
||||
const virQEMUSaveHeader *header,
|
||||
const char *path,
|
||||
bool start_paused)
|
||||
{
|
||||
|
@ -349,7 +349,7 @@ cleanup:
|
||||
static int
|
||||
qemuDomainHostdevNetConfigVirtPortProfile(const char *linkdev, int vf,
|
||||
virNetDevVPortProfilePtr virtPort,
|
||||
const virMacAddrPtr macaddr,
|
||||
const virMacAddr *macaddr,
|
||||
const unsigned char *uuid,
|
||||
bool associate)
|
||||
{
|
||||
|
@ -5237,7 +5237,7 @@ int qemuMonitorJSONGetTPMTypes(qemuMonitorPtr mon,
|
||||
|
||||
static virJSONValuePtr
|
||||
qemuMonitorJSONAttachCharDevCommand(const char *chrID,
|
||||
const virDomainChrSourceDefPtr chr)
|
||||
const virDomainChrSourceDef *chr)
|
||||
{
|
||||
virJSONValuePtr ret;
|
||||
virJSONValuePtr backend;
|
||||
|
Loading…
Reference in New Issue
Block a user