From: Andrew Morton <akpm@osdl.org>
To: B.Zolnierkiewicz@elka.pw.edu.pl, rene.herman@keyaccess.nl,
torvalds@osdl.org, linux-kernel@vger.kernel.org,
arjanv@redhat.com
Subject: Re: Linux 2.6.6 "IDE cache-flush at shutdown fixes"
Date: Mon, 10 May 2004 22:17:29 -0700 [thread overview]
Message-ID: <20040510221729.3b8e93da.akpm@osdl.org> (raw)
In-Reply-To: <20040510215626.6a5552f2.akpm@osdl.org>
Andrew Morton <akpm@osdl.org> wrote:
>
> 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.
25-akpm/include/linux/kernel.h | 11 +++++++----
25-akpm/init/main.c | 3 ++-
25-akpm/kernel/sys.c | 8 ++++----
3 files changed, 13 insertions(+), 9 deletions(-)
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 init/main.c~system-state-splitup init/main.c
--- 25/init/main.c~system-state-splitup 2004-05-10 22:05:15.128191704 -0700
+++ 25-akpm/init/main.c 2004-05-10 22:05:15.135190640 -0700
@@ -95,7 +95,8 @@ extern void prepare_namespace(void);
extern void tc_init(void);
#endif
-int system_state; /* SYSTEM_BOOTING/RUNNING/SHUTDOWN */
+enum system_states system_state;
+EXPORT_SYMBOL(system_state);
/*
* Boot command-line arguments
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);
@@ -467,7 +467,7 @@ asmlinkage long sys_reboot(int magic1, i
case LINUX_REBOOT_CMD_HALT:
notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL);
- system_state = SYSTEM_SHUTDOWN;
+ system_state = SYSTEM_HALT;
device_shutdown();
printk(KERN_EMERG "System halted.\n");
machine_halt();
@@ -477,7 +477,7 @@ asmlinkage long sys_reboot(int magic1, i
case LINUX_REBOOT_CMD_POWER_OFF:
notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL);
- system_state = SYSTEM_SHUTDOWN;
+ system_state = SYSTEM_POWER_OFF;
device_shutdown();
printk(KERN_EMERG "Power down.\n");
machine_power_off();
@@ -493,7 +493,7 @@ asmlinkage long sys_reboot(int magic1, i
buffer[sizeof(buffer) - 1] = '\0';
notifier_call_chain(&reboot_notifier_list, SYS_RESTART, buffer);
- system_state = SYSTEM_SHUTDOWN;
+ system_state = SYSTEM_RESTART;
device_shutdown();
printk(KERN_EMERG "Restarting system with command '%s'.\n", buffer);
machine_restart(buffer);
_
next prev parent reply other threads:[~2004-05-11 5:18 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-10 9:20 Rene Herman
2004-05-10 11:32 ` Gene Heskett
2004-05-10 12:04 ` Rene Herman
2004-05-10 20:28 ` Arjan van de Ven
2004-05-10 19:25 ` Bartlomiej Zolnierkiewicz
2004-05-10 21:13 ` Rene Herman
2004-05-10 21:52 ` Bartlomiej Zolnierkiewicz
2004-05-11 4:56 ` Andrew Morton
2004-05-11 5:17 ` Andrew Morton [this message]
2004-05-11 11:24 ` Rene Herman
[not found] ` <200405111537.23535.bzolnier@elka.pw.edu.pl>
[not found] ` <40A1073E.3030605@keyaccess.nl>
2004-05-11 19:06 ` Rene Herman
[not found] ` <200405120236.00085.bzolnier@elka.pw.edu.pl>
2004-05-12 14:44 ` Rene Herman
2004-05-11 21:22 ` Mike Houston
2004-05-11 22:05 ` Bill Davidsen
2004-05-14 3:26 ` Pavel Machek
2004-05-15 0:53 ` Andrew Morton
2004-05-15 0:59 ` Andrew Morton
2004-05-15 1:05 ` Bartlomiej Zolnierkiewicz
2004-05-15 5:53 ` Herbert Xu
2004-05-15 6:16 ` Andrew Morton
2004-05-17 22:13 ` Greg KH
2004-05-17 22:55 ` Andrew Morton
2004-05-14 3:25 ` Pavel Machek
2004-05-11 11:24 ` Rene Herman
2004-05-11 12:56 ` Craig Bradney
2004-05-11 15:51 ` Athanasius
2004-05-11 16:10 ` dobrev
2004-05-12 18:07 ` Bartlomiej Zolnierkiewicz
2004-05-12 18:45 ` dobrev
2004-05-13 0:24 ` Patrick Wildi
2004-05-13 9:55 ` dobrev
2004-05-10 21:59 ` Rene Herman
2004-05-10 23:36 ` Mike Houston
2004-05-14 21:49 ` scsi shutdown flush, journaled fses Tom Vier
[not found] <fa.jr282gn.1ni2t37@ifi.uio.no>
[not found] ` <fa.cmd38j8.1tgg9ro@ifi.uio.no>
2004-05-12 6:09 ` Linux 2.6.6 "IDE cache-flush at shutdown fixes" Robert Hancock
2004-05-12 18:52 ` Eric D. Mudama
2004-05-12 19:55 ` Rene Herman
2004-05-12 21:05 ` Bartlomiej Zolnierkiewicz
2004-05-12 22:27 ` Rene Herman
2004-05-12 21:28 ` Gene Heskett
2004-05-13 17:41 ` Eric D. Mudama
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040510221729.3b8e93da.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=B.Zolnierkiewicz@elka.pw.edu.pl \
--cc=arjanv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rene.herman@keyaccess.nl \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®