提交 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)
}
}
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.
......
......@@ -3215,8 +3215,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);
......
......@@ -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)
{
......
......@@ -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);
......
......@@ -1202,7 +1202,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;
......
......@@ -3812,7 +3812,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn,
virLXCDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
virDomainNetType actualType;
virNetDevBandwidthPtr actualBandwidth;
const virNetDevBandwidth *actualBandwidth;
char *veth = NULL;
if (!priv->initpid) {
......
......@@ -333,7 +333,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);
......@@ -546,7 +546,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.
......
......@@ -8295,7 +8295,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;
......
......@@ -1147,7 +1147,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;
......@@ -3812,7 +3812,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
}
if (needBandwidthSet) {
virNetDevBandwidthPtr newb = virDomainNetGetActualBandwidth(newdev);
const virNetDevBandwidth *newb = virDomainNetGetActualBandwidth(newdev);
if (newb) {
if (virNetDevBandwidthSet(newdev->ifname, newb, false,
......
......@@ -188,7 +188,7 @@ virNetDevBandwidthManipulateFilter(const char *ifname,
*/
int
virNetDevBandwidthSet(const char *ifname,
virNetDevBandwidthPtr bandwidth,
const virNetDevBandwidth *bandwidth,
bool hierarchical_class,
bool swapped)
{
......@@ -478,8 +478,8 @@ virNetDevBandwidthCopy(virNetDevBandwidthPtr *dest,
}
bool
virNetDevBandwidthEqual(virNetDevBandwidthPtr a,
virNetDevBandwidthPtr b)
virNetDevBandwidthEqual(const virNetDevBandwidth *a,
const virNetDevBandwidth *b)
{
if (!a && !b)
return true;
......
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册