[PATCH weston 5/6] ivi-shell: don't load controller modules

Pekka Paalanen ppaalanen at gmail.com
Mon Jan 22 12:33:56 UTC 2018


On Wed, 3 Jan 2018 16:09:20 +0100
Emre Ucan <eucan at de.adit-jv.com> wrote:

> controller modules can be loaded as weston modules
> from the main function of weston.
> 
> Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
> ---
>  ivi-shell/ivi-layout.c | 40 ----------------------------------------
>  ivi-shell/ivi-shell.c  | 28 ++++------------------------
>  2 files changed, 4 insertions(+), 64 deletions(-)
> 
> diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
> index a11b658..f9a83ab 100644
> --- a/ivi-shell/ivi-layout.c
> +++ b/ivi-shell/ivi-layout.c
> @@ -2012,43 +2012,3 @@ static struct ivi_layout_interface ivi_layout_interface = {
>  	.surface_get_size		= ivi_layout_surface_get_size,
>  	.surface_dump			= ivi_layout_surface_dump,
>  };
> -
> -int
> -load_controller_modules(struct weston_compositor *compositor, const char *modules,
> -			int *argc, char *argv[])
> -{
> -	const char *p, *end;
> -	char buffer[256];
> -	int (*controller_module_init)(struct weston_compositor *compositor,
> -				      int *argc, char *argv[],
> -				      const struct ivi_layout_interface *interface,
> -				      size_t interface_version);
> -
> -	if (modules == NULL)
> -		return 0;
> -
> -	p = modules;
> -	while (*p) {
> -		end = strchrnul(p, ',');
> -		snprintf(buffer, sizeof buffer, "%.*s", (int)(end - p), p);
> -
> -		controller_module_init =
> -			wet_load_module_entrypoint(buffer,
> -						   "controller_module_init");
> -		if (!controller_module_init)
> -			return -1;
> -
> -		if (controller_module_init(compositor, argc, argv,
> -					   &ivi_layout_interface,
> -				sizeof(struct ivi_layout_interface)) != 0) {
> -			weston_log("ivi-shell: Initialization of controller module fails");
> -			return -1;
> -		}
> -
> -		p = end;
> -		while (*p == ',')
> -			p++;
> -	}
> -
> -	return 0;
> -}
> diff --git a/ivi-shell/ivi-shell.c b/ivi-shell/ivi-shell.c
> index c096954..ebca2fc 100644
> --- a/ivi-shell/ivi-shell.c
> +++ b/ivi-shell/ivi-shell.c
> @@ -69,7 +69,6 @@ struct ivi_shell_surface
>  
>  struct ivi_shell_setting
>  {
> -	char *ivi_module;
>  	int developermode;
>  };
>  
> @@ -413,20 +412,8 @@ ivi_shell_setting_create(struct ivi_shell_setting *dest,
>  	struct weston_config *config = wet_get_config(compositor);
>  	struct weston_config_section *section;
>  
> -	const struct weston_option ivi_shell_options[] = {
> -		{ WESTON_OPTION_STRING, "ivi-module", 0, &dest->ivi_module },
> -	};
> -
> -	parse_options(ivi_shell_options, ARRAY_LENGTH(ivi_shell_options),
> -		      argc, argv);
> -
>  	section = weston_config_get_section(config, "ivi-shell", NULL, NULL);
>  
> -	if (!dest->ivi_module &&
> -	    weston_config_section_get_string(section, "ivi-module",
> -					     &dest->ivi_module, NULL) < 0) {
> -	}
> -
>  	weston_config_section_get_bool(section, "developermode",
>  				       &dest->developermode, 0);
>  
> @@ -512,29 +499,22 @@ wet_shell_init(struct weston_compositor *compositor,
>  	wl_signal_add(&compositor->destroy_signal, &shell->destroy_listener);
>  
>  	if (input_panel_setup(shell) < 0)
> -		goto out_settings;
> +		goto out;
>  
>  	shell->text_backend = text_backend_init(compositor);
>  	if (!shell->text_backend)
> -		goto out_settings;
> +		goto out;
>  
>  	if (wl_global_create(compositor->wl_display,
>  			     &ivi_application_interface, 1,
>  			     shell, bind_ivi_application) == NULL)
> -		goto out_settings;
> +		goto out;
>  
>  	ivi_layout_init_with_compositor(compositor);
>  	shell_add_bindings(compositor, shell);
>  
> -	/* Call module_init of ivi-modules which are defined in weston.ini */
> -	if (load_controller_modules(compositor, setting.ivi_module,
> -				    argc, argv) < 0)
> -		goto out_settings;
> -
>  	retval = 0;
>  
> -out_settings:
> -	free(setting.ivi_module);
> -
> +out:
>  	return retval;
>  }

I like it.

Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180122/d35aa9ab/attachment-0001.sig>


More information about the wayland-devel mailing list