From b8fe5265b23376de2a40a58101188f88c0281626 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sat, 23 Mar 2013 12:30:20 +0000 Subject: do not reinvent kernel constants --- mdk-stage1/init.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'mdk-stage1/init.c') diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c index af6aefd2a..3f912c2ac 100644 --- a/mdk-stage1/init.c +++ b/mdk-stage1/init.c @@ -36,19 +36,12 @@ #include #include #include +#include #include #define syslog(...) syscall(__NR_syslog, __VA_ARGS__) -#define LINUX_REBOOT_MAGIC1 0xfee1dead -#define LINUX_REBOOT_MAGIC2 672274793 -#define BMAGIC_HARD 0x89ABCDEF -#define BMAGIC_SOFT 0 -#define BMAGIC_REBOOT 0x01234567 -#define BMAGIC_HALT 0xCDEF0123 -#define BMAGIC_POWEROFF 0x4321FEDC - -static unsigned int reboot_magic = BMAGIC_REBOOT; +static unsigned int reboot_magic = LINUX_REBOOT_CMD_RESTART; static inline long reboot(unsigned int command) { @@ -379,7 +372,7 @@ int in_reboot(void) int i = read(fd, buf, sizeof(buf)); close(fd); if (strstr(buf, "halt")) - reboot_magic = BMAGIC_POWEROFF; + reboot_magic = LINUX_REBOOT_CMD_POWER_OFF; return i > 0; } return 0; @@ -492,7 +485,7 @@ int main(int argc, char **argv) } while (WIFEXITED(wait_status) && WEXITSTATUS(wait_status) == exit_value_restart); /* allow Ctrl Alt Del to reboot */ - reboot(BMAGIC_HARD); + reboot(LINUX_REBOOT_CMD_CAD_ON); if (in_reboot()) { // any exitcode is valid if we're in_reboot @@ -540,7 +533,7 @@ int main(int argc, char **argv) sync(); sync(); if (!abnormal_termination) { - if (reboot_magic == BMAGIC_REBOOT) { + if (reboot_magic == LINUX_REBOOT_CMD_RESTART) { #ifdef DEBUG printf("automatic reboot in 10 seconds\n"); sleep(10); -- cgit v1.2.1