modules: get rid of struct module_info

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

The plugin manager now defines a module interface struct, and fills it
it by dlsym:ing the functions that used to be in module_info.
This commit is contained in:
Daniel Eklöf 2019-01-13 17:09:11 +01:00
parent 07b1615a41
commit bc62843c91
16 changed files with 57 additions and 111 deletions

View file

@ -266,7 +266,7 @@ alsa_new(const char *card, const char *mixer, struct particle *label)
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *card = yml_get_value(node, "card");
@ -279,7 +279,7 @@ from_conf(const struct yml_node *node, struct conf_inherit inherited)
conf_to_particle(content, inherited));
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -292,8 +292,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -214,7 +214,7 @@ backlight_new(const char *device, struct particle *label)
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *name = yml_get_value(node, "name");
@ -224,7 +224,7 @@ from_conf(const struct yml_node *node, struct conf_inherit inherited)
yml_value_as_string(name), conf_to_particle(c, inherited));
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -236,8 +236,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -348,7 +348,7 @@ battery_new(const char *battery, struct particle *label, int poll_interval_secs)
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *c = yml_get_value(node, "content");
@ -361,7 +361,7 @@ from_conf(const struct yml_node *node, struct conf_inherit inherited)
poll_interval != NULL ? yml_value_as_int(poll_interval) : 60);
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -374,8 +374,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -93,7 +93,7 @@ clock_new(struct particle *label, const char *date_format, const char *time_form
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *c = yml_get_value(node, "content");
@ -106,7 +106,7 @@ from_conf(const struct yml_node *node, struct conf_inherit inherited)
time_format != NULL ? yml_value_as_string(time_format) : "%H:%M");
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -119,8 +119,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -639,7 +639,7 @@ i3_new(struct i3_workspaces workspaces[], size_t workspace_count,
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *c = yml_get_value(node, "content");
@ -696,7 +696,7 @@ verify_content(keychain_t *chain, const struct yml_node *node)
return true;
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -710,8 +710,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -46,14 +46,14 @@ label_new(struct particle *label)
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *c = yml_get_value(node, "content");
return label_new(conf_to_particle(c, inherited));
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -64,8 +64,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -475,7 +475,7 @@ mpd_new(const char *host, uint16_t port, struct particle *label)
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *host = yml_get_value(node, "host");
@ -488,7 +488,7 @@ from_conf(const struct yml_node *node, struct conf_inherit inherited)
conf_to_particle(c, inherited));
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -501,8 +501,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -530,7 +530,7 @@ network_new(const char *iface, struct particle *label)
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *name = yml_get_value(node, "name");
@ -540,7 +540,7 @@ from_conf(const struct yml_node *node, struct conf_inherit inherited)
yml_value_as_string(name), conf_to_particle(content, inherited));
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -552,8 +552,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -557,7 +557,7 @@ removables_new(struct particle *label, int left_spacing, int right_spacing)
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *content = yml_get_value(node, "content");
@ -573,7 +573,7 @@ from_conf(const struct yml_node *node, struct conf_inherit inherited)
return removables_new(conf_to_particle(content, inherited), left, right);
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -587,8 +587,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -467,14 +467,14 @@ xkb_new(struct particle *label)
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *c = yml_get_value(node, "content");
return xkb_new(conf_to_particle(c, inherited));
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -485,8 +485,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};

View file

@ -311,14 +311,14 @@ xwindow_new(struct particle *label)
return mod;
}
static struct module *
struct module *
from_conf(const struct yml_node *node, struct conf_inherit inherited)
{
const struct yml_node *c = yml_get_value(node, "content");
return xwindow_new(conf_to_particle(c, inherited));
}
static bool
bool
verify_conf(keychain_t *chain, const struct yml_node *node)
{
static const struct attr_info attrs[] = {
@ -329,8 +329,3 @@ verify_conf(keychain_t *chain, const struct yml_node *node)
return conf_verify_dict(chain, node, attrs);
}
const struct module_info plugin_info = {
.verify_conf = &verify_conf,
.from_conf = &from_conf,
};