plugins: export a const function pointer interface struct

This commit is contained in:
Daniel Eklöf 2019-01-26 18:32:04 +01:00
parent 37266ae419
commit 452c4b6015
22 changed files with 255 additions and 230 deletions

View file

@ -15,6 +15,7 @@
#include "../bar.h"
#include "../config.h"
#include "../config-verify.h"
#include "../plugin.h"
struct private {
struct particle *label;
@ -219,8 +220,8 @@ backlight_new(const char *device, struct particle *label)
return mod;
}
struct module *
backlight_from_conf(const struct yml_node *node, struct conf_inherit inherited)
static struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *name = yml_get_value(node, "name");
const struct yml_node *c = yml_get_value(node, "content");
@ -229,8 +230,8 @@ backlight_from_conf(const struct yml_node *node, struct conf_inherit inherited)
yml_value_as_string(name), conf_to_particle(c, inherited));
}
bool
backlight_verify_conf(keychain_t *chain, const struct yml_node *node)
static bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
{"name", true, &conf_verify_string},
@ -242,11 +243,11 @@ backlight_verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_iface module_backlight_iface = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};
#if defined(CORE_PLUGINS_AS_SHARED_LIBRARIES)
bool verify_conf(keychain_t *chain, const struct yml_node *node)
__attribute__((weak, alias("backlight_verify_conf")));
struct deco *from_conf(const struct yml_node *node, struct conf_inherit inherited)
__attribute__((weak, alias("backlight_from_conf")));
extern const struct module_iface iface __attribute__((weak, alias("module_backlight_iface")));
#endif