[PATCH 6/6] configure / meson: Move check for linux/btrfs.h to meson.build

Thomas Huth posted 6 patches 5 years, 2 months ago
Maintainers: Laurent Vivier <laurent@vivier.eu>
[PATCH 6/6] configure / meson: Move check for linux/btrfs.h to meson.build
Posted by Thomas Huth 5 years, 2 months ago
This check can be done in a much shorter way in meson.build. And while
we're at it, rename the #define to HAVE_BTRFS_H to match the other
HAVE_someheader_H symbols that we already have.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure                 | 9 ---------
 linux-user/syscall.c      | 2 +-
 linux-user/syscall_defs.h | 2 +-
 meson.build               | 1 +
 4 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 8d40a0beb3..1ba4bf9a3d 100755
--- a/configure
+++ b/configure
@@ -4389,12 +4389,6 @@ if compile_prog "" "" ; then
   syncfs=yes
 fi
 
-# check for btrfs filesystem support (kernel must be 3.9+)
-btrfs=no
-if check_include linux/btrfs.h ; then
-    btrfs=yes
-fi
-
 # Search for bswap_32 function
 byteswap_h=no
 cat > $TMPC << EOF
@@ -6086,9 +6080,6 @@ fi
 if test "$syncfs" = "yes" ; then
   echo "CONFIG_SYNCFS=y" >> $config_host_mak
 fi
-if test "$btrfs" = "yes" ; then
-  echo "CONFIG_BTRFS=y" >> $config_host_mak
-fi
 if test "$inotify" = "yes" ; then
   echo "CONFIG_INOTIFY=y" >> $config_host_mak
 fi
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 063130be04..7bf99beb18 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -112,7 +112,7 @@
 #include <linux/if_alg.h>
 #include <linux/rtc.h>
 #include <sound/asound.h>
-#ifdef CONFIG_BTRFS
+#ifdef HAVE_BTRFS_H
 #include <linux/btrfs.h>
 #endif
 #ifdef HAVE_DRM_H
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index cabbfb762d..b934d0b606 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1006,7 +1006,7 @@ struct target_rtc_pll_info {
 #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
 
 /* btrfs ioctls */
-#ifdef CONFIG_BTRFS
+#ifdef HAVE_BTRFS_H
 #define TARGET_BTRFS_IOC_SNAP_CREATE            TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1)
 #define TARGET_BTRFS_IOC_SCAN_DEV               TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4)
 #define TARGET_BTRFS_IOC_FORGET_DEV             TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5)
diff --git a/meson.build b/meson.build
index ab9571a354..bf62e260ed 100644
--- a/meson.build
+++ b/meson.build
@@ -808,6 +808,7 @@ config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]
 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
 config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
 
+config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h'))
 config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h'))
 config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h'))
 config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h'))
-- 
2.18.4


Re: [PATCH 6/6] configure / meson: Move check for linux/btrfs.h to meson.build
Posted by Philippe Mathieu-Daudé 5 years, 2 months ago
On 11/18/20 6:10 PM, Thomas Huth wrote:
> This check can be done in a much shorter way in meson.build. And while
> we're at it, rename the #define to HAVE_BTRFS_H to match the other
> HAVE_someheader_H symbols that we already have.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  configure                 | 9 ---------
>  linux-user/syscall.c      | 2 +-
>  linux-user/syscall_defs.h | 2 +-
>  meson.build               | 1 +
>  4 files changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/configure b/configure
> index 8d40a0beb3..1ba4bf9a3d 100755
> --- a/configure
> +++ b/configure
> @@ -4389,12 +4389,6 @@ if compile_prog "" "" ; then
>    syncfs=yes
>  fi
>  
> -# check for btrfs filesystem support (kernel must be 3.9+)

Assuming it is now OK to drop this comment:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> -btrfs=no
> -if check_include linux/btrfs.h ; then
> -    btrfs=yes
> -fi
> -
>  # Search for bswap_32 function
>  byteswap_h=no
>  cat > $TMPC << EOF
> @@ -6086,9 +6080,6 @@ fi
>  if test "$syncfs" = "yes" ; then
>    echo "CONFIG_SYNCFS=y" >> $config_host_mak
>  fi
> -if test "$btrfs" = "yes" ; then
> -  echo "CONFIG_BTRFS=y" >> $config_host_mak
> -fi
>  if test "$inotify" = "yes" ; then
>    echo "CONFIG_INOTIFY=y" >> $config_host_mak
>  fi
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 063130be04..7bf99beb18 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -112,7 +112,7 @@
>  #include <linux/if_alg.h>
>  #include <linux/rtc.h>
>  #include <sound/asound.h>
> -#ifdef CONFIG_BTRFS
> +#ifdef HAVE_BTRFS_H
>  #include <linux/btrfs.h>
>  #endif
>  #ifdef HAVE_DRM_H
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index cabbfb762d..b934d0b606 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -1006,7 +1006,7 @@ struct target_rtc_pll_info {
>  #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
>  
>  /* btrfs ioctls */
> -#ifdef CONFIG_BTRFS
> +#ifdef HAVE_BTRFS_H
>  #define TARGET_BTRFS_IOC_SNAP_CREATE            TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1)
>  #define TARGET_BTRFS_IOC_SCAN_DEV               TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4)
>  #define TARGET_BTRFS_IOC_FORGET_DEV             TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5)
> diff --git a/meson.build b/meson.build
> index ab9571a354..bf62e260ed 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -808,6 +808,7 @@ config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]
>  config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
>  config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
>  
> +config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h'))
>  config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h'))
>  config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h'))
>  config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h'))
> 


Re: [PATCH 6/6] configure / meson: Move check for linux/btrfs.h to meson.build
Posted by Richard Henderson 5 years, 2 months ago
On 11/18/20 9:10 AM, Thomas Huth wrote:
> This check can be done in a much shorter way in meson.build. And while
> we're at it, rename the #define to HAVE_BTRFS_H to match the other
> HAVE_someheader_H symbols that we already have.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  configure                 | 9 ---------
>  linux-user/syscall.c      | 2 +-
>  linux-user/syscall_defs.h | 2 +-
>  meson.build               | 1 +
>  4 files changed, 3 insertions(+), 11 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~

Re: [PATCH 6/6] configure / meson: Move check for linux/btrfs.h to meson.build
Posted by Laurent Vivier 5 years, 1 month ago
Le 18/11/2020 à 18:10, Thomas Huth a écrit :
> This check can be done in a much shorter way in meson.build. And while
> we're at it, rename the #define to HAVE_BTRFS_H to match the other
> HAVE_someheader_H symbols that we already have.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  configure                 | 9 ---------
>  linux-user/syscall.c      | 2 +-
>  linux-user/syscall_defs.h | 2 +-
>  meson.build               | 1 +
>  4 files changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/configure b/configure
> index 8d40a0beb3..1ba4bf9a3d 100755
> --- a/configure
> +++ b/configure
> @@ -4389,12 +4389,6 @@ if compile_prog "" "" ; then
>    syncfs=yes
>  fi
>  
> -# check for btrfs filesystem support (kernel must be 3.9+)
> -btrfs=no
> -if check_include linux/btrfs.h ; then
> -    btrfs=yes
> -fi
> -
>  # Search for bswap_32 function
>  byteswap_h=no
>  cat > $TMPC << EOF
> @@ -6086,9 +6080,6 @@ fi
>  if test "$syncfs" = "yes" ; then
>    echo "CONFIG_SYNCFS=y" >> $config_host_mak
>  fi
> -if test "$btrfs" = "yes" ; then
> -  echo "CONFIG_BTRFS=y" >> $config_host_mak
> -fi
>  if test "$inotify" = "yes" ; then
>    echo "CONFIG_INOTIFY=y" >> $config_host_mak
>  fi
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 063130be04..7bf99beb18 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -112,7 +112,7 @@
>  #include <linux/if_alg.h>
>  #include <linux/rtc.h>
>  #include <sound/asound.h>
> -#ifdef CONFIG_BTRFS
> +#ifdef HAVE_BTRFS_H
>  #include <linux/btrfs.h>
>  #endif
>  #ifdef HAVE_DRM_H
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index cabbfb762d..b934d0b606 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -1006,7 +1006,7 @@ struct target_rtc_pll_info {
>  #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
>  
>  /* btrfs ioctls */
> -#ifdef CONFIG_BTRFS
> +#ifdef HAVE_BTRFS_H
>  #define TARGET_BTRFS_IOC_SNAP_CREATE            TARGET_IOWU(BTRFS_IOCTL_MAGIC, 1)
>  #define TARGET_BTRFS_IOC_SCAN_DEV               TARGET_IOWU(BTRFS_IOCTL_MAGIC, 4)
>  #define TARGET_BTRFS_IOC_FORGET_DEV             TARGET_IOWU(BTRFS_IOCTL_MAGIC, 5)
> diff --git a/meson.build b/meson.build
> index ab9571a354..bf62e260ed 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -808,6 +808,7 @@ config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0]
>  config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
>  config_host_data.set('QEMU_VERSION_MICRO', meson.project_version().split('.')[2])
>  
> +config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h'))
>  config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h'))
>  config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h'))
>  config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h'))
> 

Applied to my trivial-patches branch.

Thanks,
Laurent