diff mbox series

[RFC,02/19] fuzz: add FUZZ_TARGET type to qemu module system

Message ID 20190725032321.12721-3-alxndr@bu.edu (mailing list archive)
State New, archived
Headers show
Series Add virtual device fuzzing support | expand

Commit Message

Alexander Bulekov July 25, 2019, 3:23 a.m. UTC
Signed-off-by: Alexander Oleinik <alxndr@bu.edu>
---
 include/qemu/module.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Stefan Hajnoczi July 26, 2019, 12:32 p.m. UTC | #1
On Thu, Jul 25, 2019 at 03:23:45AM +0000, Oleinik, Alexander wrote:
> Signed-off-by: Alexander Oleinik <alxndr@bu.edu>
> ---
>  include/qemu/module.h | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

I wouldn't worry about #ifdefs since none of this generates code.  The
only bloat will be the debuginfo, but I think avoiding ifdef is worth it
(to prevent bitrot and to make the code easier to understand).

Anyway:

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
diff mbox series

Patch

diff --git a/include/qemu/module.h b/include/qemu/module.h
index db3065381d..531fe7ae29 100644
--- a/include/qemu/module.h
+++ b/include/qemu/module.h
@@ -46,6 +46,9 @@  typedef enum {
     MODULE_INIT_TRACE,
     MODULE_INIT_XEN_BACKEND,
     MODULE_INIT_LIBQOS,
+#ifdef CONFIG_FUZZ
+    MODULE_INIT_FUZZ_TARGET,
+#endif
     MODULE_INIT_MAX
 } module_init_type;
 
@@ -56,7 +59,9 @@  typedef enum {
 #define xen_backend_init(function) module_init(function, \
                                                MODULE_INIT_XEN_BACKEND)
 #define libqos_init(function) module_init(function, MODULE_INIT_LIBQOS)
-
+#ifdef CONFIG_FUZZ
+#define fuzz_target_init(function) module_init(function, MODULE_INIT_FUZZ_TARGET)
+#endif
 #define block_module_load_one(lib) module_load_one("block-", lib)
 #define ui_module_load_one(lib) module_load_one("ui-", lib)
 #define audio_module_load_one(lib) module_load_one("audio-", lib)