[PULL 50/55] virtfs: convert to meson

Paolo Bonzini posted 55 patches 4 years, 11 months ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Riku Voipio <riku.voipio@iki.fi>, Eduardo Habkost <ehabkost@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Raphael Norwitz <raphael.norwitz@nutanix.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Markus Armbruster <armbru@redhat.com>, Juan Quintela <quintela@redhat.com>, Kevin Wolf <kwolf@redhat.com>, Eduardo Otubo <otubo@redhat.com>, Max Reitz <mreitz@redhat.com>
There is a newer version of this series
[PULL 50/55] virtfs: convert to meson
Posted by Paolo Bonzini 4 years, 11 months ago
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 29 ++++-------------------------
 meson.build       | 24 ++++++++++++++++++++++--
 meson_options.txt | 11 +++++++----
 3 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index ba8c6e74be..46ee3da40e 100755
--- a/configure
+++ b/configure
@@ -315,7 +315,7 @@ netmap="no"
 sdl="auto"
 sdl_image="auto"
 virtiofsd="auto"
-virtfs="$default_feature"
+virtfs="auto"
 libudev="auto"
 mpath="auto"
 vnc="enabled"
@@ -1004,9 +1004,9 @@ for opt do
   ;;
   --enable-qom-cast-debug) qom_cast_debug="yes"
   ;;
-  --disable-virtfs) virtfs="no"
+  --disable-virtfs) virtfs="disabled"
   ;;
-  --enable-virtfs) virtfs="yes"
+  --enable-virtfs) virtfs="enabled"
   ;;
   --disable-libudev) libudev="disabled"
   ;;
@@ -5443,24 +5443,6 @@ if [ "$eventfd" = "yes" ]; then
   ivshmem=yes
 fi
 
-if test "$softmmu" = yes ; then
-  if test "$linux" = yes; then
-    if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then
-      virtfs=yes
-    else
-      if test "$virtfs" = yes; then
-        error_exit "VirtFS requires libcap-ng devel and libattr devel"
-      fi
-      virtfs=no
-    fi
-  else
-    if test "$virtfs" = yes; then
-      error_exit "VirtFS is supported only on Linux"
-    fi
-    virtfs=no
-  fi
-fi
-
 # Probe for guest agent support/options
 
 if [ "$guest_agent" != "no" ]; then
@@ -5917,9 +5899,6 @@ fi
 if test "$libattr" = "yes" ; then
   echo "CONFIG_LIBATTR=y" >> $config_host_mak
 fi
-if test "$virtfs" = "yes" ; then
-  echo "CONFIG_VIRTFS=y" >> $config_host_mak
-fi
 if test "$vhost_scsi" = "yes" ; then
   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
 fi
@@ -6580,7 +6559,7 @@ NINJA=$ninja $meson setup \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
-        -Dzstd=$zstd -Dseccomp=$seccomp \
+        -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index 99c4d0dd1a..22413b4f16 100644
--- a/meson.build
+++ b/meson.build
@@ -963,6 +963,25 @@ endif
 # config-host.h #
 #################
 
+have_virtfs = (targetos == 'linux' and
+    have_system and
+    libattr.found() and
+    libcap_ng.found())
+
+if get_option('virtfs').enabled()
+  if not have_virtfs
+    if targetos != 'linux'
+      error('virtio-9p (virtfs) requires Linux')
+    elif not libcap_ng.found() or not libattr.found()
+      error('virtio-9p (virtfs) requires libcap-ng-devel and libattr-devel')
+    elif not have_system
+      error('virtio-9p (virtfs) needs system emulation support')
+    endif
+  endif
+elif get_option('virtfs').disabled()
+  have_virtfs = false
+endif
+
 config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') / get_option('bindir'))
 config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix'))
 config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / qemu_confdir)
@@ -1007,6 +1026,7 @@ config_host_data.set('CONFIG_VNC', vnc.found())
 config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
 config_host_data.set('CONFIG_VNC_PNG', png.found())
 config_host_data.set('CONFIG_VNC_SASL', sasl.found())
+config_host_data.set('CONFIG_VIRTFS', have_virtfs)
 config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
 config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
 config_host_data.set('CONFIG_GETTID', has_gettid)
@@ -1105,7 +1125,7 @@ host_kconfig = \
   ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \
   ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \
   ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \
-  ('CONFIG_VIRTFS' in config_host ? ['CONFIG_VIRTFS=y'] : []) + \
+  (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
   ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
   ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : [])
 
@@ -2294,7 +2314,7 @@ summary_info += {'mingw32 support':   targetos == 'windows'}
 summary_info += {'Audio drivers':     config_host['CONFIG_AUDIO_DRIVERS']}
 summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
 summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
-summary_info += {'VirtFS support':    config_host.has_key('CONFIG_VIRTFS')}
+summary_info += {'VirtFS support':    have_virtfs}
 summary_info += {'build virtiofs daemon': have_virtiofsd}
 summary_info += {'Multipath support': mpathpersist.found()}
 summary_info += {'VNC support':       vnc.found()}
diff --git a/meson_options.txt b/meson_options.txt
index 1854a9639f..59a8a50e5b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -90,10 +90,6 @@ option('vnc_sasl', type : 'feature', value : 'auto',
        description: 'SASL authentication for VNC server')
 option('xkbcommon', type : 'feature', value : 'auto',
        description: 'xkbcommon support')
-option('virtiofsd', type: 'feature', value: 'auto',
-       description: 'build virtiofs daemon (virtiofsd)')
-option('vhost_user_blk_server', type: 'feature', value: 'auto',
-       description: 'build vhost-user-blk server')
 option('zstd', type : 'feature', value : 'auto',
        description: 'zstd compression support')
 option('fuse', type: 'feature', value: 'auto',
@@ -101,6 +97,13 @@ option('fuse', type: 'feature', value: 'auto',
 option('fuse_lseek', type : 'feature', value : 'auto',
        description: 'SEEK_HOLE/SEEK_DATA support for FUSE exports')
 
+option('vhost_user_blk_server', type: 'feature', value: 'auto',
+       description: 'build vhost-user-blk server')
+option('virtfs', type: 'feature', value: 'auto',
+       description: 'virtio-9p support')
+option('virtiofsd', type: 'feature', value: 'auto',
+       description: 'build virtiofs daemon (virtiofsd)')
+
 option('capstone', type: 'combo', value: 'auto',
        choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
        description: 'Whether and how to find the capstone library')
-- 
2.29.2



Re: [PULL 50/55] virtfs: convert to meson
Posted by Bruce Rogers 4 years, 10 months ago
On Mon, 2020-12-21 at 15:44 +0100, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure         | 29 ++++-------------------------
>  meson.build       | 24 ++++++++++++++++++++++--
>  meson_options.txt | 11 +++++++----
>  3 files changed, 33 insertions(+), 31 deletions(-)
> 
> diff --git a/configure b/configure
> index ba8c6e74be..46ee3da40e 100755
> --- a/configure
> +++ b/configure
> @@ -315,7 +315,7 @@ netmap="no"
>  sdl="auto"
>  sdl_image="auto"
>  virtiofsd="auto"
> -virtfs="$default_feature"
> +virtfs="auto"
>  libudev="auto"
>  mpath="auto"
>  vnc="enabled"
> @@ -1004,9 +1004,9 @@ for opt do
>    ;;
>    --enable-qom-cast-debug) qom_cast_debug="yes"
>    ;;
> -  --disable-virtfs) virtfs="no"
> +  --disable-virtfs) virtfs="disabled"
>    ;;
> -  --enable-virtfs) virtfs="yes"
> +  --enable-virtfs) virtfs="enabled"
>    ;;
>    --disable-libudev) libudev="disabled"
>    ;;
> @@ -5443,24 +5443,6 @@ if [ "$eventfd" = "yes" ]; then
>    ivshmem=yes
>  fi
>  
> -if test "$softmmu" = yes ; then
> -  if test "$linux" = yes; then
> -    if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr"
> = yes ; then
> -      virtfs=yes
> -    else
> -      if test "$virtfs" = yes; then
> -        error_exit "VirtFS requires libcap-ng devel and libattr
> devel"
> -      fi
> -      virtfs=no
> -    fi
> -  else
> -    if test "$virtfs" = yes; then
> -      error_exit "VirtFS is supported only on Linux"
> -    fi
> -    virtfs=no
> -  fi
> -fi
> -
>  # Probe for guest agent support/options
>  
>  if [ "$guest_agent" != "no" ]; then
> @@ -5917,9 +5899,6 @@ fi
>  if test "$libattr" = "yes" ; then
>    echo "CONFIG_LIBATTR=y" >> $config_host_mak
>  fi
> -if test "$virtfs" = "yes" ; then
> -  echo "CONFIG_VIRTFS=y" >> $config_host_mak
> -fi
>  if test "$vhost_scsi" = "yes" ; then
>    echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
>  fi
> @@ -6580,7 +6559,7 @@ NINJA=$ninja $meson setup \
>          -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -
> Dlibiscsi=$libiscsi \
>          -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -
> Dlibudev=$libudev\
>          -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -
> Dlzfse=$lzfse \
> -        -Dzstd=$zstd -Dseccomp=$seccomp \
> +        -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs \
>          -Ddocs=$docs -Dsphinx_build=$sphinx_build -
> Dinstall_blobs=$blobs \
>          -Dvhost_user_blk_server=$vhost_user_blk_server \
>          -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
> diff --git a/meson.build b/meson.build
> index 99c4d0dd1a..22413b4f16 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -963,6 +963,25 @@ endif
>  # config-host.h #
>  #################
>  
> +have_virtfs = (targetos == 'linux' and
> +    have_system and
> +    libattr.found() and
> +    libcap_ng.found())
> +
> +if get_option('virtfs').enabled()
> +  if not have_virtfs
> +    if targetos != 'linux'
> +      error('virtio-9p (virtfs) requires Linux')
> +    elif not libcap_ng.found() or not libattr.found()
> +      error('virtio-9p (virtfs) requires libcap-ng-devel and
> libattr-devel')
> +    elif not have_system
> +      error('virtio-9p (virtfs) needs system emulation support')
> +    endif
> +  endif
> +elif get_option('virtfs').disabled()
> +  have_virtfs = false
> +endif
> +
>  config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') /
> get_option('bindir'))
>  config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix'))
>  config_host_data.set_quoted('CONFIG_QEMU_CONFDIR',
> get_option('prefix') / qemu_confdir)
> @@ -1007,6 +1026,7 @@ config_host_data.set('CONFIG_VNC', vnc.found())
>  config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
>  config_host_data.set('CONFIG_VNC_PNG', png.found())
>  config_host_data.set('CONFIG_VNC_SASL', sasl.found())
> +config_host_data.set('CONFIG_VIRTFS', have_virtfs)
>  config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
>  config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
>  config_host_data.set('CONFIG_GETTID', has_gettid)
> @@ -1105,7 +1125,7 @@ host_kconfig = \
>    ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] :
> []) + \
>    ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] :
> []) + \
>    ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y']
> : []) + \
> -  ('CONFIG_VIRTFS' in config_host ? ['CONFIG_VIRTFS=y'] : []) + \
> +  (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
>    ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
>    ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : [])
>  
> @@ -2294,7 +2314,7 @@ summary_info += {'mingw32 support':   targetos
> == 'windows'}
>  summary_info += {'Audio drivers':    
> config_host['CONFIG_AUDIO_DRIVERS']}
>  summary_info += {'Block whitelist (rw)':
> config_host['CONFIG_BDRV_RW_WHITELIST']}
>  summary_info += {'Block whitelist (ro)':
> config_host['CONFIG_BDRV_RO_WHITELIST']}
> -summary_info += {'VirtFS support':   
> config_host.has_key('CONFIG_VIRTFS')}
> +summary_info += {'VirtFS support':    have_virtfs}
>  summary_info += {'build virtiofs daemon': have_virtiofsd}
>  summary_info += {'Multipath support': mpathpersist.found()}
>  summary_info += {'VNC support':       vnc.found()}
> diff --git a/meson_options.txt b/meson_options.txt
> index 1854a9639f..59a8a50e5b 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -90,10 +90,6 @@ option('vnc_sasl', type : 'feature', value :
> 'auto',
>         description: 'SASL authentication for VNC server')
>  option('xkbcommon', type : 'feature', value : 'auto',
>         description: 'xkbcommon support')
> -option('virtiofsd', type: 'feature', value: 'auto',
> -       description: 'build virtiofs daemon (virtiofsd)')
> -option('vhost_user_blk_server', type: 'feature', value: 'auto',
> -       description: 'build vhost-user-blk server')
>  option('zstd', type : 'feature', value : 'auto',
>         description: 'zstd compression support')
>  option('fuse', type: 'feature', value: 'auto',
> @@ -101,6 +97,13 @@ option('fuse', type: 'feature', value: 'auto',
>  option('fuse_lseek', type : 'feature', value : 'auto',
>         description: 'SEEK_HOLE/SEEK_DATA support for FUSE exports')
>  
> +option('vhost_user_blk_server', type: 'feature', value: 'auto',
> +       description: 'build vhost-user-blk server')
> +option('virtfs', type: 'feature', value: 'auto',
> +       description: 'virtio-9p support')
> +option('virtiofsd', type: 'feature', value: 'auto',
> +       description: 'build virtiofs daemon (virtiofsd)')
> +
>  option('capstone', type: 'combo', value: 'auto',
>         choices: ['disabled', 'enabled', 'auto', 'system',
> 'internal'],
>         description: 'Whether and how to find the capstone library')

I noticed that for me, this broke the building of virtfs-proxy-helper.
I've not yet figured out what the fix should be, but thought you'd want
to know.

-Bruce


Re: [PULL 50/55] virtfs: convert to meson
Posted by Paolo Bonzini 4 years, 10 months ago
On 07/01/21 14:58, Bruce Rogers wrote:
> I noticed that for me, this broke the building of virtfs-proxy-helper.
> I've not yet figured out what the fix should be, but thought you'd want
> to know.

Possibly:

diff --git a/fsdev/meson.build b/fsdev/meson.build
index 7dd1cc9bfb..65455a179e 100644
--- a/fsdev/meson.build
+++ b/fsdev/meson.build
@@ -8,7 +8,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files(
  ), if_false: files('qemu-fsdev-dummy.c'))
  softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss)

-have_virtfs_proxy_helper = have_tools and libattr.found() and 
libcap_ng.found() and 'CONFIG_VIRTFS' in config_host
+have_virtfs_proxy_helper = have_tools and libattr.found() and 
libcap_ng.found() and have_virtfs
  if have_virtfs_proxy_helper
    executable('virtfs-proxy-helper',
               files('virtfs-proxy-helper.c', '9p-marshal.c', 
'9p-iov-marshal.c'),
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 450af3e51c..b8e19bbc81 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -199,7 +199,9 @@ qos_test_ss.add(
    'virtio-serial-test.c',
    'vmxnet3-test.c',
  )
-qos_test_ss.add(when: 'CONFIG_VIRTFS', if_true: files('virtio-9p-test.c'))
+if have_virtfs
+  qos_test_ss.add(files('virtio-9p-test.c'))
+endif
  qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: 
files('vhost-user-test.c'))

  tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']

Since CONFIG_VIRTFS does not exist anymore.  Sorry.

Paolo


Re: [PULL 50/55] virtfs: convert to meson
Posted by Bruce Rogers 4 years, 10 months ago
On Thu, 2021-01-07 at 15:49 +0100, Paolo Bonzini wrote:
> On 07/01/21 14:58, Bruce Rogers wrote:
> > I noticed that for me, this broke the building of virtfs-proxy-
> > helper.
> > I've not yet figured out what the fix should be, but thought you'd
> > want
> > to know.
> 
> Possibly:
> 
> diff --git a/fsdev/meson.build b/fsdev/meson.build
> index 7dd1cc9bfb..65455a179e 100644
> --- a/fsdev/meson.build
> +++ b/fsdev/meson.build
> @@ -8,7 +8,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true:
> files(
>   ), if_false: files('qemu-fsdev-dummy.c'))
>   softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss)
> 
> -have_virtfs_proxy_helper = have_tools and libattr.found() and 
> libcap_ng.found() and 'CONFIG_VIRTFS' in config_host
> +have_virtfs_proxy_helper = have_tools and libattr.found() and 
> libcap_ng.found() and have_virtfs
>   if have_virtfs_proxy_helper
>     executable('virtfs-proxy-helper',
>                files('virtfs-proxy-helper.c', '9p-marshal.c', 
> '9p-iov-marshal.c'),
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index 450af3e51c..b8e19bbc81 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -199,7 +199,9 @@ qos_test_ss.add(
>     'virtio-serial-test.c',
>     'vmxnet3-test.c',
>   )
> -qos_test_ss.add(when: 'CONFIG_VIRTFS', if_true: files('virtio-9p-
> test.c'))
> +if have_virtfs
> +  qos_test_ss.add(files('virtio-9p-test.c'))
> +endif
>   qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: 
> files('vhost-user-test.c'))
> 
>   tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']
> 
> Since CONFIG_VIRTFS does not exist anymore.  Sorry.
> 
> Paolo
> 

Looks like that solves the issue. Thanks.
- Bruce