Make it possible to set the s2disk shutdown method in the config file.

Jason

---
 HOWTO     |    6 ++++++
 resume.c  |    5 +++++
 suspend.c |   14 +++++++++++++-
 swsusp.h  |    2 +-
 4 files changed, 25 insertions(+), 2 deletions(-)

Index: suspend/suspend.c
===================================================================
--- suspend.orig/suspend.c
+++ suspend/suspend.c
@@ -66,6 +66,8 @@
 static char s2ram;
 static char early_writeout;
 static char splash_param;
+#define SHUTDOWN_LEN   16
+static char shutdown_method[SHUTDOWN_LEN];
 
 static int suspend_swappiness = SUSPEND_SWAPPINESS;
 static struct splash splash;
@@ -140,6 +142,12 @@
                .fmt = "%c",
                .ptr = NULL,
        },
+       {
+               .name = "shutdown method",
+               .fmt = "%s",
+               .ptr = shutdown_method,
+               .len = SHUTDOWN_LEN,
+       },
 };
 
 static unsigned int page_size;
@@ -658,7 +666,11 @@
 
 static void suspend_shutdown(void)
 {
-       power_off();
+       /* todo: platform, S3 */
+       if (!strcmp(shutdown_method, "reboot"))
+               reboot();
+       else
+               power_off();
        /* Signature is on disk, it is very dangerous to continue now.
         * We'd do resume with stale caches on next boot. */
        fprintf(stderr,"Powerdown failed. That's impossible.\n");
Index: suspend/swsusp.h
===================================================================
--- suspend.orig/swsusp.h
+++ suspend/swsusp.h
@@ -170,7 +170,7 @@
 
 #define SUSPEND_SWAPPINESS     100
 
-#define GEN_PARAM      9
+#define GEN_PARAM      10
 
 #ifdef CONFIG_COMPRESS
 #define COMPRESS_PARAM 1
Index: suspend/resume.c
===================================================================
--- suspend.orig/resume.c
+++ suspend/resume.c
@@ -122,6 +122,11 @@
                .fmt = "%c",
                .ptr = &resume_pause,
        },
+       {
+               .name = "shutdown method",
+               .fmt = "%s",
+               .ptr = NULL,
+       },
 };
 
 static unsigned int page_size;
Index: suspend/HOWTO
===================================================================
--- suspend.orig/HOWTO
+++ suspend/HOWTO
@@ -279,6 +279,12 @@
 and wait for a keypress. This allows the image i/o benchmarks that are printed
 during resume to be read.
 
+If the "shutdown method" parameter is set to "reboot", the s2disk utility will
+reboot the machine rather than powering down. This is useful when testing
+repeated benchmarks, such as when checking whether "early writeout" produces a
+speedup or not for your combination of hardware, image size, and s2disk
+parameters.
+
 The "splash" parameter is used to make s2disk and/or resume use a splash system
 (when set to 'y').  Currently the bootsplash.org and splashy splash systems
 are supported. Note that for both systems your initrd or initramfs will

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to