Re: Linux 2.6.6 "IDE cache-flush at shutdown fixes"

From: Pavel Machek
Date: Fri May 14 2004 - 19:35:39 EST


Hi!


> > It's a bit grubby, but we could easily add a fourth state to
> > `system_state': split SYSTEM_SHUTDOWN into SYSTEM_REBOOT and SYSTEM_HALT.
> > That would be a quite simple change.
>
> Like this. I checked all the SYSTEM_FOO users and none of them seem to
> care about the shutdown state at present. Easy.

Perhaps this should be parameter to device_shutdown? This is quite
ugly.

Pavel

> diff -puN include/linux/kernel.h~system-state-splitup include/linux/kernel.h
> --- 25/include/linux/kernel.h~system-state-splitup 2004-05-10 22:05:15.127191856 -0700
> +++ 25-akpm/include/linux/kernel.h 2004-05-10 22:05:15.133190944 -0700
> @@ -109,14 +109,17 @@ static inline void console_verbose(void)
> extern void bust_spinlocks(int yes);
> extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
> extern int panic_on_oops;
> -extern int system_state; /* See values below */
> extern int tainted;
> extern const char *print_tainted(void);
>
> /* Values used for system_state */
> -#define SYSTEM_BOOTING 0
> -#define SYSTEM_RUNNING 1
> -#define SYSTEM_SHUTDOWN 2
> +extern enum system_states {
> + SYSTEM_BOOTING,
> + SYSTEM_RUNNING,
> + SYSTEM_HALT,
> + SYSTEM_POWER_OFF,
> + SYSTEM_RESTART,
> +} system_state;
>
> #define TAINT_PROPRIETARY_MODULE (1<<0)
> #define TAINT_FORCED_MODULE (1<<1)
...
> diff -puN kernel/sys.c~system-state-splitup kernel/sys.c
> --- 25/kernel/sys.c~system-state-splitup 2004-05-10 22:05:15.130191400 -0700
> +++ 25-akpm/kernel/sys.c 2004-05-10 22:05:15.135190640 -0700
> @@ -451,7 +451,7 @@ asmlinkage long sys_reboot(int magic1, i
> switch (cmd) {
> case LINUX_REBOOT_CMD_RESTART:
> notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL);
> - system_state = SYSTEM_SHUTDOWN;
> + system_state = SYSTEM_RESTART;
> device_shutdown();
> printk(KERN_EMERG "Restarting system.\n");
> machine_restart(NULL);

--
When do you have heart between your knees?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/