提交 583ac17f 编写于 作者: L Laine Stump

conf: make virDomainNetGetActualBandwidth arg/return value const

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: NLaine Stump <laine@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 12207fcf
...@@ -29554,8 +29554,8 @@ virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface) ...@@ -29554,8 +29554,8 @@ virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface)
} }
} }
virNetDevBandwidthPtr const virNetDevBandwidth *
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface) virDomainNetGetActualBandwidth(const virDomainNetDef *iface)
{ {
/* if there is an ActualNetDef, *always* return /* if there is an ActualNetDef, *always* return
* its bandwidth rather than the NetDef's bandwidth. * its bandwidth rather than the NetDef's bandwidth.
......
...@@ -3215,8 +3215,8 @@ int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface); ...@@ -3215,8 +3215,8 @@ int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface);
virDomainHostdevDefPtr virDomainNetGetActualHostdev(virDomainNetDefPtr iface); virDomainHostdevDefPtr virDomainNetGetActualHostdev(virDomainNetDefPtr iface);
virNetDevVPortProfilePtr virNetDevVPortProfilePtr
virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface); virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface);
virNetDevBandwidthPtr const virNetDevBandwidth *
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface); virDomainNetGetActualBandwidth(const virDomainNetDef *iface);
const virNetDevVlan *virDomainNetGetActualVlan(const virDomainNetDef *iface); const virNetDevVlan *virDomainNetGetActualVlan(const virDomainNetDef *iface);
bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface); bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface);
const char *virDomainNetGetModelString(const virDomainNetDef *net); const char *virDomainNetGetModelString(const virDomainNetDef *net);
......
...@@ -260,7 +260,7 @@ virNetDevBandwidthRateFormat(virNetDevBandwidthRatePtr def, ...@@ -260,7 +260,7 @@ virNetDevBandwidthRateFormat(virNetDevBandwidthRatePtr def,
* Returns 0 on success, else -1. * Returns 0 on success, else -1.
*/ */
int int
virNetDevBandwidthFormat(virNetDevBandwidthPtr def, virNetDevBandwidthFormat(const virNetDevBandwidth *def,
unsigned int class_id, unsigned int class_id,
virBufferPtr buf) virBufferPtr buf)
{ {
......
...@@ -29,7 +29,7 @@ int virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth, ...@@ -29,7 +29,7 @@ int virNetDevBandwidthParse(virNetDevBandwidthPtr *bandwidth,
xmlNodePtr node, xmlNodePtr node,
bool allowFloor) bool allowFloor)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
int virNetDevBandwidthFormat(virNetDevBandwidthPtr def, int virNetDevBandwidthFormat(const virNetDevBandwidth *def,
unsigned int class_id, unsigned int class_id,
virBufferPtr buf); virBufferPtr buf);
......
...@@ -1202,7 +1202,7 @@ libxlMakeNic(virDomainDefPtr def, ...@@ -1202,7 +1202,7 @@ libxlMakeNic(virDomainDefPtr def,
virDomainNetType actual_type = virDomainNetGetActualType(l_nic); virDomainNetType actual_type = virDomainNetGetActualType(l_nic);
virNetworkPtr network = NULL; virNetworkPtr network = NULL;
virConnectPtr conn = NULL; virConnectPtr conn = NULL;
virNetDevBandwidthPtr actual_bw; const virNetDevBandwidth *actual_bw;
virNetDevVPortProfilePtr port_profile; virNetDevVPortProfilePtr port_profile;
const virNetDevVlan *virt_vlan; const virNetDevVlan *virt_vlan;
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
......
...@@ -3812,7 +3812,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn, ...@@ -3812,7 +3812,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
virLXCDomainObjPrivatePtr priv = vm->privateData; virLXCDomainObjPrivatePtr priv = vm->privateData;
int ret = -1; int ret = -1;
virDomainNetType actualType; virDomainNetType actualType;
virNetDevBandwidthPtr actualBandwidth; const virNetDevBandwidth *actualBandwidth;
char *veth = NULL; char *veth = NULL;
if (!priv->initpid) { if (!priv->initpid) {
......
...@@ -333,7 +333,7 @@ char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn, ...@@ -333,7 +333,7 @@ char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
char *ret = NULL; char *ret = NULL;
char *res_ifname = NULL; char *res_ifname = NULL;
virLXCDriverPtr driver = conn->privateData; virLXCDriverPtr driver = conn->privateData;
virNetDevBandwidthPtr bw; const virNetDevBandwidth *bw;
virNetDevVPortProfilePtr prof; virNetDevVPortProfilePtr prof;
virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver); virLXCDriverConfigPtr cfg = virLXCDriverGetConfig(driver);
const char *linkdev = virDomainNetGetActualDirectDev(net); const char *linkdev = virDomainNetGetActualDirectDev(net);
...@@ -546,7 +546,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn, ...@@ -546,7 +546,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn,
for (i = 0; i < def->nnets; i++) { for (i = 0; i < def->nnets; i++) {
char *veth = NULL; char *veth = NULL;
virNetDevBandwidthPtr actualBandwidth; const virNetDevBandwidth *actualBandwidth;
/* If appropriate, grab a physical device from the configured /* If appropriate, grab a physical device from the configured
* network's pool of devices, or resolve bridge device name * network's pool of devices, or resolve bridge device name
* to the one defined in the network definition. * to the one defined in the network definition.
......
...@@ -8295,7 +8295,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, ...@@ -8295,7 +8295,7 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver,
char **vhostfdName = NULL; char **vhostfdName = NULL;
g_autofree char *slirpfdName = NULL; g_autofree char *slirpfdName = NULL;
virDomainNetType actualType = virDomainNetGetActualType(net); virDomainNetType actualType = virDomainNetGetActualType(net);
virNetDevBandwidthPtr actualBandwidth; const virNetDevBandwidth *actualBandwidth;
bool requireNicdev = false; bool requireNicdev = false;
qemuSlirpPtr slirp; qemuSlirpPtr slirp;
size_t i; size_t i;
......
...@@ -1147,7 +1147,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, ...@@ -1147,7 +1147,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
bool releaseaddr = false; bool releaseaddr = false;
bool iface_connected = false; bool iface_connected = false;
virDomainNetType actualType; virDomainNetType actualType;
virNetDevBandwidthPtr actualBandwidth; const virNetDevBandwidth *actualBandwidth;
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
virDomainCCWAddressSetPtr ccwaddrs = NULL; virDomainCCWAddressSetPtr ccwaddrs = NULL;
size_t i; size_t i;
...@@ -3812,7 +3812,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, ...@@ -3812,7 +3812,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
} }
if (needBandwidthSet) { if (needBandwidthSet) {
virNetDevBandwidthPtr newb = virDomainNetGetActualBandwidth(newdev); const virNetDevBandwidth *newb = virDomainNetGetActualBandwidth(newdev);
if (newb) { if (newb) {
if (virNetDevBandwidthSet(newdev->ifname, newb, false, if (virNetDevBandwidthSet(newdev->ifname, newb, false,
......
...@@ -188,7 +188,7 @@ virNetDevBandwidthManipulateFilter(const char *ifname, ...@@ -188,7 +188,7 @@ virNetDevBandwidthManipulateFilter(const char *ifname,
*/ */
int int
virNetDevBandwidthSet(const char *ifname, virNetDevBandwidthSet(const char *ifname,
virNetDevBandwidthPtr bandwidth, const virNetDevBandwidth *bandwidth,
bool hierarchical_class, bool hierarchical_class,
bool swapped) bool swapped)
{ {
...@@ -478,8 +478,8 @@ virNetDevBandwidthCopy(virNetDevBandwidthPtr *dest, ...@@ -478,8 +478,8 @@ virNetDevBandwidthCopy(virNetDevBandwidthPtr *dest,
} }
bool bool
virNetDevBandwidthEqual(virNetDevBandwidthPtr a, virNetDevBandwidthEqual(const virNetDevBandwidth *a,
virNetDevBandwidthPtr b) const virNetDevBandwidth *b)
{ {
if (!a && !b) if (!a && !b)
return true; return true;
......
...@@ -39,7 +39,7 @@ struct _virNetDevBandwidth { ...@@ -39,7 +39,7 @@ struct _virNetDevBandwidth {
void virNetDevBandwidthFree(virNetDevBandwidthPtr def); void virNetDevBandwidthFree(virNetDevBandwidthPtr def);
int virNetDevBandwidthSet(const char *ifname, int virNetDevBandwidthSet(const char *ifname,
virNetDevBandwidthPtr bandwidth, const virNetDevBandwidth *bandwidth,
bool hierarchical_class, bool hierarchical_class,
bool swapped) bool swapped)
G_GNUC_WARN_UNUSED_RESULT; G_GNUC_WARN_UNUSED_RESULT;
...@@ -48,7 +48,7 @@ int virNetDevBandwidthCopy(virNetDevBandwidthPtr *dest, ...@@ -48,7 +48,7 @@ int virNetDevBandwidthCopy(virNetDevBandwidthPtr *dest,
const virNetDevBandwidth *src) const virNetDevBandwidth *src)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; 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, int virNetDevBandwidthPlug(const char *brname,
virNetDevBandwidthPtr net_bandwidth, virNetDevBandwidthPtr net_bandwidth,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册