[PATCH weston v2 2/5] libweston: Properly namespace modules entrypoint
Quentin Glidic
sardemff7+wayland at sardemff7.net
Sun Dec 18 13:26:31 UTC 2016
From: Quentin Glidic <sardemff7+git at sardemff7.net>
Use different functions so we cannot load a libweston common module in
weston directly or the other way around.
Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
compositor/cms-colord.c | 1 +
compositor/systemd-notify.c | 1 +
compositor/weston.h | 4 ++++
fullscreen-shell/fullscreen-shell.c | 1 +
libweston/compositor.c | 8 +++-----
libweston/compositor.h | 3 +--
tests/plugin-registry-test.c | 1 +
tests/surface-global-test.c | 1 +
tests/surface-screenshot.c | 1 +
tests/surface-test.c | 1 +
xwayland/launcher.c | 3 +--
11 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/compositor/cms-colord.c b/compositor/cms-colord.c
index 152a734..ae3ef25 100644
--- a/compositor/cms-colord.c
+++ b/compositor/cms-colord.c
@@ -34,6 +34,7 @@
#include <colord.h>
#include "compositor.h"
+#include "weston.h"
#include "cms-helper.h"
#include "shared/helpers.h"
diff --git a/compositor/systemd-notify.c b/compositor/systemd-notify.c
index 49e51f4..ce18ede 100644
--- a/compositor/systemd-notify.c
+++ b/compositor/systemd-notify.c
@@ -34,6 +34,7 @@
#include "shared/string-helpers.h"
#include "shared/zalloc.h"
#include "compositor.h"
+#include "weston.h"
struct systemd_notifier {
int watchdog_time;
diff --git a/compositor/weston.h b/compositor/weston.h
index bb04002..2e0417c 100644
--- a/compositor/weston.h
+++ b/compositor/weston.h
@@ -63,6 +63,10 @@ wet_get_config(struct weston_compositor *compositor);
void *
wet_load_module(const char *name, const char *entrypoint);
+int
+module_init(struct weston_compositor *compositor,
+ int *argc, char *argv[]);
+
int
wet_load_xwayland(struct weston_compositor *comp);
diff --git a/fullscreen-shell/fullscreen-shell.c b/fullscreen-shell/fullscreen-shell.c
index b3083d8..dab429d 100644
--- a/fullscreen-shell/fullscreen-shell.c
+++ b/fullscreen-shell/fullscreen-shell.c
@@ -34,6 +34,7 @@
#include <assert.h>
#include "compositor.h"
+#include "compositor/weston.h"
#include "fullscreen-shell-unstable-v1-server-protocol.h"
#include "shared/helpers.h"
diff --git a/libweston/compositor.c b/libweston/compositor.c
index 6226810..d00a25a 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -5357,14 +5357,12 @@ weston_compositor_load_backend(struct weston_compositor *compositor,
WL_EXPORT int
weston_compositor_load_xwayland(struct weston_compositor *compositor)
{
- int (*module_init)(struct weston_compositor *ec,
- int *argc, char *argv[]);
- int argc = 0;
+ int (*module_init)(struct weston_compositor *ec);
- module_init = weston_load_module("xwayland.so", "module_init");
+ module_init = weston_load_module("xwayland.so", "weston_module_init");
if (!module_init)
return -1;
- if (module_init(compositor, &argc, NULL) < 0)
+ if (module_init(compositor) < 0)
return -1;
return 0;
}
diff --git a/libweston/compositor.h b/libweston/compositor.h
index faeea3a..d59e622 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1754,8 +1754,7 @@ int
weston_backend_init(struct weston_compositor *c,
struct weston_backend_config *config_base);
int
-module_init(struct weston_compositor *compositor,
- int *argc, char *argv[]);
+weston_module_init(struct weston_compositor *compositor);
void
weston_transformed_coord(int width, int height,
diff --git a/tests/plugin-registry-test.c b/tests/plugin-registry-test.c
index 7fc88f3..2a32e01 100644
--- a/tests/plugin-registry-test.c
+++ b/tests/plugin-registry-test.c
@@ -28,6 +28,7 @@
#include <assert.h>
#include "compositor.h"
+#include "compositor/weston.h"
#include "plugin-registry.h"
static void
diff --git a/tests/surface-global-test.c b/tests/surface-global-test.c
index 55899c6..20d99ce 100644
--- a/tests/surface-global-test.c
+++ b/tests/surface-global-test.c
@@ -29,6 +29,7 @@
#include <stdint.h>
#include "compositor.h"
+#include "compositor/weston.h"
static void
surface_to_from_global(void *data)
diff --git a/tests/surface-screenshot.c b/tests/surface-screenshot.c
index 332b5e3..6ff2bfc 100644
--- a/tests/surface-screenshot.c
+++ b/tests/surface-screenshot.c
@@ -34,6 +34,7 @@
#include <linux/input.h>
#include "compositor.h"
+#include "compositor/weston.h"
#include "file-util.h"
static char *
diff --git a/tests/surface-test.c b/tests/surface-test.c
index 243f8dc..4463061 100644
--- a/tests/surface-test.c
+++ b/tests/surface-test.c
@@ -29,6 +29,7 @@
#include <assert.h>
#include "compositor.h"
+#include "compositor/weston.h"
static void
surface_transform(void *data)
diff --git a/xwayland/launcher.c b/xwayland/launcher.c
index 276795a..0ecdb20 100644
--- a/xwayland/launcher.c
+++ b/xwayland/launcher.c
@@ -351,8 +351,7 @@ const struct weston_xwayland_api api = {
extern const struct weston_xwayland_surface_api surface_api;
WL_EXPORT int
-module_init(struct weston_compositor *compositor,
- int *argc, char *argv[])
+weston_module_init(struct weston_compositor *compositor)
{
struct wl_display *display = compositor->wl_display;
--
2.10.0
More information about the wayland-devel
mailing list