[PATCH v2 05/12] meson: Restrict block subsystem processing

Philippe Mathieu-Daudé posted 12 patches 5 years ago
[PATCH v2 05/12] meson: Restrict block subsystem processing
Posted by Philippe Mathieu-Daudé 5 years ago
Avoid generating module_block.h and block-gen.c if we are
not going to use them.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
Cc: qemu-block@nongnu.org
---
 meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 61cbb89cd44..181f8795f5a 100644
--- a/meson.build
+++ b/meson.build
@@ -1829,7 +1829,9 @@
 
 subdir('nbd')
 subdir('scsi')
-subdir('block')
+if have_block
+  subdir('block')
+endif
 
 blockdev_ss.add(files(
   'blockdev.c',
-- 
2.26.2

Re: [PATCH v2 05/12] meson: Restrict block subsystem processing
Posted by Kevin Wolf 5 years ago
Am 22.01.2021 um 21:44 hat Philippe Mathieu-Daudé geschrieben:
> Avoid generating module_block.h and block-gen.c if we are
> not going to use them.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Cc: qemu-block@nongnu.org
> ---
>  meson.build | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 61cbb89cd44..181f8795f5a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1829,7 +1829,9 @@
>  
>  subdir('nbd')
>  subdir('scsi')
> -subdir('block')
> +if have_block
> +  subdir('block')
> +endif
>  
>  blockdev_ss.add(files(
>    'blockdev.c',

It feels odd to have a random have_block check in the middle of a whole
bunch of lines that all deal with block layer functionality, especially
when unconditional ones depend on the conditional one. (nbd, scsi and
blockdev.c present in the context here certainly all can't work without
block)

So should this if block become a bit longer and include all block layer
related things nearby?

If not, at least a comment explaining why we're doing this would be
nice.

Kevin


Re: [PATCH v2 05/12] meson: Restrict block subsystem processing
Posted by Paolo Bonzini 5 years ago
Another possibility is to place the if in block/meson.build, using
subdir_done() to stop the processing of the directory.

Paolo

Il lun 25 gen 2021, 13:15 Kevin Wolf <kwolf@redhat.com> ha scritto:

> Am 22.01.2021 um 21:44 hat Philippe Mathieu-Daudé geschrieben:
> > Avoid generating module_block.h and block-gen.c if we are
> > not going to use them.
> >
> > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> > ---
> > Cc: qemu-block@nongnu.org
> > ---
> >  meson.build | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/meson.build b/meson.build
> > index 61cbb89cd44..181f8795f5a 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -1829,7 +1829,9 @@
> >
> >  subdir('nbd')
> >  subdir('scsi')
> > -subdir('block')
> > +if have_block
> > +  subdir('block')
> > +endif
> >
> >  blockdev_ss.add(files(
> >    'blockdev.c',
>
> It feels odd to have a random have_block check in the middle of a whole
> bunch of lines that all deal with block layer functionality, especially
> when unconditional ones depend on the conditional one. (nbd, scsi and
> blockdev.c present in the context here certainly all can't work without
> block)
>
> So should this if block become a bit longer and include all block layer
> related things nearby?
>
> If not, at least a comment explaining why we're doing this would be
> nice.
>
> Kevin
>
>