qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC 4/4] tcg/plugins: Add example pair of QPP plugins


From: Andrew S. Fasano
Subject: Re: [RFC 4/4] tcg/plugins: Add example pair of QPP plugins
Date: Mon, 26 Sep 2022 21:38:10 +0000

From: Alex Bennée <alex.bennee@linaro.org>
> Andrew Fasano <fasano@mit.edu> writes:
> 
> > The first plugin, qpp_srv exposes two functions and one callback that other
> > plugins can leverage. These functions are described in the corresponding
> > header file.
> >
> > The second plugin, qpp_client, imports this header file, registers its
> > own function to run on a qpp_srv-provided callback, and directly calls
> > into the two exposed functions in qpp_srv.
> 
> I'll just sketch out how I would change the API in this example plugin:
[snip]
> QEMU_PLUGIN_EXPORT const char *qemu_plugin_name = "qpp_client";

This works. Perhaps plugins could (should?) also specify a version number
that other plugins could check before interacting with:

        QEMU_PLUGIN_EXPORT const int qemu_plugin_version = 1;

> QEMU_PLUGIN_EXPORT const char *qemu_plugin_uses = "qpp_server";

I anticipate plugins could depend on multiple other plugins and they might
want to check the version of these plugins, so perhaps a function call would
be better? Something like:

        int qpp_srv_version = load_qemu_plugin("qpp_server");

Perhaps returning negative values on error, otherwise the plugin version. Or
the version compatability checks could be standardized into the plugin core,
but that seems less important to me for now.
[snip]

> QEMU_PLUGIN_EXPORT int qpp_srv_do_add(int x)

I like the change to keep these with the plugin name as a prefix everywhere.

Thanks,
Andrew



reply via email to

[Prev in Thread] Current Thread [Next in Thread]