diff mbox series

[v4,1/1] qapi: Restrict code generated for user-mode

Message ID 20201002073621.1653924-2-philmd@redhat.com
State New
Headers show
Series user-mode: Prune build dependencies (part 3) | expand

Commit Message

Philippe Mathieu-Daudé Oct. 2, 2020, 7:36 a.m. UTC
A lot of QAPI generated code is never used by user-mode.

Split out qapi_system_modules and qapi_system_or_tools_modules
from the qapi_all_modules array. We now have 4 groups:
- always used
- only used by system-mode
- not used by user-mode
- not used by tools

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 qapi/meson.build | 51 ++++++++++++++++++++++++++++++++++--------------
 1 file changed, 36 insertions(+), 15 deletions(-)

Comments

Paolo Bonzini Oct. 2, 2020, 8:50 a.m. UTC | #1
On 02/10/20 09:36, Philippe Mathieu-Daudé wrote:
> A lot of QAPI generated code is never used by user-mode.

> 

> Split out qapi_system_modules and qapi_system_or_tools_modules

> from the qapi_all_modules array. We now have 4 groups:

> - always used

> - only used by system-mode

> - not used by user-mode

> - not used by tools

> 

> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---

>  qapi/meson.build | 51 ++++++++++++++++++++++++++++++++++--------------

>  1 file changed, 36 insertions(+), 15 deletions(-)

> 

> diff --git a/qapi/meson.build b/qapi/meson.build

> index 7c4a89a882..10cf01ef65 100644

> --- a/qapi/meson.build

> +++ b/qapi/meson.build

> @@ -14,39 +14,60 @@ util_ss.add(files(

>  ))

>  

>  qapi_all_modules = [

> +  'common',

> +  'introspect',

> +  'misc',

> +]

> +

> +qapi_system_modules = [

>    'acpi',

>    'audio',

> +  'dump',

> +  'machine-target',

> +  'migration',

> +  'misc-target',

> +  'net',

> +  'pci',

> +  'rdma',

> +  'rocker',

> +  'tpm',

> +  'trace',

> +]

> +

> +qapi_system_or_user_modules = [

> +  'machine', # X86CPUFeatureWordInfo

> +  'qdev',

> +]

> +

> +qapi_system_or_tools_modules = [

>    'authz',

>    'block-core',

>    'block',

>    'char',

> -  'common',

>    'control',

>    'crypto',

> -  'dump',

>    'error',

> -  'introspect',

>    'job',

> -  'machine',

> -  'machine-target',

> -  'migration',

> -  'misc',

> -  'misc-target',

> -  'net',

>    'pragma',

> -  'qdev',

> -  'pci',

>    'qom',

> -  'rdma',

> -  'rocker',

>    'run-state',

>    'sockets',

> -  'tpm',

> -  'trace',

>    'transaction',

>    'ui',

>  ]

>  

> +if have_system

> +  qapi_all_modules += qapi_system_modules

> +endif

> +

> +if have_system or have_user

> +  qapi_all_modules += qapi_system_or_user_modules

> +endif

> +

> +if have_system or have_tools

> +  qapi_all_modules += qapi_system_or_tools_modules

> +endif

> +

>  qapi_storage_daemon_modules = [

>    'block-core',

>    'char',

> 


Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Philippe Mathieu-Daudé Oct. 2, 2020, 9:16 a.m. UTC | #2
On 10/2/20 9:36 AM, Philippe Mathieu-Daudé wrote:
> A lot of QAPI generated code is never used by user-mode.

> 

> Split out qapi_system_modules and qapi_system_or_tools_modules

> from the qapi_all_modules array. We now have 4 groups:

> - always used

> - only used by system-mode

> - not used by user-mode

> - not used by tools

> 

> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---

>  qapi/meson.build | 51 ++++++++++++++++++++++++++++++++++--------------

>  1 file changed, 36 insertions(+), 15 deletions(-)

> 

> diff --git a/qapi/meson.build b/qapi/meson.build

> index 7c4a89a882..10cf01ef65 100644

> --- a/qapi/meson.build

> +++ b/qapi/meson.build

> @@ -14,39 +14,60 @@ util_ss.add(files(

>  ))

>  

>  qapi_all_modules = [

> +  'common',

> +  'introspect',

> +  'misc',

> +]

> +

> +qapi_system_modules = [

>    'acpi',

>    'audio',

> +  'dump',

> +  'machine-target',

> +  'migration',

> +  'misc-target',

> +  'net',

> +  'pci',

> +  'rdma',

> +  'rocker',

> +  'tpm',

> +  'trace',

> +]

> +

> +qapi_system_or_user_modules = [

> +  'machine', # X86CPUFeatureWordInfo

> +  'qdev',


I forgot the justification for this one:

     'qdev', # DEVICE_DELETED

> +]

> +

> +qapi_system_or_tools_modules = [

>    'authz',

>    'block-core',

>    'block',

>    'char',

> -  'common',

>    'control',

>    'crypto',

> -  'dump',

>    'error',

> -  'introspect',

>    'job',

> -  'machine',

> -  'machine-target',

> -  'migration',

> -  'misc',

> -  'misc-target',

> -  'net',

>    'pragma',

> -  'qdev',

> -  'pci',

>    'qom',

> -  'rdma',

> -  'rocker',

>    'run-state',

>    'sockets',

> -  'tpm',

> -  'trace',

>    'transaction',

>    'ui',

>  ]

>  

> +if have_system

> +  qapi_all_modules += qapi_system_modules

> +endif

> +

> +if have_system or have_user

> +  qapi_all_modules += qapi_system_or_user_modules

> +endif

> +

> +if have_system or have_tools

> +  qapi_all_modules += qapi_system_or_tools_modules

> +endif

> +

>  qapi_storage_daemon_modules = [

>    'block-core',

>    'char',

>
diff mbox series

Patch

diff --git a/qapi/meson.build b/qapi/meson.build
index 7c4a89a882..10cf01ef65 100644
--- a/qapi/meson.build
+++ b/qapi/meson.build
@@ -14,39 +14,60 @@  util_ss.add(files(
 ))
 
 qapi_all_modules = [
+  'common',
+  'introspect',
+  'misc',
+]
+
+qapi_system_modules = [
   'acpi',
   'audio',
+  'dump',
+  'machine-target',
+  'migration',
+  'misc-target',
+  'net',
+  'pci',
+  'rdma',
+  'rocker',
+  'tpm',
+  'trace',
+]
+
+qapi_system_or_user_modules = [
+  'machine', # X86CPUFeatureWordInfo
+  'qdev',
+]
+
+qapi_system_or_tools_modules = [
   'authz',
   'block-core',
   'block',
   'char',
-  'common',
   'control',
   'crypto',
-  'dump',
   'error',
-  'introspect',
   'job',
-  'machine',
-  'machine-target',
-  'migration',
-  'misc',
-  'misc-target',
-  'net',
   'pragma',
-  'qdev',
-  'pci',
   'qom',
-  'rdma',
-  'rocker',
   'run-state',
   'sockets',
-  'tpm',
-  'trace',
   'transaction',
   'ui',
 ]
 
+if have_system
+  qapi_all_modules += qapi_system_modules
+endif
+
+if have_system or have_user
+  qapi_all_modules += qapi_system_or_user_modules
+endif
+
+if have_system or have_tools
+  qapi_all_modules += qapi_system_or_tools_modules
+endif
+
 qapi_storage_daemon_modules = [
   'block-core',
   'char',