Add --nowait option.

With --nowait option, plymouth will not wait for reply from plymouthd.
calculate-0.9.5
cee1 13 years ago committed by Ray Strode
parent cff3164a23
commit c926bccd83

@ -59,6 +59,7 @@ typedef struct
ply_boot_client_response_handler_t handler;
ply_boot_client_response_handler_t failed_handler;
void *user_data;
bool nowait;
} ply_boot_client_request_t;
static void ply_boot_client_cancel_request (ply_boot_client_t *client,
@ -211,7 +212,8 @@ ply_boot_client_request_new (ply_boot_client_t *client,
const char *request_argument,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
ply_boot_client_request_t *request;
@ -226,6 +228,7 @@ ply_boot_client_request_new (ply_boot_client_t *client,
request->handler = handler;
request->failed_handler = failed_handler;
request->user_data = user_data;
request->nowait = nowait;
return request;
}
@ -433,6 +436,15 @@ ply_boot_client_send_request (ply_boot_client_t *client,
}
free (request_string);
if (request->nowait)
{
if (request->handler != NULL)
request->handler (request->user_data, client);
request->handler = NULL;
request->failed_handler = NULL;
}
if (client->daemon_has_reply_watch == NULL)
{
assert (ply_list_get_length (client->requests_waiting_for_replies) == 0);
@ -468,7 +480,7 @@ ply_boot_client_process_pending_requests (ply_boot_client_t *client)
if (ply_list_get_length (client->requests_to_send) == 0)
{
if (client->daemon_has_reply_watch != NULL)
if (client->daemon_can_take_request_watch != NULL)
{
assert (client->loop != NULL);
@ -485,7 +497,8 @@ ply_boot_client_queue_request (ply_boot_client_t *client,
const char *request_argument,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
assert (client->loop != NULL);
@ -517,7 +530,8 @@ ply_boot_client_queue_request (ply_boot_client_t *client,
request = ply_boot_client_request_new (client, request_command,
request_argument,
handler, failed_handler, user_data);
handler, failed_handler, user_data,
nowait);
ply_list_append_data (client->requests_to_send, request);
}
}
@ -531,7 +545,7 @@ ply_boot_client_ping_daemon (ply_boot_client_t *client,
assert (client != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PING,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, false);
}
void
@ -539,12 +553,13 @@ ply_boot_client_update_daemon (ply_boot_client_t *client,
const char *status,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_UPDATE,
status, handler, failed_handler, user_data);
status, handler, failed_handler, user_data, nowait);
}
void
@ -552,13 +567,14 @@ ply_boot_client_tell_daemon_to_change_root (ply_boot_client_t *
const char *root_dir,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
assert (root_dir != NULL);
ply_boot_client_queue_request(client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_NEWROOT,
root_dir, handler, failed_handler, user_data);
root_dir, handler, failed_handler, user_data, nowait);
}
void
@ -566,13 +582,14 @@ ply_boot_client_tell_daemon_to_display_message (ply_boot_client_t
const char *message,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
assert (message != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_MESSAGE,
message, handler, failed_handler, user_data);
message, handler, failed_handler, user_data, nowait);
}
void
@ -580,26 +597,28 @@ ply_boot_client_tell_daemon_to_hide_message (ply_boot_client_t
const char *message,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
assert (message != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HIDE_MESSAGE,
message, handler, failed_handler, user_data);
message, handler, failed_handler, user_data, nowait);
}
void
ply_boot_client_tell_daemon_system_is_initialized (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
ply_boot_client_queue_request (client,
PLY_BOOT_PROTOCOL_REQUEST_TYPE_SYSTEM_INITIALIZED,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, nowait);
}
void
@ -614,7 +633,7 @@ ply_boot_client_ask_daemon_for_password (ply_boot_client_t *cli
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD,
prompt, (ply_boot_client_response_handler_t)
handler, failed_handler, user_data);
handler, failed_handler, user_data, false);
}
void
@ -627,7 +646,7 @@ ply_boot_client_ask_daemon_for_cached_passwords (ply_boot_client_t
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_CACHED_PASSWORD,
NULL, (ply_boot_client_response_handler_t)
handler, failed_handler, user_data);
handler, failed_handler, user_data, false);
}
void
@ -641,7 +660,7 @@ ply_boot_client_ask_daemon_question (ply_boot_client_t *c
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUESTION,
prompt, (ply_boot_client_response_handler_t)
handler, failed_handler, user_data);
handler, failed_handler, user_data, false);
}
void
@ -655,7 +674,7 @@ ply_boot_client_ask_daemon_to_watch_for_keystroke (ply_boot_client_t *
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE,
keys, (ply_boot_client_response_handler_t)
handler, failed_handler, user_data);
handler, failed_handler, user_data, false);
}
void
@ -663,61 +682,66 @@ ply_boot_client_ask_daemon_to_ignore_keystroke (ply_boot_client_t
const char *keys,
ply_boot_client_answer_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE_REMOVE,
keys, (ply_boot_client_response_handler_t)
handler, failed_handler, user_data);
handler, failed_handler, user_data, nowait);
}
void
ply_boot_client_tell_daemon_to_show_splash (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_SPLASH,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, nowait);
}
void
ply_boot_client_tell_daemon_to_hide_splash (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HIDE_SPLASH,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, nowait);
}
void
ply_boot_client_tell_daemon_to_deactivate (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_DEACTIVATE,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, nowait);
}
void
ply_boot_client_tell_daemon_to_reactivate (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
assert (client != NULL);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_REACTIVATE,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, nowait);
}
void
@ -725,7 +749,8 @@ ply_boot_client_tell_daemon_to_quit (ply_boot_client_t *client,
bool retain_splash,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
char arg[2] = "";
@ -733,47 +758,51 @@ ply_boot_client_tell_daemon_to_quit (ply_boot_client_t *client,
arg[0] = (char) (retain_splash != false);
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT,
arg, handler, failed_handler, user_data);
arg, handler, failed_handler, user_data, nowait);
}
void
ply_boot_client_tell_daemon_to_progress_pause (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PROGRESS_PAUSE,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, nowait);
}
void
ply_boot_client_tell_daemon_to_progress_unpause (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PROGRESS_UNPAUSE,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, nowait);
}
void
ply_boot_client_ask_daemon_has_active_vt (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HAS_ACTIVE_VT,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, nowait);
}
void
ply_boot_client_tell_daemon_about_error (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data)
void *user_data,
bool nowait)
{
ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_ERROR,
NULL, handler, failed_handler, user_data);
NULL, handler, failed_handler, user_data, nowait);
}
void

@ -57,22 +57,26 @@ void ply_boot_client_update_daemon (ply_boot_client_t *client,
const char *new_status,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_change_root (ply_boot_client_t *client,
const char *chroot_dir,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_display_message (ply_boot_client_t *client,
const char *message,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_hide_message (ply_boot_client_t *client,
const char *message,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_ask_daemon_for_password (ply_boot_client_t *client,
const char *prompt,
ply_boot_client_answer_handler_t handler,
@ -96,51 +100,62 @@ void ply_boot_client_ask_daemon_to_ignore_keystroke (ply_boot_client_t
const char *keys,
ply_boot_client_answer_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_system_is_initialized (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_show_splash (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_hide_splash (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_deactivate (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_reactivate (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_quit (ply_boot_client_t *client,
bool retain_splash,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_progress_pause (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_tell_daemon_to_progress_unpause (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_ask_daemon_has_active_vt (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
void ply_boot_client_disconnect (ply_boot_client_t *client);
void ply_boot_client_attach_to_event_loop (ply_boot_client_t *client,
ply_event_loop_t *loop);
void ply_boot_client_tell_daemon_about_error (ply_boot_client_t *client,
ply_boot_client_response_handler_t handler,
ply_boot_client_response_handler_t failed_handler,
void *user_data);
void *user_data,
bool nowait);
#endif

@ -49,6 +49,7 @@ typedef struct
ply_event_loop_t *loop;
ply_boot_client_t *client;
ply_command_parser_t *command_parser;
bool nowait;
char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE];
} state_t;
@ -299,7 +300,8 @@ on_password_answer (password_answer_state_t *answer_state,
(WEXITSTATUS (exit_status) ? on_failure : on_success),
(ply_boot_client_response_handler_t)
on_failure,
answer_state->state);
answer_state->state,
false);
}
else
ply_event_loop_exit (answer_state->state->loop, WEXITSTATUS (exit_status));
@ -333,7 +335,8 @@ on_question_answer (question_answer_state_t *answer_state,
on_success,
(ply_boot_client_response_handler_t)
on_failure,
answer_state->state);
answer_state->state,
false);
else
ply_event_loop_exit (answer_state->state->loop, 0);
}
@ -345,7 +348,8 @@ on_question_answer (question_answer_state_t *answer_state,
on_failure,
(ply_boot_client_response_handler_t)
on_failure,
answer_state->state);
answer_state->state,
false);
else
ply_event_loop_exit (answer_state->state->loop, 1);
}
@ -520,7 +524,8 @@ on_password_request (state_t *state,
on_password_request_execute,
(ply_boot_client_response_handler_t)
on_password_answer_failure,
password_answer_state);
password_answer_state,
false);
}
else
{
@ -574,7 +579,8 @@ on_question_request (state_t *state,
on_question_request_execute,
(ply_boot_client_response_handler_t)
on_question_answer_failure,
question_answer_state);
question_answer_state,
false);
}
else
{
@ -600,7 +606,7 @@ on_display_message_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
free (text);
}
}
@ -623,7 +629,7 @@ on_hide_message_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
free (text);
}
}
@ -675,7 +681,7 @@ on_keystroke_ignore (state_t *state,
(ply_boot_client_answer_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
static void
@ -686,7 +692,7 @@ on_progress_pause_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
@ -698,7 +704,7 @@ on_progress_unpause_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
static void
@ -709,7 +715,7 @@ on_report_error_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
@ -721,7 +727,7 @@ on_deactivate_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
static void
@ -732,7 +738,7 @@ on_reactivate_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
static void
@ -752,7 +758,8 @@ on_quit_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state,
state->nowait);
}
static bool
@ -803,7 +810,7 @@ on_update_root_fs_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
@ -813,7 +820,7 @@ on_update_root_fs_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
}
@ -825,7 +832,7 @@ on_show_splash_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
static void
@ -836,7 +843,7 @@ on_hide_splash_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
static void
@ -857,7 +864,7 @@ on_update_request (state_t *state,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, state);
on_failure, state, state->nowait);
}
}
@ -896,6 +903,7 @@ main (int argc,
"update", "Tell boot daemon an update about boot progress", PLY_COMMAND_OPTION_TYPE_STRING,
"details", "Tell boot daemon there were errors during boot", PLY_COMMAND_OPTION_TYPE_FLAG,
"wait", "Wait for boot daemon to quit", PLY_COMMAND_OPTION_TYPE_FLAG,
"nowait", "Don't wait for boot daemon to reply", PLY_COMMAND_OPTION_TYPE_FLAG,
NULL);
ply_command_parser_add_command (state.command_parser,
@ -1052,6 +1060,7 @@ main (int argc,
"ignore-keystroke", &ignore_keystroke,
"update", &status,
"wait", &should_wait,
"nowait", &state.nowait,
"details", &report_error,
NULL);
@ -1117,20 +1126,20 @@ main (int argc,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, &state);
on_failure, &state, state.nowait);
else if (should_hide_splash)
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);
on_failure, &state, state.nowait);
else if (should_quit)
ply_boot_client_tell_daemon_to_quit (state.client,
false,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, &state);
on_failure, &state, state.nowait);
else if (should_ping)
ply_boot_client_ping_daemon (state.client,
(ply_boot_client_response_handler_t)
@ -1142,13 +1151,13 @@ main (int argc,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, &state);
on_failure, &state, state.nowait);
else 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);
on_failure, &state, state.nowait);
else if (should_ask_for_password)
{
password_answer_state_t answer_state = { 0 };
@ -1169,20 +1178,20 @@ main (int argc,
(ply_boot_client_answer_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, &state);
on_failure, &state, state.nowait);
}
else if (should_sysinit)
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);
on_failure, &state, state.nowait);
else if (chroot_dir)
ply_boot_client_tell_daemon_to_change_root (state.client, chroot_dir,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, &state);
on_failure, &state, state.nowait);
else if (should_wait)
{} // Do nothing
@ -1191,7 +1200,7 @@ main (int argc,
(ply_boot_client_response_handler_t)
on_success,
(ply_boot_client_response_handler_t)
on_failure, &state);
on_failure, &state, state.nowait);
exit_code = ply_event_loop_run (state.loop);

Loading…
Cancel
Save