Verified Commit 8af2becc authored by Quentin Glidic's avatar Quentin Glidic
Browse files

weston: Properly namespace modules entrypoint


Signed-off-by: Quentin Glidic's avatarQuentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone's avatarDaniel Stone <daniels@collabora.com>
parent 3d7ca3b9
......@@ -496,8 +496,8 @@ colord_cms_output_destroy(gpointer data)
}
WL_EXPORT int
module_init(struct weston_compositor *ec,
int *argc, char *argv[])
wet_module_init(struct weston_compositor *ec,
int *argc, char *argv[])
{
gboolean ret;
GError *error = NULL;
......
......@@ -91,8 +91,8 @@ cms_notifier_destroy(struct wl_listener *listener, void *data)
WL_EXPORT int
module_init(struct weston_compositor *ec,
int *argc, char *argv[])
wet_module_init(struct weston_compositor *ec,
int *argc, char *argv[])
{
struct cms_static *cms;
struct weston_output *output;
......
......@@ -761,7 +761,7 @@ weston_create_listening_socket(struct wl_display *display, const char *socket_na
}
WL_EXPORT void *
wet_load_module(const char *name, const char *entrypoint)
wet_load_module_entrypoint(const char *name, const char *entrypoint)
{
const char *builddir = getenv("WESTON_BUILD_DIR");
char path[PATH_MAX];
......@@ -812,14 +812,28 @@ wet_load_module(const char *name, const char *entrypoint)
return init;
}
WL_EXPORT int
wet_load_module(struct weston_compositor *compositor,
const char *name, int *argc, char *argv[])
{
int (*module_init)(struct weston_compositor *ec,
int *argc, char *argv[]);
module_init = wet_load_module_entrypoint(name, "wet_module_init");
if (!module_init)
return -1;
if (module_init(compositor, argc, argv) < 0)
return -1;
return 0;
}
static int
load_modules(struct weston_compositor *ec, const char *modules,
int *argc, char *argv[])
{
const char *p, *end;
char buffer[256];
int (*module_init)(struct weston_compositor *ec,
int *argc, char *argv[]);
if (modules == NULL)
return 0;
......@@ -833,16 +847,13 @@ load_modules(struct weston_compositor *ec, const char *modules,
if (wet_load_xwayland(ec) < 0)
return -1;
} else {
module_init = wet_load_module(buffer, "module_init");
if (!module_init)
return -1;
if (module_init(ec, argc, argv) < 0)
if (wet_load_module(ec, buffer, argc, argv) < 0)
return -1;
}
p = end;
while (*p == ',')
p++;
}
return 0;
......
......@@ -1106,8 +1106,8 @@ share_output_binding(struct weston_keyboard *keyboard, uint32_t time, uint32_t k
}
WL_EXPORT int
module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
wet_module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
{
struct screen_share *ss;
struct weston_config *config = wet_get_config(compositor);
......
......@@ -115,8 +115,8 @@ weston_compositor_destroy_listener(struct wl_listener *listener, void *data)
}
WL_EXPORT int
module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
wet_module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
{
char *watchdog_time_env;
struct wl_event_loop *loop;
......
......@@ -61,7 +61,14 @@ struct weston_config *
wet_get_config(struct weston_compositor *compositor);
void *
wet_load_module(const char *name, const char *entrypoint);
wet_load_module_entrypoint(const char *name, const char *entrypoint);
int
wet_module_init(struct weston_compositor *ec,
int *argc, char *argv[]);
int
wet_load_module(struct weston_compositor *compositor,
const char *name, int *argc, char *argv[]);
int
module_init(struct weston_compositor *compositor,
......
......@@ -4874,8 +4874,8 @@ handle_seat_created(struct wl_listener *listener, void *data)
}
WL_EXPORT int
module_init(struct weston_compositor *ec,
int *argc, char *argv[])
wet_module_init(struct weston_compositor *ec,
int *argc, char *argv[])
{
struct weston_seat *seat;
struct desktop_shell *shell;
......
......@@ -897,8 +897,8 @@ bind_fullscreen_shell(struct wl_client *client, void *data, uint32_t version,
}
WL_EXPORT int
module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
wet_module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
{
struct fullscreen_shell *shell;
struct weston_seat *seat;
......
......@@ -2120,7 +2120,9 @@ load_controller_modules(struct weston_compositor *compositor, const char *module
end = strchrnul(p, ',');
snprintf(buffer, sizeof buffer, "%.*s", (int)(end - p), p);
controller_module_init = wet_load_module(buffer, "controller_module_init");
controller_module_init =
wet_load_module_entrypoint(buffer,
"controller_module_init");
if (!controller_module_init)
return -1;
......
......@@ -492,8 +492,8 @@ shell_add_bindings(struct weston_compositor *compositor,
* Initialization of ivi-shell.
*/
WL_EXPORT int
module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
wet_module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
{
struct ivi_shell *shell;
struct ivi_shell_setting setting = { };
......
......@@ -89,7 +89,8 @@ runtime_tests(void *data)
}
WL_EXPORT int
module_init(struct weston_compositor *compositor, int *argc, char *argv[])
wet_module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
{
struct wl_event_loop *loop;
......
......@@ -80,7 +80,8 @@ surface_to_from_global(void *data)
}
WL_EXPORT int
module_init(struct weston_compositor *compositor, int *argc, char *argv[])
wet_module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
{
struct wl_event_loop *loop;
......
......@@ -214,8 +214,8 @@ out:
}
WL_EXPORT int
module_init(struct weston_compositor *ec,
int *argc, char *argv[])
wet_module_init(struct weston_compositor *ec,
int *argc, char *argv[])
{
weston_compositor_add_debug_binding(ec, KEY_H, trigger_binding, ec);
......
......@@ -61,7 +61,8 @@ surface_transform(void *data)
}
WL_EXPORT int
module_init(struct weston_compositor *compositor, int *argc, char *argv[])
wet_module_init(struct weston_compositor *compositor,
int *argc, char *argv[])
{
struct wl_event_loop *loop;
......
......@@ -585,8 +585,8 @@ idle_launch_client(void *data)
}
WL_EXPORT int
module_init(struct weston_compositor *ec,
int *argc, char *argv[])
wet_module_init(struct weston_compositor *ec,
int *argc, char *argv[])
{
struct weston_test *test;
struct wl_event_loop *loop;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment