提交 12207fcf 编写于 作者: L Laine Stump

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: NLaine Stump <laine@redhat.com>
Reviewed-by: NCole Robinson <crobinso@redhat.com>
上级 1b029a92
...@@ -29566,10 +29566,10 @@ virDomainNetGetActualBandwidth(virDomainNetDefPtr iface) ...@@ -29566,10 +29566,10 @@ virDomainNetGetActualBandwidth(virDomainNetDefPtr iface)
return iface->bandwidth; return iface->bandwidth;
} }
virNetDevVlanPtr const virNetDevVlan *
virDomainNetGetActualVlan(virDomainNetDefPtr iface) virDomainNetGetActualVlan(const virDomainNetDef *iface)
{ {
virNetDevVlanPtr vlan = &iface->vlan; const virNetDevVlan *vlan = &iface->vlan;
/* if there is an ActualNetDef, *always* return /* if there is an ActualNetDef, *always* return
* its vlan rather than the NetDef's vlan. * its vlan rather than the NetDef's vlan.
......
...@@ -3217,7 +3217,7 @@ virNetDevVPortProfilePtr ...@@ -3217,7 +3217,7 @@ virNetDevVPortProfilePtr
virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface); virDomainNetGetActualVirtPortProfile(const virDomainNetDef *iface);
virNetDevBandwidthPtr virNetDevBandwidthPtr
virDomainNetGetActualBandwidth(virDomainNetDefPtr iface); virDomainNetGetActualBandwidth(virDomainNetDefPtr iface);
virNetDevVlanPtr virDomainNetGetActualVlan(virDomainNetDefPtr 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);
int virDomainNetSetModelString(virDomainNetDefPtr et, int virDomainNetSetModelString(virDomainNetDefPtr et,
......
...@@ -1204,7 +1204,7 @@ libxlMakeNic(virDomainDefPtr def, ...@@ -1204,7 +1204,7 @@ libxlMakeNic(virDomainDefPtr def,
virConnectPtr conn = NULL; virConnectPtr conn = NULL;
virNetDevBandwidthPtr actual_bw; virNetDevBandwidthPtr actual_bw;
virNetDevVPortProfilePtr port_profile; virNetDevVPortProfilePtr port_profile;
virNetDevVlanPtr virt_vlan; const virNetDevVlan *virt_vlan;
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
size_t i; size_t i;
const char *script = NULL; const char *script = NULL;
......
...@@ -1668,7 +1668,7 @@ xenFormatNet(virConnectPtr conn, ...@@ -1668,7 +1668,7 @@ xenFormatNet(virConnectPtr conn,
case VIR_DOMAIN_NET_TYPE_BRIDGE: case VIR_DOMAIN_NET_TYPE_BRIDGE:
{ {
virNetDevVPortProfilePtr port_profile = virDomainNetGetActualVirtPortProfile(net); virNetDevVPortProfilePtr port_profile = virDomainNetGetActualVirtPortProfile(net);
virNetDevVlanPtr virt_vlan = virDomainNetGetActualVlan(net); const virNetDevVlan *virt_vlan = virDomainNetGetActualVlan(net);
const char *script = net->script; const char *script = net->script;
size_t i; size_t i;
......
...@@ -497,7 +497,7 @@ virHostdevSetNetConfig(virDomainHostdevDefPtr hostdev, ...@@ -497,7 +497,7 @@ virHostdevSetNetConfig(virDomainHostdevDefPtr hostdev,
const unsigned char *uuid) const unsigned char *uuid)
{ {
g_autofree char *linkdev = NULL; g_autofree char *linkdev = NULL;
virNetDevVlanPtr vlan; const virNetDevVlan *vlan;
virNetDevVPortProfilePtr virtPort; virNetDevVPortProfilePtr virtPort;
int vf = -1; int vf = -1;
bool port_profile_associate = true; bool port_profile_associate = true;
......
...@@ -2168,7 +2168,7 @@ virNetDevReadNetConfig(const char *linkdev, int vf, ...@@ -2168,7 +2168,7 @@ virNetDevReadNetConfig(const char *linkdev, int vf,
int int
virNetDevSetNetConfig(const char *linkdev, int vf, virNetDevSetNetConfig(const char *linkdev, int vf,
const virMacAddr *adminMAC, const virMacAddr *adminMAC,
virNetDevVlanPtr vlan, const virNetDevVlan *vlan,
const virMacAddr *MAC, const virMacAddr *MAC,
bool setVlan) bool setVlan)
{ {
...@@ -2391,7 +2391,7 @@ int ...@@ -2391,7 +2391,7 @@ int
virNetDevSetNetConfig(const char *linkdev G_GNUC_UNUSED, virNetDevSetNetConfig(const char *linkdev G_GNUC_UNUSED,
int vf G_GNUC_UNUSED, int vf G_GNUC_UNUSED,
const virMacAddr *adminMAC 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, const virMacAddr *MAC G_GNUC_UNUSED,
bool setVlan G_GNUC_UNUSED) bool setVlan G_GNUC_UNUSED)
{ {
......
...@@ -253,7 +253,7 @@ virNetDevReadNetConfig(const char *linkdev, int vf, ...@@ -253,7 +253,7 @@ virNetDevReadNetConfig(const char *linkdev, int vf,
int int
virNetDevSetNetConfig(const char *linkdev, int vf, virNetDevSetNetConfig(const char *linkdev, int vf,
const virMacAddr *adminMAC, const virMacAddr *adminMAC,
virNetDevVlanPtr vlan, const virNetDevVlan *vlan,
const virMacAddr *MAC, const virMacAddr *MAC,
bool setVLan) bool setVLan)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
......
...@@ -893,7 +893,7 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifnameRequested, ...@@ -893,7 +893,7 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifnameRequested,
const virMacAddr *macaddress, const virMacAddr *macaddress,
const char *linkdev, const char *linkdev,
virNetDevMacVLanMode mode, virNetDevMacVLanMode mode,
virNetDevVlanPtr vlan, const virNetDevVlan *vlan,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile, virNetDevVPortProfilePtr virtPortProfile,
char **ifnameResult, char **ifnameResult,
...@@ -1222,7 +1222,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname G_GNUC_UNUSED, ...@@ -1222,7 +1222,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname G_GNUC_UNUSED,
const virMacAddr *macaddress G_GNUC_UNUSED, const virMacAddr *macaddress G_GNUC_UNUSED,
const char *linkdev G_GNUC_UNUSED, const char *linkdev G_GNUC_UNUSED,
virNetDevMacVLanMode mode 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, const unsigned char *vmuuid G_GNUC_UNUSED,
virNetDevVPortProfilePtr virtPortProfile G_GNUC_UNUSED, virNetDevVPortProfilePtr virtPortProfile G_GNUC_UNUSED,
char **res_ifname G_GNUC_UNUSED, char **res_ifname G_GNUC_UNUSED,
......
...@@ -76,7 +76,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname, ...@@ -76,7 +76,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname,
const virMacAddr *macaddress, const virMacAddr *macaddress,
const char *linkdev, const char *linkdev,
virNetDevMacVLanMode mode, virNetDevMacVLanMode mode,
virNetDevVlanPtr vlan, const virNetDevVlan *vlan,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile, virNetDevVPortProfilePtr virtPortProfile,
char **res_ifname, char **res_ifname,
......
...@@ -68,7 +68,7 @@ virNetDevOpenvswitchAddTimeout(virCommandPtr cmd) ...@@ -68,7 +68,7 @@ virNetDevOpenvswitchAddTimeout(virCommandPtr cmd)
* Returns 0 in case of success or -1 in case of failure. * Returns 0 in case of success or -1 in case of failure.
*/ */
static int static int
virNetDevOpenvswitchConstructVlans(virCommandPtr cmd, virNetDevVlanPtr virtVlan) virNetDevOpenvswitchConstructVlans(virCommandPtr cmd, const virNetDevVlan *virtVlan)
{ {
int ret = -1; int ret = -1;
size_t i = 0; size_t i = 0;
...@@ -133,7 +133,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, ...@@ -133,7 +133,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
const virMacAddr *macaddr, const virMacAddr *macaddr,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virNetDevVPortProfilePtr ovsport, virNetDevVPortProfilePtr ovsport,
virNetDevVlanPtr virtVlan) const virNetDevVlan *virtVlan)
{ {
char macaddrstr[VIR_MAC_STRING_BUFLEN]; char macaddrstr[VIR_MAC_STRING_BUFLEN];
char ifuuidstr[VIR_UUID_STRING_BUFLEN]; char ifuuidstr[VIR_UUID_STRING_BUFLEN];
...@@ -538,7 +538,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path, ...@@ -538,7 +538,7 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *path,
* Returns 0 in case of success or -1 in case of failure. * Returns 0 in case of success or -1 in case of failure.
*/ */
int virNetDevOpenvswitchUpdateVlan(const char *ifname, int virNetDevOpenvswitchUpdateVlan(const char *ifname,
virNetDevVlanPtr virtVlan) const virNetDevVlan *virtVlan)
{ {
g_autoptr(virCommand) cmd = NULL; g_autoptr(virCommand) cmd = NULL;
......
...@@ -33,7 +33,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, ...@@ -33,7 +33,7 @@ int virNetDevOpenvswitchAddPort(const char *brname,
const virMacAddr *macaddr, const virMacAddr *macaddr,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virNetDevVPortProfilePtr ovsport, virNetDevVPortProfilePtr ovsport,
virNetDevVlanPtr virtVlan) const virNetDevVlan *virtVlan)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
G_GNUC_WARN_UNUSED_RESULT; G_GNUC_WARN_UNUSED_RESULT;
...@@ -65,5 +65,5 @@ int virNetDevOpenvswitchGetVhostuserIfname(const char *path, ...@@ -65,5 +65,5 @@ int virNetDevOpenvswitchGetVhostuserIfname(const char *path,
ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE; ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT G_GNUC_NO_INLINE;
int virNetDevOpenvswitchUpdateVlan(const char *ifname, int virNetDevOpenvswitchUpdateVlan(const char *ifname,
virNetDevVlanPtr virtVlan) const virNetDevVlan *virtVlan)
ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT; ATTRIBUTE_NONNULL(1) G_GNUC_WARN_UNUSED_RESULT;
...@@ -500,7 +500,7 @@ virNetDevTapAttachBridge(const char *tapname, ...@@ -500,7 +500,7 @@ virNetDevTapAttachBridge(const char *tapname,
const virMacAddr *macaddr, const virMacAddr *macaddr,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile, virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan, const virNetDevVlan *virtVlan,
unsigned int mtu, unsigned int mtu,
unsigned int *actualMTU) unsigned int *actualMTU)
{ {
...@@ -572,7 +572,7 @@ virNetDevTapReattachBridge(const char *tapname, ...@@ -572,7 +572,7 @@ virNetDevTapReattachBridge(const char *tapname,
const virMacAddr *macaddr, const virMacAddr *macaddr,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile, virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan, const virNetDevVlan *virtVlan,
unsigned int mtu, unsigned int mtu,
unsigned int *actualMTU) unsigned int *actualMTU)
{ {
...@@ -658,7 +658,7 @@ int virNetDevTapCreateInBridgePort(const char *brname, ...@@ -658,7 +658,7 @@ int virNetDevTapCreateInBridgePort(const char *brname,
int *tapfd, int *tapfd,
size_t tapfdSize, size_t tapfdSize,
virNetDevVPortProfilePtr virtPortProfile, virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan, const virNetDevVlan *virtVlan,
virNetDevCoalescePtr coalesce, virNetDevCoalescePtr coalesce,
unsigned int mtu, unsigned int mtu,
unsigned int *actualMTU, unsigned int *actualMTU,
......
...@@ -64,7 +64,7 @@ virNetDevTapAttachBridge(const char *tapname, ...@@ -64,7 +64,7 @@ virNetDevTapAttachBridge(const char *tapname,
const virMacAddr *macaddr, const virMacAddr *macaddr,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile, virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan, const virNetDevVlan *virtVlan,
unsigned int mtu, unsigned int mtu,
unsigned int *actualMTU) unsigned int *actualMTU)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
...@@ -76,7 +76,7 @@ virNetDevTapReattachBridge(const char *tapname, ...@@ -76,7 +76,7 @@ virNetDevTapReattachBridge(const char *tapname,
const virMacAddr *macaddr, const virMacAddr *macaddr,
const unsigned char *vmuuid, const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile, virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan, const virNetDevVlan *virtVlan,
unsigned int mtu, unsigned int mtu,
unsigned int *actualMTU) unsigned int *actualMTU)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
...@@ -90,7 +90,7 @@ int virNetDevTapCreateInBridgePort(const char *brname, ...@@ -90,7 +90,7 @@ int virNetDevTapCreateInBridgePort(const char *brname,
int *tapfd, int *tapfd,
size_t tapfdSize, size_t tapfdSize,
virNetDevVPortProfilePtr virtPortProfile, virNetDevVPortProfilePtr virtPortProfile,
virNetDevVlanPtr virtVlan, const virNetDevVlan *virtVlan,
virNetDevCoalescePtr coalesce, virNetDevCoalescePtr coalesce,
unsigned int mtu, unsigned int mtu,
unsigned int *actualMTU, unsigned int *actualMTU,
......
...@@ -27,7 +27,7 @@ int virNetDevTapCreateInBridgePort(const char *brname G_GNUC_UNUSED, ...@@ -27,7 +27,7 @@ int virNetDevTapCreateInBridgePort(const char *brname G_GNUC_UNUSED,
int *tapfd G_GNUC_UNUSED, int *tapfd G_GNUC_UNUSED,
size_t tapfdSize G_GNUC_UNUSED, size_t tapfdSize G_GNUC_UNUSED,
virNetDevVPortProfilePtr virtPortProfile G_GNUC_UNUSED, virNetDevVPortProfilePtr virtPortProfile G_GNUC_UNUSED,
virNetDevVlanPtr virtVlan G_GNUC_UNUSED, const virNetDevVlan *virtVlan G_GNUC_UNUSED,
virNetDevCoalescePtr coalesce G_GNUC_UNUSED, virNetDevCoalescePtr coalesce G_GNUC_UNUSED,
unsigned int mtu G_GNUC_UNUSED, unsigned int mtu G_GNUC_UNUSED,
unsigned int *actualMTU G_GNUC_UNUSED, unsigned int *actualMTU G_GNUC_UNUSED,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册