[ Not need to cc, I joined the list ]
On Wed, 28 Jun 2006 00:36:10 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:
> I guess that having s2ram and s2disk makes sense. Not sure about
> s2both, I hate hardlink tricks... but I guess we can do that.
They're actually symlink, but I guess you hate those too;)
> If anyone has any objections, please let me know.
...
> > I will use more spaces next time, I promise;) Or do you want me to
> > redo the patch?
>
> Yes, please.
OK, I added the spaces, I hope my MUA will refrain from breaking the
lines, well here goes:
diff -ur suspend-0.2/config.h trunk/config.h
--- suspend-0.2/config.h 2006-02-14 23:16:34.000000000 +0100
+++ trunk/config.h 2006-06-26 21:54:37.000000000 +0200
@@ -26,4 +26,5 @@
struct config_par *parv,
char *special);
#define CONFIG_FILE "/etc/suspend.conf"
+#define S2BOTH_NAME "s2both"
diff -ur suspend-0.2/Makefile trunk/Makefile
--- suspend-0.2/Makefile 2006-05-01 12:40:21.000000000 +0200
+++ trunk/Makefile 2006-06-27 10:39:42.000000000 +0200
@@ -20,10 +20,14 @@
RESUME_DEVICE=<path_to_resume_device_file>
BOOT_DIR=/boot
+S2BOTH=s2both
+S2DISK=s2disk
+CONFIGFILE=uswsusp.conf
+
ifdef CONFIG_ENCRYPT
-all: suspend suspend-keygen resume s2ram
+all: $(S2DISK) suspend-keygen resume s2ram
else
-all: suspend resume s2ram
+all: $(S2DISK) resume s2ram
endif
S2RAMOBJ=vt.o vbetool/lrmi.o vbetool/x86-common.o vbetool/vbetool.o
radeontool.o dmidecode.o
@@ -35,7 +39,7 @@
SPLASHOBJ = splash.o bootsplash.o
clean:
- rm -f suspend suspend-keygen suspend.keys resume s2ram *.o vbetool/*.o
vbetool/x86emu/*.o vbetool/x86emu/*.a
+ rm -f $(S2DISK) suspend-keygen suspend.keys resume s2ram *.o
vbetool/*.o vbetool/x86emu/*.o vbetool/x86emu/*.a
s2ram: s2ram.c dmidecode.c whitelist.c radeontool.c $(S2RAMOBJ)
$(CC) -g -Wall -O2 s2ram.c $(S2RAMOBJ) -lpci -o s2ram
@@ -79,8 +83,8 @@
splash.o: splash.h splash.c bootsplash.o vt.o
$(CC) -g -Wall $(CC_FLAGS) -c splash.c -o splash.o
-suspend: 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 suspend $(S2RAMOBJ) $(SPLASHOBJ) $(LD_FLAGS) -lpci
+$(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)
+ $(CC) -g -O2 -DCONFIG_BOTH -Wall $(CC_FLAGS) md5.o encrypt.o config.o
suspend.c s2ram.c -o $@ $(S2RAMOBJ) $(SPLASHOBJ) $(LD_FLAGS) -lpci
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)
@@ -89,20 +93,24 @@
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: suspend suspend-keygen conf/suspend.conf
- if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
- install --mode=755 suspend-keygen $(SUSPEND_DIR)
- install --mode=755 suspend $(SUSPEND_DIR)
- install --mode=644 conf/suspend.conf $(CONFIG_DIR)
+install-suspend: $(S2DISK) 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=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)
+ install --mode=755 s2ram $(DESTDIR)$(SUSPEND_DIR)
+ (cd $(DESTDIR)$(SUSPEND_DIR); ln -s $(S2DISK) $(S2BOTH))
else
-install-suspend: suspend conf/suspend.conf
- if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
- install --mode=755 suspend $(SUSPEND_DIR)
- install --mode=644 conf/suspend.conf $(CONFIG_DIR)
+install-suspend: $(S2DISK) conf/$(CONFIGFILE)
+ if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
+ install --mode=755 $(S2DISK) $(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/suspend.conf
- BOOT_DIR=$(BOOT_DIR) ./scripts/create-resume-initrd.sh $(RESUME_DEVICE)
+install-resume-initrd: resume conf/$(CONFIGFILE)
+ BOOT_DIR=$(DESTDIR)$(BOOT_DIR) ./scripts/create-resume-initrd.sh
$(RESUME_DEVICE)
install-resume: resume
./scripts/install-resume.sh
diff -ur suspend-0.2/resume.c trunk/resume.c
--- suspend-0.2/resume.c 2006-05-01 12:40:21.000000000 +0200
+++ trunk/resume.c 2006-06-26 20:25:26.000000000 +0200
@@ -105,11 +105,6 @@
},
#endif
{
- .name = "suspend to both",
- .fmt = "%c",
- .ptr = NULL,
- },
- {
.name = "early writeout",
.fmt = "%c",
.ptr = NULL,
diff -ur suspend-0.2/suspend.c trunk/suspend.c
--- suspend-0.2/suspend.c 2006-05-01 12:40:21.000000000 +0200
+++ trunk/suspend.c 2006-06-26 21:54:45.000000000 +0200
@@ -118,11 +119,6 @@
},
#endif
{
- .name = "suspend to both",
- .fmt = "%c",
- .ptr = &s2ram,
- },
- {
.name = "early writeout",
.fmt = "%c",
.ptr = &early_writeout,
@@ -974,6 +970,7 @@
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
@@ -1003,8 +1000,16 @@
if (splash_param != 'y' && splash_param != 'Y')
splash_param = 0;
- if (s2ram != 'y' && s2ram != 'Y')
- s2ram = 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;
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