From f5d8ba0310a04e04ebcc916087c3e15073bc8687 Mon Sep 17 00:00:00 2001 From: Laurent Bigonville Date: Wed, 30 Jul 2014 11:01:58 +0200 Subject: [PATCH] Imported Upstream version 0.8.1 --- configure | 20 ++-- configure.ac | 2 +- scripts/plymouth-set-default-theme.in | 4 +- src/client/plymouth.c | 111 ++++++++++++++++++ src/libply/ply-key-file.c | 73 +++++++++++- src/main.c | 10 +- src/plugins/renderers/drm/plugin.c | 4 + .../drm/ply-renderer-radeon-driver.c | 2 +- src/plugins/renderers/frame-buffer/plugin.c | 33 +++++- 9 files changed, 233 insertions(+), 26 deletions(-) diff --git a/configure b/configure index a29741c..553dc78 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for plymouth 0.8.0. +# Generated by GNU Autoconf 2.63 for plymouth 0.8.1. # # Report bugs to . # @@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='plymouth' PACKAGE_TARNAME='plymouth' -PACKAGE_VERSION='0.8.0' -PACKAGE_STRING='plymouth 0.8.0' +PACKAGE_VERSION='0.8.1' +PACKAGE_STRING='plymouth 0.8.1' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=plymouth' ac_unique_file="src/main.c" @@ -1537,7 +1537,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures plymouth 0.8.0 to adapt to many kinds of systems. +\`configure' configures plymouth 0.8.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1607,7 +1607,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of plymouth 0.8.0:";; + short | recursive ) echo "Configuration of plymouth 0.8.1:";; esac cat <<\_ACEOF @@ -1747,7 +1747,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -plymouth configure 0.8.0 +plymouth configure 0.8.1 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1761,7 +1761,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by plymouth $as_me 0.8.0, which was +It was created by plymouth $as_me 0.8.1, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -5567,7 +5567,7 @@ fi # Define the identity of the package. PACKAGE='plymouth' - VERSION='0.8.0' + VERSION='0.8.1' cat >>confdefs.h <<_ACEOF @@ -14169,7 +14169,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by plymouth $as_me 0.8.0, which was +This file was extended by plymouth $as_me 0.8.1, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14232,7 +14232,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -plymouth config.status 0.8.0 +plymouth config.status 0.8.1 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/configure.ac b/configure.ac index b78e21f..2b8ccbd 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([plymouth],[0.8.0],[https://bugs.freedesktop.org/enter_bug.cgi?product=plymouth]) +AC_INIT([plymouth],[0.8.1],[https://bugs.freedesktop.org/enter_bug.cgi?product=plymouth]) AC_CONFIG_SRCDIR(src/main.c) AC_CONFIG_HEADER(config.h) AC_CONFIG_AUX_DIR(build-tools) diff --git a/scripts/plymouth-set-default-theme.in b/scripts/plymouth-set-default-theme.in index 732f8ad..dd0b915 100755 --- a/scripts/plymouth-set-default-theme.in +++ b/scripts/plymouth-set-default-theme.in @@ -177,9 +177,9 @@ if [ ! -e ${PLYMOUTH_PLUGIN_PATH}${MODULE_NAME}.so ]; then fi [ -d ${PLYMOUTH_CONFDIR} ] || mkdir -p ${PLYMOUTH_CONFDIR} -fgrep -q '[Daemon]' ${PLYMOUTH_CONFDIR}/plymouthd.conf 2> /null || echo '[Daemon]' >> ${PLYMOUTH_CONFDIR}/plymouthd.conf +grep -q '^[[]Daemon[]]' ${PLYMOUTH_CONFDIR}/plymouthd.conf 2> /null || echo '[Daemon]' >> ${PLYMOUTH_CONFDIR}/plymouthd.conf sed -i -e '/^Theme[[:blank:]]*=.*/d' ${PLYMOUTH_CONFDIR}/plymouthd.conf -sed -i -e "s/\([[]Daemon[]]\)\n*/\1\nTheme=${THEME_NAME}/" ${PLYMOUTH_CONFDIR}/plymouthd.conf +sed -i -e "s/^\([[]Daemon[]]\)\n*/\1\nTheme=${THEME_NAME}/" ${PLYMOUTH_CONFDIR}/plymouthd.conf [ $DO_INITRD_REBUILD -ne 0 ] && (${PLYMOUTH_LIBEXECDIR}/plymouth/plymouth-update-initrd) diff --git a/src/client/plymouth.c b/src/client/plymouth.c index d392007..f36a48a 100644 --- a/src/client/plymouth.c +++ b/src/client/plymouth.c @@ -735,6 +735,87 @@ get_kernel_command_line (state_t *state) return true; } +static void +on_update_root_fs_request (state_t *state, + const char *command) +{ + + char *root_dir; + bool is_read_write; + + root_dir = NULL; + is_read_write = false; + ply_command_parser_get_command_options (state->command_parser, + command, + "new-root-dir", &root_dir, + "read-write", &is_read_write, + NULL); + + if (root_dir != NULL) + { + ply_boot_client_tell_daemon_to_change_root (state->client, root_dir, + (ply_boot_client_response_handler_t) + on_success, + (ply_boot_client_response_handler_t) + on_failure, state); + + } + + if (is_read_write) + { + ply_boot_client_tell_daemon_system_is_initialized (state->client, + (ply_boot_client_response_handler_t) + on_success, + (ply_boot_client_response_handler_t) + on_failure, state); + } +} + +static void +on_show_splash_request (state_t *state, + const char *command) +{ + ply_boot_client_tell_daemon_to_show_splash (state->client, + (ply_boot_client_response_handler_t) + on_success, + (ply_boot_client_response_handler_t) + on_failure, state); +} + +static void +on_hide_splash_request (state_t *state, + const char *command) +{ + ply_boot_client_tell_daemon_to_hide_splash (state->client, + (ply_boot_client_response_handler_t) + on_success, + (ply_boot_client_response_handler_t) + on_failure, state); +} + +static void +on_update_request (state_t *state, + const char *command) +{ + char *status; + + status = NULL; + ply_command_parser_get_command_options (state->command_parser, + command, + "status", &status, + NULL); + + if (status != NULL) + { + ply_boot_client_update_daemon (state->client, status, + (ply_boot_client_response_handler_t) + on_success, + (ply_boot_client_response_handler_t) + on_failure, state); + + } +} + int main (int argc, char **argv) @@ -771,6 +852,36 @@ main (int argc, "wait", "Wait for boot daemon to quit", PLY_COMMAND_OPTION_TYPE_FLAG, NULL); + ply_command_parser_add_command (state.command_parser, + "update", "Tell daemon about boot status changes", + (ply_command_handler_t) + on_update_request, &state, + "status", "Tell daemon the current boot status", + PLY_COMMAND_OPTION_TYPE_STRING, + NULL); + + ply_command_parser_add_command (state.command_parser, + "update-root-fs", "Tell daemon about root filesystem changes", + (ply_command_handler_t) + on_update_root_fs_request, &state, + "new-root-dir", "Root filesystem is about to change", + PLY_COMMAND_OPTION_TYPE_STRING, + "read-write", "Root filesystem is no longer read-only", + PLY_COMMAND_OPTION_TYPE_FLAG, + NULL); + + ply_command_parser_add_command (state.command_parser, + "show-splash", "Tell daemon to show splash screen", + (ply_command_handler_t) + on_show_splash_request, &state, + NULL); + + ply_command_parser_add_command (state.command_parser, + "hide-splash", "Tell daemon to hide splash screen", + (ply_command_handler_t) + on_hide_splash_request, &state, + NULL); + ply_command_parser_add_command (state.command_parser, "ask-for-password", "Ask user for password", (ply_command_handler_t) diff --git a/src/libply/ply-key-file.c b/src/libply/ply-key-file.c index c1987b0..f36b229 100644 --- a/src/libply/ply-key-file.c +++ b/src/libply/ply-key-file.c @@ -38,6 +38,7 @@ #include "ply-utils.h" #include "ply-hashtable.h" +#include "ply-logger.h" typedef struct { @@ -70,7 +71,11 @@ ply_key_file_open_file (ply_key_file_t *key_file) key_file->fp = fopen (key_file->filename, "r"); if (key_file->fp == NULL) - return false; + { + ply_trace ("Failed to open key file %s: %m", + key_file->filename); + return false; + } return true; } @@ -155,16 +160,35 @@ ply_key_file_load_group (ply_key_file_t *key_file, group->name = strdup (group_name); group->entries = ply_hashtable_new (ply_hashtable_string_hash, ply_hashtable_string_compare); + ply_trace ("trying to load group %s", group_name); do { ply_key_file_entry_t *entry; char *key; char *value; long offset; + int first_byte; key = NULL; value = NULL; + first_byte = fgetc (key_file->fp); + if (first_byte == '#') + { + char *line_to_toss; + size_t number_of_bytes; + + line_to_toss = NULL; + number_of_bytes = 0; + + getline (&line_to_toss, &number_of_bytes, + key_file->fp); + free (line_to_toss); + items_matched = 0; + continue; + } + ungetc (first_byte, key_file->fp); + offset = ftell (key_file->fp); items_matched = fscanf (key_file->fp, " %a[^= \t\n] = %a[^\n] ", &key, &value); @@ -196,15 +220,40 @@ ply_key_file_load_groups (ply_key_file_t *key_file) int items_matched; char *group_name; bool added_group = false; + bool has_comments = false; do { + int first_byte; + ply_key_file_group_t *group; + first_byte = fgetc (key_file->fp); + if (first_byte == '#') + { + char *line_to_toss; + size_t number_of_bytes; + + line_to_toss = NULL; + number_of_bytes = 0; + + getline (&line_to_toss, &number_of_bytes, + key_file->fp); + free (line_to_toss); + has_comments = true; + items_matched = 0; + continue; + } + ungetc (first_byte, key_file->fp); + items_matched = fscanf (key_file->fp, " [ %a[^]] ] ", &group_name); if (items_matched <= 0) - break; + { + ply_trace ("key file has no %sgroups", + added_group? "more " : ""); + break; + } group = ply_key_file_load_group (key_file, group_name); @@ -218,6 +267,11 @@ ply_key_file_load_groups (ply_key_file_t *key_file) } while (items_matched != EOF); + if (!added_group && has_comments) + { + ply_trace ("key file has comments but no groups"); + } + return added_group; } @@ -233,6 +287,11 @@ ply_key_file_load (ply_key_file_t *key_file) was_loaded = ply_key_file_load_groups (key_file); + if (!was_loaded) + { + ply_trace ("was unable to load any groups"); + } + ply_key_file_close_file (key_file); return was_loaded; @@ -282,12 +341,18 @@ ply_key_file_get_value (ply_key_file_t *key_file, group = ply_key_file_find_group (key_file, group_name); if (group == NULL) - return NULL; + { + ply_trace ("key file does not have group '%s'", group_name); + return NULL; + } entry = ply_key_file_find_entry (key_file, group, key); if (entry == NULL) - return NULL; + { + ply_trace ("key file does not have entry for key '%s'", key); + return NULL; + } return strdup (entry->value); } diff --git a/src/main.c b/src/main.c index a55ef70..e560462 100644 --- a/src/main.c +++ b/src/main.c @@ -228,7 +228,7 @@ find_system_default_splash (state_t *state) ply_trace ("Trying to load " PLYMOUTH_CONF_DIR "plymouthd.conf"); key_file = ply_key_file_new (PLYMOUTH_CONF_DIR "plymouthd.conf"); - if (ply_key_file_load (key_file)) + if (!ply_key_file_load (key_file)) { ply_trace ("failed to load " PLYMOUTH_CONF_DIR "plymouthd.conf"); ply_key_file_free (key_file); @@ -239,7 +239,7 @@ find_system_default_splash (state_t *state) ply_trace ("System default splash is configured to be '%s'", splash_string); - asprintf (&state->override_splash_path, + asprintf (&state->system_default_splash_path, PLYMOUTH_THEME_PATH "%s/%s.plymouth", splash_string, splash_string); free (splash_string); @@ -257,9 +257,9 @@ find_distribution_default_splash (state_t *state) ply_trace ("Trying to load " PLYMOUTH_POLICY_DIR "plymouthd.defaults"); key_file = ply_key_file_new (PLYMOUTH_POLICY_DIR "plymouthd.defaults"); - if (ply_key_file_load (key_file)) + if (!ply_key_file_load (key_file)) { - ply_trace ("failed to load " PLYMOUTH_POLICY_DIR "plymouthd.conf"); + ply_trace ("failed to load " PLYMOUTH_POLICY_DIR "plymouthd.defaults"); ply_key_file_free (key_file); return; } @@ -268,7 +268,7 @@ find_distribution_default_splash (state_t *state) ply_trace ("Distribution default splash is configured to be '%s'", splash_string); - asprintf (&state->override_splash_path, + asprintf (&state->distribution_default_splash_path, PLYMOUTH_THEME_PATH "%s/%s.plymouth", splash_string, splash_string); free (splash_string); diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c index 0dcca2d..6d850bf 100644 --- a/src/plugins/renderers/drm/plugin.c +++ b/src/plugins/renderers/drm/plugin.c @@ -783,6 +783,10 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend) if (!backend->driver_supports_mapping_console && ply_list_get_length (backend->heads) == 1) { + ply_trace ("Only one monitor configured, and driver doesn't " + "support mapping console, so letting frame-buffer " + "take over"); + free_heads (backend); return false; } diff --git a/src/plugins/renderers/drm/ply-renderer-radeon-driver.c b/src/plugins/renderers/drm/ply-renderer-radeon-driver.c index 527fbfc..5d4032c 100644 --- a/src/plugins/renderers/drm/ply-renderer-radeon-driver.c +++ b/src/plugins/renderers/drm/ply-renderer-radeon-driver.c @@ -99,7 +99,7 @@ destroy_driver (ply_renderer_driver_t *driver) { ply_hashtable_free (driver->buffers); - ply_trace ("uninitializing intel buffer manager"); + ply_trace ("uninitializing radeon buffer manager"); radeon_bo_manager_gem_dtor (driver->manager); free (driver); } diff --git a/src/plugins/renderers/frame-buffer/plugin.c b/src/plugins/renderers/frame-buffer/plugin.c index d9f193b..ea511a2 100644 --- a/src/plugins/renderers/frame-buffer/plugin.c +++ b/src/plugins/renderers/frame-buffer/plugin.c @@ -258,6 +258,8 @@ create_backend (const char *device_name, backend->device_name = strdup (PLY_FRAME_BUFFER_DEFAULT_FB_DEVICE_NAME); + ply_trace ("creating renderer backend for device %s", backend->device_name); + backend->loop = ply_event_loop_get_default (); backend->heads = ply_list_new (); backend->input_source.key_buffer = ply_buffer_new (); @@ -270,6 +272,8 @@ static void initialize_head (ply_renderer_backend_t *backend, ply_renderer_head_t *head) { + ply_trace ("initializing %lux%lu head", + head->area.width, head->area.height); head->pixel_buffer = ply_pixel_buffer_new (head->area.width, head->area.height); ply_pixel_buffer_fill_with_color (backend->head.pixel_buffer, NULL, @@ -281,6 +285,8 @@ static void uninitialize_head (ply_renderer_backend_t *backend, ply_renderer_head_t *head) { + ply_trace ("uninitializing %lux%lu head", + head->area.width, head->area.height); if (head->pixel_buffer != NULL) { ply_pixel_buffer_free (head->pixel_buffer); @@ -294,6 +300,8 @@ static void destroy_backend (ply_renderer_backend_t *backend) { + ply_trace ("destroying renderer backend for device %s", + backend->device_name); free (backend->device_name); uninitialize_head (backend, &backend->head); @@ -305,6 +313,7 @@ destroy_backend (ply_renderer_backend_t *backend) static void activate (ply_renderer_backend_t *backend) { + ply_trace ("Redrawing screen"); backend->is_active = true; if (backend->head.map_address != MAP_FAILED) @@ -494,6 +503,14 @@ query_device (ply_renderer_backend_t *backend) backend->dither_green = 0; backend->dither_blue = 0; + ply_trace ("%d bpp (%d, %d, %d, %d) with rowstride %d", + (int) backend->bytes_per_pixel * 8, + backend->bits_for_red, + backend->bits_for_green, + backend->bits_for_blue, + backend->bits_for_alpha, + (int) backend->row_stride); + backend->head.size = backend->head.area.height * backend->row_stride; if (backend->bytes_per_pixel == 4 && @@ -525,12 +542,21 @@ map_to_device (ply_renderer_backend_t *backend) MAP_SHARED, backend->device_fd, 0); if (head->map_address == MAP_FAILED) - return false; + { + ply_trace ("could not map fb device: %m"); + return false; + } if (ply_terminal_is_active (backend->terminal)) - activate (backend); + { + ply_trace ("already on right vt, activating"); + activate (backend); + } else - ply_terminal_activate_vt (backend->terminal); + { + ply_trace ("on wrong vt, changing vts"); + ply_terminal_activate_vt (backend->terminal); + } return true; } @@ -542,6 +568,7 @@ unmap_from_device (ply_renderer_backend_t *backend) head = &backend->head; + ply_trace ("unmapping device"); if (head->map_address != MAP_FAILED) { munmap (head->map_address, head->size);