plugin: expand the plugin_init function to include an info block

This provides a limited amount of info to plugins about the guest
system that will allow them to make some additional decisions on
setup.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
Alex Bennée 2019-09-12 17:24:27 +01:00
parent 26fffe29c0
commit 5901b2e15b
2 changed files with 43 additions and 6 deletions

View file

@ -38,9 +38,27 @@
typedef uint64_t qemu_plugin_id_t;
typedef struct {
/* string describing architecture */
const char *target_name;
/* is this a full system emulation? */
bool system_emulation;
union {
/*
* smp_vcpus may change if vCPUs can be hot-plugged, max_vcpus
* is the system-wide limit.
*/
struct {
int smp_vcpus;
int max_vcpus;
} system;
};
} qemu_info_t;
/**
* qemu_plugin_install() - Install a plugin
* @id: this plugin's opaque ID
* @info: a block describing some details about the guest
* @argc: number of arguments
* @argv: array of arguments (@argc elements)
*
@ -49,10 +67,14 @@ typedef uint64_t qemu_plugin_id_t;
* Note: Calling qemu_plugin_uninstall() from this function is a bug. To raise
* an error during install, return !0.
*
* Note: @info is only live during the call. Copy any information we
* want to keep.
*
* Note: @argv remains valid throughout the lifetime of the loaded plugin.
*/
QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, int argc,
char **argv);
QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
const qemu_info_t *info,
int argc, char **argv);
/*
* Prototypes for the various callback styles we will be registering