From: Wei Liu Date: Mon, 27 Feb 2017 17:28:17 +0000 (+0000) Subject: xl: introduce a function to get shutdown action name X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2660 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e5b54dbe517f90ab0f316ad515ca9e2e64111e8b;p=xen.git xl: introduce a function to get shutdown action name The array to map libxl_shutdown_action_to_shutdown to string is going to be moved to a dedicated file. Provide a function to do the translation so that we don't need to make the array globally visible. Signed-off-by: Wei Liu Acked-by: Ian Jackson --- diff --git a/tools/xl/xl_cmdimpl.c b/tools/xl/xl_cmdimpl.c index 86c70f5a22..d027d53a3f 100644 --- a/tools/xl/xl_cmdimpl.c +++ b/tools/xl/xl_cmdimpl.c @@ -101,6 +101,11 @@ static const char *action_on_shutdown_names[] = { [LIBXL_ACTION_ON_SHUTDOWN_SOFT_RESET] = "soft-reset", }; +static const char *get_action_on_shutdown_name(libxl_action_on_shutdown a) +{ + return action_on_shutdown_names[a]; +} + /* Optional data, in order: * 4 bytes uint32_t config file size * n bytes config file in Unix text file format @@ -2442,7 +2447,7 @@ static domain_restart_type handle_domain_death(uint32_t *r_domid, LOG("Action for shutdown reason code %d is %s", event->u.domain_shutdown.shutdown_reason, - action_on_shutdown_names[action]); + get_action_on_shutdown_name(action)); if (action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY || action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART) { char *corefile;