Hi,
As stated in the subject. :-)
This will make s2disk runnable on all architectures on which the in-kernel
swsusp
is supported.
Rafael
--
Makefile | 15 ++++++++++-----
suspend.c | 29 +++++++++++++----------------
2 files changed, 23 insertions(+), 21 deletions(-)
Index: suspend/suspend.c
===================================================================
--- suspend.orig/suspend.c 2006-07-07 13:51:07.000000000 +0200
+++ suspend/suspend.c 2006-07-07 14:14:43.000000000 +0200
@@ -34,9 +34,11 @@
#include "swsusp.h"
#include "config.h"
#include "md5.h"
-#include "s2ram.h"
#include "splash.h"
#include "vt.h"
+#ifdef CONFIG_BOTH
+#include "s2ram.h"
+#endif
static char snapshot_dev_name[MAX_STR_LEN] = SNAPSHOT_DEVICE;
static char resume_dev_name[MAX_STR_LEN] = RESUME_DEVICE;
@@ -569,6 +571,7 @@ int write_image(int snapshot_fd, int res
return error;
}
+#ifdef CONFIG_BOTH
static int reset_signature(int fd)
{
int ret, error = 0;
@@ -610,6 +613,7 @@ static int reset_signature(int fd)
}
return error;
}
+#endif
static void shutdown(void)
{
@@ -667,6 +671,7 @@ int suspend_system(int snapshot_fd, int
error = write_image(snapshot_fd, resume_fd, vt_no);
if (!error) {
splash.progress(100);
+#ifdef CONFIG_BOTH
if (!s2ram) {
shutdown();
} else {
@@ -682,6 +687,9 @@ int suspend_system(int snapshot_fd, int
s2ram_resume();
goto Unfreeze;
}
+#else
+ shutdown();
+#endif
} else {
free_swap_pages(snapshot_fd);
free_snapshot(snapshot_fd);
@@ -970,7 +978,6 @@ int main(int argc, char *argv[])
int resume_fd, snapshot_fd, vt_fd, orig_vc = -1, suspend_vc = -1;
dev_t resume_dev;
int orig_loglevel, orig_swappiness, ret;
- char *our_name;
/* Make sure the 0, 1, 2 descriptors are open before opening the
* snapshot and resume devices
@@ -1000,16 +1007,6 @@ int main(int argc, char *argv[])
if (splash_param != 'y' && splash_param != 'Y')
splash_param = 0;
- if ((our_name = strrchr(argv[0], '/')) != NULL)
- our_name++;
- else
- our_name = argv[0];
-
- if (!strcmp(our_name, S2BOTH_NAME))
- s2ram = 'y';
- else
- s2ram = 0;
-
if (early_writeout != 'y' && early_writeout != 'Y')
early_writeout = 0;
@@ -1097,10 +1094,10 @@ int main(int argc, char *argv[])
splash.progress(5);
- if (s2ram) {
- /* If s2ram_prepare returns != 0, better not try to suspend to
RAM */
- s2ram = !s2ram_prepare();
- }
+#ifdef CONFIG_BOTH
+ /* If s2ram_prepare returns != 0, better not try to suspend to RAM */
+ s2ram = !s2ram_prepare();
+#endif
open_printk();
orig_loglevel = get_kernel_console_loglevel();
Index: suspend/Makefile
===================================================================
--- suspend.orig/Makefile 2006-07-07 13:42:23.000000000 +0200
+++ suspend/Makefile 2006-07-07 14:19:09.000000000 +0200
@@ -83,9 +83,14 @@ bootsplash.o: bootsplash.h bootsplash.c
splash.o: splash.h splash.c bootsplash.o vt.o
$(CC) -g -Wall $(CC_FLAGS) -c splash.c -o splash.o
-$(S2DISK): md5.o encrypt.o config.o suspend.c swsusp.h config.h encrypt.h
md5.h s2ram.c dmidecode.c whitelist.c radeontool.c $(S2RAMOBJ) $(SPLASHOBJ)
+$(S2DISK): vt.o md5.o encrypt.o config.o suspend.c swsusp.h config.h
encrypt.h md5.h $(SPLASHOBJ)
+ $(CC) -g -O2 -Wall $(CC_FLAGS) vt.o md5.o encrypt.o config.o suspend.c
-o $@ $(SPLASHOBJ) $(LD_FLAGS)
+
+$(S2BOTH): md5.o encrypt.o config.o suspend.c swsusp.h config.h encrypt.h
md5.h s2ram.c dmidecode.c whitelist.c radeontool.c $(S2RAMOBJ) $(SPLASHOBJ)
$(CC) -g -O2 -DCONFIG_BOTH -Wall $(CC_FLAGS) md5.o encrypt.o config.o
suspend.c s2ram.c -o $@ $(S2RAMOBJ) $(SPLASHOBJ) $(LD_FLAGS) -lpci
+suspend: $(S2DISK) $(S2BOTH)
+
resume: md5.o encrypt.o config.o resume.c swsusp.h config.h encrypt.h
md5.h $(SPLASHOBJ)
$(CC) -Wall $(CC_FLAGS) md5.o encrypt.o config.o vt.o resume.c
$(SPLASHOBJ) -static -o resume $(LD_FLAGS)
@@ -93,20 +98,20 @@ ifdef CONFIG_ENCRYPT
suspend-keygen: md5.o encrypt.o keygen.c encrypt.h md5.h
$(CC) -Wall -DHAVE_INTTYPES_H -DHAVE_STDINT_H -DCONFIG_ENCRYPT md5.o
keygen.c -o suspend-keygen -lcrypto
-install-suspend: $(S2DISK) suspend-keygen conf/$(CONFIGFILE)
+install-suspend: suspend suspend-keygen conf/$(CONFIGFILE)
if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
install --mode=755 suspend-keygen $(DESTDIR)$(SUSPEND_DIR)
install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
+ install --mode=755 $(S2BOTH) $(DESTDIR)$(SUSPEND_DIR)
install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)
install --mode=755 s2ram $(DESTDIR)$(SUSPEND_DIR)
- (cd $(DESTDIR)$(SUSPEND_DIR); ln -s $(S2DISK) $(S2BOTH))
else
-install-suspend: $(S2DISK) conf/$(CONFIGFILE)
+install-suspend: suspend conf/$(CONFIGFILE)
if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
+ install --mode=755 $(S2BOTH) $(DESTDIR)$(SUSPEND_DIR)
install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)
install --mode=755 s2ram $(DESTDIR)$(SUSPEND_DIR)
- (cd $(DESTDIR)$(SUSPEND_DIR); ln -s $(S2DISK) $(S2BOTH))
endif
install-resume-initrd: resume conf/$(CONFIGFILE)
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Suspend-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/suspend-devel