conf: make virDomainNetGetActualVlan arg/return val const

This is needed if we want to call the function when the
virDomainNetDef* we have is a const.

Since virDomainNetGetActualVlan returns a pointer to memory that is
within the virDomainNetDefPtr arg, the returned pointer must also be
made const. This leads to a cascade of other virNetDevVlanPtr's that
must be changed to "const virNetDevVlan *".

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Laine Stump 2019-10-01 12:25:47 -04:00
parent 1b029a929d
commit 12207fcfcf
14 changed files with 25 additions and 25 deletions

View File

@ -29566,10 +29566,10 @@ virDomainNetGetActualBandwidth(virDomainNetDefPtr iface)
return iface->bandwidth;
}
virNetDevVlanPtr
virDomainNetGetActualVlan(virDomainNetDefPtr iface)
const virNetDevVlan *
virDomainNetGetActualVlan(const virDomainNetDef *iface)
{
virNetDevVlanPtr vlan = &iface->vlan;
const virNetDevVlan *vlan = &iface->vlan;
/* if there is an ActualNetDef, *always* return
* its vlan rather than the NetDef's vlan.

View File

@ -3217,7 +3217,7 @@ virNetDevVPortProfilePtr
virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface);
virNetDevBandwidthPtr
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr iface);
const virNetDevVlan *virDomainNetGetActualVlan(const virDomainNetDef *iface);
bool virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface);
const char *virDomainNetGetModelString(const virDomainNetDef *net);
int virDomainNetSetModelString(virDomainNetDefPtr et,

View File

@ -1204,7 +1204,7 @@ libxlMakeNic(virDomainDefPtr def,
virConnectPtr conn = NULL;
virNetDevBandwidthPtr actual_bw;
virNetDevVPortProfilePtr port_profile;
virNetDevVlanPtr virt_vlan;
const virNetDevVlan *virt_vlan;
virBuffer buf = VIR_BUFFER_INITIALIZER;
size_t i;
const char *script = NULL;

View File

@ -1668,7 +1668,7 @@ xenFormatNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_BRIDGE:
{
virNetDevVPortProfilePtr port_profile = virDomainNetGetActualVirtPortProfile(net);
virNetDevVlanPtr virt_vlan = virDomainNetGetActualVlan(net);
const virNetDevVlan *virt_vlan = virDomainNetGetActualVlan(net);
const char *script = net->script;
size_t i;

View File

@ -497,7 +497,7 @@ virHostdevSetNetConfig(virDomainHostdevDefPtr hostdev,
const unsigned char *uuid)
{
g_autofree char *linkdev = NULL;
virNetDevVlanPtr vlan;
const virNetDevVlan *vlan;
virNetDevVPortProfilePtr virtPort;
int vf = -1;
bool port_profile_associate = true;

View File

@ -2168,7 +2168,7 @@ virNetDevReadNetConfig(const char *linkdev, int vf,
int
virNetDevSetNetConfig(const char *linkdev, int vf,
const virMacAddr *adminMAC,
virNetDevVlanPtr vlan,
const virNetDevVlan *vlan,
const virMacAddr *MAC,
bool setVlan)
{
@ -2391,7 +2391,7 @@ int
virNetDevSetNetConfig(const char *linkdev G_GNUC_UNUSED,
int vf G_GNUC_UNUSED,
const virMacAddr *adminMAC G_GNUC_UNUSED,
virNetDevVlanPtr vlan G_GNUC_UNUSED,
const virNetDevVlan *vlan G_GNUC_UNUSED,
const virMacAddr *MAC G_GNUC_UNUSED,
bool setVlan G_GNUC_UNUSED)
{

View File

@ -253,7 +253,7 @@ virNetDevReadNetConfig(const char *linkdev, int vf,
int
virNetDevSetNetConfig(const char *linkdev, int vf,
const virMacAddr *adminMAC,
virNetDevVlanPtr vlan,
const virNetDevVlan *vlan,
const virMacAddr *MAC,
bool setVLan)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;

View File

@ -893,7 +893,7 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifnameRequested,
const virMacAddr *macaddress,
const char *linkdev,
virNetDevMacVLanMode mode,
virNetDevVlanPtr vlan,
const virNetDevVlan *vlan,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
char **ifnameResult,
@ -1222,7 +1222,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname G_GNUC_UNUSED,
const virMacAddr *macaddress G_GNUC_UNUSED,
const char *linkdev G_GNUC_UNUSED,
virNetDevMacVLanMode mode G_GNUC_UNUSED,
virNetDevVlanPtr vlan G_GNUC_UNUSED,
const virNetDevVlan *vlan G_GNUC_UNUSED,
const unsigned char *vmuuid G_GNUC_UNUSED,
virNetDevVPortProfilePtr virtPortProfile G_GNUC_UNUSED,
char **res_ifname G_GNUC_UNUSED,

View File

@ -76,7 +76,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname,
const virMacAddr *macaddress,
const char *linkdev,
virNetDevMacVLanMode mode,
virNetDevVlanPtr vlan,
const virNetDevVlan *vlan,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
char **res_ifname,

View File

@ -68,7 +68,7 @@ virNetDevOpenvswitchAddTimeout(virCommandPtr cmd)
* Returns 0 in case of success or -1 in case of failure.
*/
static int
virNetDevOpenvswitchConstructVlans(virCommandPtr cmd, virNetDevVlanPtr virtVlan)
virNetDevOpenvswitchConstructVlans(virCommandPtr cmd, const virNetDevVlan *virtVlan)
{
int ret = -1;
size_t i = 0;
@ -133,7 +133,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
const virMacAddr *macaddr,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr ovsport,
virNetDevVlanPtr virtVlan)
const virNetDevVlan *virtVlan)
{
char macaddrstr[VIR_MAC_STRING_BUFLEN];
char ifuuidstr[VIR_UUID_STRING_BUFLEN];
@ -538,7 +538,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
* Returns 0 in case of success or -1 in case of failure.
*/
int virNetDevOpenvswitchUpdateVlan(const char *ifname,
virNetDevVlanPtr virtVlan)
const virNetDevVlan *virtVlan)
{
g_autoptr(virCommand) cmd = NULL;

View File

@ -33,7 +33,7 @@ int virNetDevOpenvswitchAddPort(const char *brname,
const virMacAddr *macaddr,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr ovsport,
virNetDevVlanPtr virtVlan)
const virNetDevVlan *virtVlan)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
G_GNUC_WARN_UNUSED_RESULT;
@ -65,5 +65,5 @@ int virNetDevOpenvswitchGetVhostuserIfname(const char *path,
ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevOpenvswitchUpdateVlan(const char *ifname,
virNetDevVlanPtr virtVlan)
const virNetDevVlan *virtVlan)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;

View File

@ -500,7 +500,7 @@ virNetDevTapAttachBridge(const char *tapname,
const virMacAddr *macaddr,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan,
const virNetDevVlan *virtVlan,
unsigned int mtu,
unsigned int *actualMTU)
{
@ -572,7 +572,7 @@ virNetDevTapReattachBridge(const char *tapname,
const virMacAddr *macaddr,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan,
const virNetDevVlan *virtVlan,
unsigned int mtu,
unsigned int *actualMTU)
{
@ -658,7 +658,7 @@ int virNetDevTapCreateInBridgePort(const char *brname,
int *tapfd,
size_t tapfdSize,
virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan,
const virNetDevVlan *virtVlan,
virNetDevCoalescePtr coalesce,
unsigned int mtu,
unsigned int *actualMTU,

View File

@ -64,7 +64,7 @@ virNetDevTapAttachBridge(const char *tapname,
const virMacAddr *macaddr,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan,
const virNetDevVlan *virtVlan,
unsigned int mtu,
unsigned int *actualMTU)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
@ -76,7 +76,7 @@ virNetDevTapReattachBridge(const char *tapname,
const virMacAddr *macaddr,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan,
const virNetDevVlan *virtVlan,
unsigned int mtu,
unsigned int *actualMTU)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
@ -90,7 +90,7 @@ int virNetDevTapCreateInBridgePort(const char *brname,
int *tapfd,
size_t tapfdSize,
virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan,
const virNetDevVlan *virtVlan,
virNetDevCoalescePtr coalesce,
unsigned int mtu,
unsigned int *actualMTU,

View File

@ -27,7 +27,7 @@ int virNetDevTapCreateInBridgePort(const char *brname G_GNUC_UNUSED,
int *tapfd G_GNUC_UNUSED,
size_t tapfdSize G_GNUC_UNUSED,
virNetDevVPortProfilePtr virtPortProfile G_GNUC_UNUSED,
virNetDevVlanPtr virtVlan G_GNUC_UNUSED,
const virNetDevVlan *virtVlan G_GNUC_UNUSED,
virNetDevCoalescePtr coalesce G_GNUC_UNUSED,
unsigned int mtu G_GNUC_UNUSED,
unsigned int *actualMTU G_GNUC_UNUSED,