From: Itsuro O. <od...@us...> - 2006-03-27 00:54:01
|
Update of /cvsroot/mkdump/minikpatch/2.0/debian/2.6.8/init In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11772 Modified Files: minik_dump.c Log Message: add reboot parameter Index: minik_dump.c =================================================================== RCS file: /cvsroot/mkdump/minikpatch/2.0/debian/2.6.8/init/minik_dump.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** minik_dump.c 9 Dec 2005 12:56:17 -0000 1.3 --- minik_dump.c 27 Mar 2006 00:53:51 -0000 1.4 *************** *** 78,85 **** __setup("dump_pfn=", set_dump_pfn); /* * I/O stuff * ! * Mini dump kernel does not use filesystem layer but uses bio layer directory. * So the dump device must be a block device. */ --- 78,108 ---- __setup("dump_pfn=", set_dump_pfn); + #define MKDUMP_REBOOT 0 + #define MKDUMP_HALT 1 + #define MKDUMP_POWER_OFF 2 + static int mkdump_reboot = MKDUMP_REBOOT; + static int __init set_mkdump_reboot(char *str) + { + if (!strcmp(str, "halt")) { + mkdump_reboot = MKDUMP_HALT; + } else if (!strcmp(str, "poweroff")) { + mkdump_reboot = MKDUMP_POWER_OFF; + } /* else/default: MKDUMP_REBOOT */ + return 1; + } + __setup("mkdump_reboot=", set_mkdump_reboot); + + static int dump_delay = 5; + static int __init set_dump_delay(char *str) + { + get_option(&str, &dump_delay); + return 1; + } + __setup("dump_delay=", set_dump_delay); + /* * I/O stuff * ! * Mini dump kernel does not use filesystem layer but uses bio layer directly. * So the dump device must be a block device. */ *************** *** 95,102 **** static struct io_buff io_buff_array[MINI_DUMP_BUFF_NUM]; static struct io_buff *io_buff_head; /* Linked by 'next'. */ ! static spinlock_t io_buff_lock = SPIN_LOCK_UNLOCKED; /* For 'io_buff_head' and any '->next's. */ static struct block_device *bdev; #ifdef FIX_MKDUMP ! static spinlock_t fix_mkdump_lock = SPIN_LOCK_UNLOCKED; /* For 'FIX_MKDUMP'. */ #endif /* FIX_MKDUMP */ --- 118,125 ---- static struct io_buff io_buff_array[MINI_DUMP_BUFF_NUM]; static struct io_buff *io_buff_head; /* Linked by 'next'. */ ! static spinlock_t io_buff_lock = SPIN_LOCK_UNLOCKED; /* For 'io_buff_head' and any '->next's. */ static struct block_device *bdev; #ifdef FIX_MKDUMP ! static spinlock_t fix_mkdump_lock = SPIN_LOCK_UNLOCKED; /* For 'FIX_MKDUMP'. */ #endif /* FIX_MKDUMP */ *************** *** 309,312 **** --- 332,341 ---- } + if (dump_delay >= 0) { + /* wait for a while to bring up necessary driver */ + set_current_state(TASK_INTERRUPTIBLE); + schedule_timeout(dump_delay * HZ); + } + printk("Dump start. dump device = 0x%lx\n", (unsigned long)dump_dev); *************** *** 369,373 **** reboot: - printk("Preparing for the system reboot...\n"); /* FIXME: Give some delay before device_shutdown() otherwise it may lock on: * Freeing unused kernel memory: 440k freed --- 398,401 ---- *************** *** 375,383 **** * input: AT Translated Set 2 keyboard on isa0060/serio0 */ ! mdelay(5000); ! system_state = SYSTEM_RESTART; ! device_shutdown(); ! printk("System reboot.\n"); ! mdelay(2000); /* Show the messages above for a while. */ ! machine_restart(NULL); } --- 403,437 ---- * input: AT Translated Set 2 keyboard on isa0060/serio0 */ ! switch (mkdump_reboot) { ! case MKDUMP_REBOOT: ! printk("Preparing for the system reboot...\n"); ! mdelay(3000); ! system_state = SYSTEM_RESTART; ! device_shutdown(); ! printk("System reboot.\n"); ! mdelay(2000); /* Show the messages above for a while. */ ! machine_restart(NULL); ! break; ! case MKDUMP_HALT: ! printk("Preparing for the system halt...\n"); ! mdelay(3000); ! system_state = SYSTEM_HALT; ! device_shutdown(); ! printk("System halted.\n"); ! machine_halt(); ! break; ! case MKDUMP_POWER_OFF: ! printk("Preparing for the power down...\n"); ! mdelay(3000); ! system_state = SYSTEM_POWER_OFF; ! device_shutdown(); ! printk("Power down.\n"); ! mdelay(2000); /* Show the messages above for a while. */ ! machine_power_off(); ! break; ! } ! ! while (1) { ! cpu_relax(); ! } } |