particles: get rid of struct particle_info

Since this struct only contained function pointers, make all particles
export those functions directly.

The plugin manager now defines a particle interface struct, and fills
it it by dlsym:ing the functions that used to be in particle_info.
This commit is contained in:
Daniel Eklöf 2019-01-13 17:01:45 +01:00
parent d35695e98a
commit 07b1615a41
11 changed files with 63 additions and 80 deletions

View file

@ -1,10 +1,17 @@
#pragma once
#include "config-verify.h"
#include "module.h"
#include "particle.h"
struct particle_iface {
bool (*verify_conf)(keychain_t *chain, const struct yml_node *node);
struct particle *(*from_conf)(
const struct yml_node *node, struct particle *common);
};
const struct module_info *plugin_load_module(const char *name);
const struct particle_info *plugin_load_particle(const char *name);
const struct particle_iface *plugin_load_particle(const char *name);
enum plugin_type { PLUGIN_MODULE, PLUGIN_PARTICLE };
@ -13,7 +20,10 @@ struct plugin {
enum plugin_type type;
void *lib;
const void *sym;
union {
void *sym;
struct particle_iface particle;
};
};
const struct plugin *plugin_load(const char *name, enum plugin_type type);