Revision e26110cf include/qemu/module.h

b/include/qemu/module.h
14 14
#ifndef QEMU_MODULE_H
15 15
#define QEMU_MODULE_H
16 16

  
17
#include "qemu/osdep.h"
18

  
19
#define DSO_STAMP_FUN         glue(qemu_stamp, CONFIG_STAMP)
20
#define DSO_STAMP_FUN_STR     stringify(DSO_STAMP_FUN)
21

  
22
#ifdef BUILD_DSO
23
void DSO_STAMP_FUN(void);
24
/* This is a dummy symbol to identify a loaded DSO as a QEMU module, so we can
25
 * distinguish "version mismatch" from "not a QEMU module", when the stamp
26
 * check fails during module loading */
27
void qemu_module_dummy(void);
28

  
29
#define module_init(function, type)                                         \
30
static void __attribute__((constructor)) do_qemu_init_ ## function(void)    \
31
{                                                                           \
32
    register_dso_module_init(function, type);                               \
33
}
34
#else
17 35
/* This should not be used directly.  Use block_init etc. instead.  */
18 36
#define module_init(function, type)                                         \
19
static void __attribute__((constructor)) do_qemu_init_ ## function(void) {  \
37
static void __attribute__((constructor)) do_qemu_init_ ## function(void)    \
38
{                                                                           \
20 39
    register_module_init(function, type);                                   \
21 40
}
41
#endif
22 42

  
23 43
typedef enum {
24 44
    MODULE_INIT_BLOCK,
......
34 54
#define type_init(function) module_init(function, MODULE_INIT_QOM)
35 55

  
36 56
void register_module_init(void (*fn)(void), module_init_type type);
57
void register_dso_module_init(void (*fn)(void), module_init_type type);
37 58

  
38 59
void module_call_init(module_init_type type);
39 60

  

Also available in: Unified diff