In this case, the virNetDevBandwidthPtr that is returned is not to a
region within the virDomainNetDef arg, but points elsewhere (the
NetDef has the pointer, not the entire object), so technically it's
not necessary to make the return value a const, but it's a bit
disingenuous to *not* do it.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/conf/domain_conf.c | 4 ++--
src/conf/domain_conf.h | 4 ++--
src/conf/netdev_bandwidth_conf.c | 2 +-
src/conf/netdev_bandwidth_conf.h | 2 +-
src/libxl/libxl_conf.c | 2 +-
src/lxc/lxc_driver.c | 2 +-
src/lxc/lxc_process.c | 4 ++--
src/qemu/qemu_command.c | 2 +-
src/qemu/qemu_hotplug.c | 4 ++--
src/util/virnetdevbandwidth.c | 6 +++---
src/util/virnetdevbandwidth.h | 4 ++--
11 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c0122dfd07..76e036c48e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29698,8 +29698,8 @@ virDomainNetGetActualVirtPortProfile(const virDomainNetDef
*iface)
}
}
-virNetDevBandwidthPtr
-virDomainNetGetActualBandwidth(virDomainNetDefPtr iface)
+const virNetDevBandwidth *
+virDomainNetGetActualBandwidth(const virDomainNetDef *iface)
{
/* if there is an ActualNetDef, *always* return
* its bandwidth rather than the NetDef's bandwidth.
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9ca3a5bf06..44d5fb8e16 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -3211,8 +3211,8 @@ int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface);
virDomainHostdevDefPtr virDomainNetGetActualHostdev(virDomainNetDefPtr iface);
virNetDevVPortProfilePtr
virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface);
-virNetDevBandwidthPtr
-virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
+const virNetDevBandwidth *
+virDomainNetGetActualBandwidth(const virDomainNetDef *iface);
const virNetDevVlan *virDomainNetGetActualVlan(const virDomainNetDef *iface);
bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface);
const char *virDomainNetGetModelString(const virDomainNetDef *net);
diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c
index 9af2173b7b..0a27735e71 100644
--- a/src/conf/netdev_bandwidth_conf.c
+++ b/src/conf/netdev_bandwidth_conf.c
@@ -260,7 +260,7 @@ virNetDevBandwidthRateFormat(virNetDevBandwidthRatePtr def,
* Returns 0 on success, else -1.
*/
int
-virNetDevBandwidthFormat(virNetDevBandwidthPtr def,
+virNetDevBandwidthFormat(const virNetDevBandwidth *def,
unsigned int class_id,
virBufferPtr buf)
{
diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h
index 898b2fb428..0004e48a4a 100644
--- a/src/conf/netdev_bandwidth_conf.h
+++ b/src/conf/netdev_bandwidth_conf.h
@@ -29,7 +29,7 @@ int virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth,
xmlNodePtr node,
bool allowFloor)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
-int virNetDevBandwidthFormat(virNetDevBandwidthPtr def,
+int virNetDevBandwidthFormat(const virNetDevBandwidth *def,
unsigned int class_id,
virBufferPtr buf);
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 89122826fc..b0d67c7b83 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1216,7 +1216,7 @@ libxlMakeNic(virDomainDefPtr def,
virDomainNetType actual_type = virDomainNetGetActualType(l_nic);
virNetworkPtr network = NULL;
virConnectPtr conn = NULL;
- virNetDevBandwidthPtr actual_bw;
+ const virNetDevBandwidth *actual_bw;
virNetDevVPortProfilePtr port_profile;
const virNetDevVlan *virt_vlan;
virBuffer buf = VIR_BUFFER_INITIALIZER;
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 41a6a446bd..34c70240cb 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3829,7 +3829,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
virLXCDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
virDomainNetType actualType;
- virNetDevBandwidthPtr actualBandwidth;
+ const virNetDevBandwidth *actualBandwidth;
char *veth = NULL;
if (!priv->initpid) {
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 450053d163..323f3632c0 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -338,7 +338,7 @@ char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
char *ret = NULL;
char *res_ifname = NULL;
virLXCDriverPtr driver = conn->privateData;
- virNetDevBandwidthPtr bw;
+ const virNetDevBandwidth *bw;
virNetDevVPortProfilePtr prof;
virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
const char *linkdev = virDomainNetGetActualDirectDev(net);
@@ -557,7 +557,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
for (i = 0; i < def->nnets; i++) {
char *veth = NULL;
- virNetDevBandwidthPtr actualBandwidth;
+ const virNetDevBandwidth *actualBandwidth;
/* If appropriate, grab a physical device from the configured
* network's pool of devices, or resolve bridge device name
* to the one defined in the network definition.
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f24013f9eb..548cba2aec 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8397,7 +8397,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
char **vhostfdName = NULL;
g_autofree char *slirpfdName = NULL;
virDomainNetType actualType = virDomainNetGetActualType(net);
- virNetDevBandwidthPtr actualBandwidth;
+ const virNetDevBandwidth *actualBandwidth;
bool requireNicdev = false;
qemuSlirpPtr slirp;
size_t i;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1fa5e6e0f8..4cbe7b0060 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1146,7 +1146,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
bool releaseaddr = false;
bool iface_connected = false;
virDomainNetType actualType;
- virNetDevBandwidthPtr actualBandwidth;
+ const virNetDevBandwidth *actualBandwidth;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virDomainCCWAddressSetPtr ccwaddrs = NULL;
size_t i;
@@ -3824,7 +3824,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
}
if (needBandwidthSet) {
- virNetDevBandwidthPtr newb = virDomainNetGetActualBandwidth(newdev);
+ const virNetDevBandwidth *newb = virDomainNetGetActualBandwidth(newdev);
if (newb) {
if (virNetDevBandwidthSet(newdev->ifname, newb, false,
diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index b90bd55d32..3f3785cb65 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -190,7 +190,7 @@ virNetDevBandwidthManipulateFilter(const char *ifname,
*/
int
virNetDevBandwidthSet(const char *ifname,
- virNetDevBandwidthPtr bandwidth,
+ const virNetDevBandwidth *bandwidth,
bool hierarchical_class,
bool swapped)
{
@@ -485,8 +485,8 @@ virNetDevBandwidthCopy(virNetDevBandwidthPtr *dest,
}
bool
-virNetDevBandwidthEqual(virNetDevBandwidthPtr a,
- virNetDevBandwidthPtr b)
+virNetDevBandwidthEqual(const virNetDevBandwidth *a,
+ const virNetDevBandwidth *b)
{
if (!a && !b)
return true;
diff --git a/src/util/virnetdevbandwidth.h b/src/util/virnetdevbandwidth.h
index 19323c5ed2..871d0c962c 100644
--- a/src/util/virnetdevbandwidth.h
+++ b/src/util/virnetdevbandwidth.h
@@ -39,7 +39,7 @@ struct _virNetDevBandwidth {
void virNetDevBandwidthFree(virNetDevBandwidthPtr def);
int virNetDevBandwidthSet(const char *ifname,
- virNetDevBandwidthPtr bandwidth,
+ const virNetDevBandwidth *bandwidth,
bool hierarchical_class,
bool swapped)
G_GNUC_WARN_UNUSED_RESULT;
@@ -48,7 +48,7 @@ int virNetDevBandwidthCopy(virNetDevBandwidthPtr *dest,
const virNetDevBandwidth *src)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
-bool virNetDevBandwidthEqual(virNetDevBandwidthPtr a, virNetDevBandwidthPtr b);
+bool virNetDevBandwidthEqual(const virNetDevBandwidth *a, const virNetDevBandwidth *b);
int virNetDevBandwidthPlug(const char *brname,
virNetDevBandwidthPtr net_bandwidth,
--
2.21.0