[libvirt PATCH 15/21] meson: remove obsolete check for GET_VLAN_VID_CMD

Daniel P. Berrangé posted 21 patches 3 years, 2 months ago
[libvirt PATCH 15/21] meson: remove obsolete check for GET_VLAN_VID_CMD
Posted by Daniel P. Berrangé 3 years, 2 months ago
The ETHTOOL_GFEATURES constant has existed since before Linux moved
to git.

This is old enough that all our supported platforms can be assumed
to have this feature.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 meson.build          | 3 ---
 src/util/virnetdev.c | 6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index 7fb17bf983..f28af30936 100644
--- a/meson.build
+++ b/meson.build
@@ -650,9 +650,6 @@ symbols = [
   # Check whether endian provides handy macros.
   [ 'endian.h', 'htole64' ],
 
-  # GET_VLAN_VID_CMD is required for virNetDevGetVLanID
-  [ 'linux/if_vlan.h', 'GET_VLAN_VID_CMD' ],
-
   [ 'unistd.h', 'SEEK_HOLE' ],
 
   # Check for BSD approach for setting MAC addr
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index a73d624453..9b0f26c1f9 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -959,7 +959,7 @@ virNetDevGetMaster(const char *ifname G_GNUC_UNUSED,
 #endif /* defined(WITH_LIBNL) */
 
 
-#if defined(SIOCGIFVLAN) && defined(WITH_STRUCT_IFREQ) && WITH_DECL_GET_VLAN_VID_CMD
+#if __linux__
 int virNetDevGetVLanID(const char *ifname, int *vlanid)
 {
     struct vlan_ioctl_args vlanargs = {
@@ -989,7 +989,7 @@ int virNetDevGetVLanID(const char *ifname, int *vlanid)
     *vlanid = vlanargs.u.VID;
     return 0;
 }
-#else /* ! SIOCGIFVLAN */
+#else /* ! __linux__ */
 int virNetDevGetVLanID(const char *ifname G_GNUC_UNUSED,
                        int *vlanid G_GNUC_UNUSED)
 {
@@ -997,7 +997,7 @@ int virNetDevGetVLanID(const char *ifname G_GNUC_UNUSED,
                          _("Unable to get VLAN on this platform"));
     return -1;
 }
-#endif /* ! SIOCGIFVLAN */
+#endif /* ! __linux__ */
 
 
 /**
-- 
2.38.1

Re: [libvirt PATCH 15/21] meson: remove obsolete check for GET_VLAN_VID_CMD
Posted by Jonathon Jongsma 3 years, 2 months ago
On 12/8/22 8:35 AM, Daniel P. Berrangé wrote:
> The ETHTOOL_GFEATURES constant has existed since before Linux moved
> to git.

^ This sentence mentions the wrong constant name.

> 
> This is old enough that all our supported platforms can be assumed
> to have this feature.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   meson.build          | 3 ---
>   src/util/virnetdev.c | 6 +++---
>   2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 7fb17bf983..f28af30936 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -650,9 +650,6 @@ symbols = [
>     # Check whether endian provides handy macros.
>     [ 'endian.h', 'htole64' ],
>   
> -  # GET_VLAN_VID_CMD is required for virNetDevGetVLanID
> -  [ 'linux/if_vlan.h', 'GET_VLAN_VID_CMD' ],
> -
>     [ 'unistd.h', 'SEEK_HOLE' ],
>   
>     # Check for BSD approach for setting MAC addr
> diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
> index a73d624453..9b0f26c1f9 100644
> --- a/src/util/virnetdev.c
> +++ b/src/util/virnetdev.c
> @@ -959,7 +959,7 @@ virNetDevGetMaster(const char *ifname G_GNUC_UNUSED,
>   #endif /* defined(WITH_LIBNL) */
>   
>   
> -#if defined(SIOCGIFVLAN) && defined(WITH_STRUCT_IFREQ) && WITH_DECL_GET_VLAN_VID_CMD
> +#if __linux__
>   int virNetDevGetVLanID(const char *ifname, int *vlanid)
>   {
>       struct vlan_ioctl_args vlanargs = {
> @@ -989,7 +989,7 @@ int virNetDevGetVLanID(const char *ifname, int *vlanid)
>       *vlanid = vlanargs.u.VID;
>       return 0;
>   }
> -#else /* ! SIOCGIFVLAN */
> +#else /* ! __linux__ */
>   int virNetDevGetVLanID(const char *ifname G_GNUC_UNUSED,
>                          int *vlanid G_GNUC_UNUSED)
>   {
> @@ -997,7 +997,7 @@ int virNetDevGetVLanID(const char *ifname G_GNUC_UNUSED,
>                            _("Unable to get VLAN on this platform"));
>       return -1;
>   }
> -#endif /* ! SIOCGIFVLAN */
> +#endif /* ! __linux__ */
>   
>   
>   /**