Re: [RFC PATCH 26/35] Add Xen subarch reboot support

Arjan van de Ven
2006-03-22T08:40:40Z

On Tue, 2006-03-21 at 22:31 -0800, Chris Wright wrote:
> +
> +#ifdef CONFIG_XEN_XENBUS
> +/* Ignore multiple shutdown requests. */
> +static int shutting_down = SHUTDOWN_INVALID;
> +static void __shutdown_handler(void *unused);
> +static DECLARE_WORK(shutdown_work, __shutdown_handler, NULL);
> +#endif
> +
> +#ifdef CONFIG_XEN_XENBUS

eh why the re-ifdef

> +static int shutdown_process(void *__unused)
> +{
> + static char *envp[] = { "HOME=/", "TERM=linux",
> + "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
> + static char *restart_argv[] = { "/sbin/reboot", NULL };
> + static char *poweroff_argv[] = { "/sbin/poweroff", NULL };
> +
> + extern asmlinkage long sys_reboot(int magic1, int magic2,
> + unsigned int cmd, void *arg);
> +
> + daemonize("shutdown");
> +
> + switch (shutting_down) {
> + case SHUTDOWN_POWEROFF:
> + case SHUTDOWN_HALT:
> + if (execve("/sbin/poweroff", poweroff_argv, envp) < 0) {
> + sys_reboot(LINUX_REBOOT_MAGIC1,
> + LINUX_REBOOT_MAGIC2,
> + LINUX_REBOOT_CMD_POWER_OFF,
> + NULL);
> + }
> + break;
> +
> + case SHUTDOWN_REBOOT:
> + if (execve("/sbin/reboot", restart_argv, envp) < 0) {
> + sys_reboot(LINUX_REBOOT_MAGIC1,
> + LINUX_REBOOT_MAGIC2,
> + LINUX_REBOOT_CMD_RESTART,
> + NULL);
> + }
> + break;
> + }
> +
> + shutting_down = SHUTDOWN_INVALID; /* could try again */
> +
> + return 0;
> +}

how is this function different from the generic one? If not, why aren't
you using the generic one?

> +static struct notifier_block xenstore_notifier;

what is this for? It's not exported and hardly used...