[PATCH weston v2 3/5] weston: Properly namespace modules entrypoint
Quentin Glidic
sardemff7+wayland at sardemff7.net
Sun Dec 18 13:26:32 UTC 2016
From: Quentin Glidic <sardemff7+git at sardemff7.net>
Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
compositor/cms-colord.c | 4 ++--
compositor/cms-static.c | 4 ++--
compositor/main.c | 27 +++++++++++++++++++--------
compositor/screen-share.c | 4 ++--
compositor/systemd-notify.c | 4 ++--
compositor/weston.h | 9 ++++++++-
desktop-shell/shell.c | 4 ++--
fullscreen-shell/fullscreen-shell.c | 4 ++--
ivi-shell/ivi-layout.c | 4 +++-
ivi-shell/ivi-shell.c | 4 ++--
tests/plugin-registry-test.c | 3 ++-
tests/surface-global-test.c | 3 ++-
tests/surface-screenshot.c | 4 ++--
tests/surface-test.c | 3 ++-
tests/weston-test.c | 4 ++--
15 files changed, 54 insertions(+), 31 deletions(-)
diff --git a/compositor/cms-colord.c b/compositor/cms-colord.c
index ae3ef25..0daa2a7 100644
--- a/compositor/cms-colord.c
+++ b/compositor/cms-colord.c
@@ -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;
diff --git a/compositor/cms-static.c b/compositor/cms-static.c
index a6bbfd4..e24501b 100644
--- a/compositor/cms-static.c
+++ b/compositor/cms-static.c
@@ -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;
diff --git a/compositor/main.c b/compositor/main.c
index 2aa4936..af093f1 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -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;
diff --git a/compositor/screen-share.c b/compositor/screen-share.c
index 0db0203..bcb9def 100644
--- a/compositor/screen-share.c
+++ b/compositor/screen-share.c
@@ -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);
diff --git a/compositor/systemd-notify.c b/compositor/systemd-notify.c
index ce18ede..50f03cb 100644
--- a/compositor/systemd-notify.c
+++ b/compositor/systemd-notify.c
@@ -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;
diff --git a/compositor/weston.h b/compositor/weston.h
index 2e0417c..6229b34 100644
--- a/compositor/weston.h
+++ b/compositor/weston.h
@@ -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,
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 3913f95..47f7e16 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4875,8 +4875,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;
diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index dab429d..fcecc8d 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -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;
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 60d05c4..74e7158 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -2118,7 +2118,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;
diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
index 6bdd238..6095ff7 100644
--- a/ivi-shell/ivi-shell.c
+++ b/ivi-shell/ivi-shell.c
@@ -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 = { };
diff --git a/tests/plugin-registry-test.c b/tests/plugin-registry-test.c
index 2a32e01..81e26cd 100644
--- a/tests/plugin-registry-test.c
+++ b/tests/plugin-registry-test.c
@@ -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;
diff --git a/tests/surface-global-test.c b/tests/surface-global-test.c
index 20d99ce..4604d19 100644
--- a/tests/surface-global-test.c
+++ b/tests/surface-global-test.c
@@ -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;
diff --git a/tests/surface-screenshot.c b/tests/surface-screenshot.c
index 6ff2bfc..716eeda 100644
--- a/tests/surface-screenshot.c
+++ b/tests/surface-screenshot.c
@@ -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);
diff --git a/tests/surface-test.c b/tests/surface-test.c
index 4463061..28520aa 100644
--- a/tests/surface-test.c
+++ b/tests/surface-test.c
@@ -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;
diff --git a/tests/weston-test.c b/tests/weston-test.c
index eec2c3c..6005105 100644
--- a/tests/weston-test.c
+++ b/tests/weston-test.c
@@ -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;
--
2.10.0
More information about the wayland-devel
mailing list