summary refs log tree commit diff stats
path: root/contrib/plugins/focaccia.c
blob: c638647d95cbb2711d224c123fd7dc320c9f85da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <qemu-plugin.h>

static void plugin_init(void) {
}

static void plugin_exit(qemu_plugin_id_t id, void* p) {
    printf("Plugin has completed!\n");
}

// argc and argv correspond to the arguments passed via -plugin focaccia.so,arg1=<arg1>,arg2=<arg2>
QEMU_PLUGIN_EXPORT 
int qemu_plugin_install(qemu_plugin_id_t id,
                        const qemu_info_t *info,
                        int argc, char **argv)
{
    int i;

    // Process plugin arguments
    printf("Received plugin options:\n");
    for (i = 0; i < argc; i++) {
        printf("%s\n", argv[i]);
    }

    plugin_init();

    qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);
    return 0;
}