[Suspend-devel] openssl and licence issues

2006-06-26 Thread Tim Dijkstra
Hi,

At the moment I'm making a debian package for suspend/uswsusp. Suspend
has an an option for encrypting which make use of the libssl library.
Unfortunately linking libssl into an GPL application makes the
resulting binary undistributable  (see [0] for more info.). Of course
this is not a problem for people that compile and use suspend
themselves, it is however a problem for distributions. You could
provide a license exception of course, but then you'd have to convince
all the copyright holders of vbetool, radeontool, lrmi, s2ram, etc.

Is there any reason you didn't use gnutls (GPLed alternative to
libssl)? Would you accept patches if I try to port it to gnutls (no
guarantees;)?

Thanks for this nice software suspend implementation btw!

grts Tim

[0] http://www.gnome.org/~markmc/openssl-and-the-gpl.html


signature.asc
Description: PGP signature
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] s2both and s2disk

2006-06-27 Thread Tim Dijkstra
Hi all,

While packaging suspend I ran in a few design problems, which I solved
(IMHO) in an elegant way.

First the fact that if you want to both suspend-to-disk and
suspend-to-both in a regular basis you need to config files which
are identical except for a line 'suspend to both ='.
This is not nice because the user has two keep these files in sync,
which can cause dataloss if per accident the suspend.conf file on the
initramfs has a different swap-partition then one of the config files
(OK, changes are slim, but still).

Second, suspend is not a good name for a binary. Because (as other
people have brought up already) suspend is a build in command in bash.
Also it is a bit generic, the rest of the world seems to agree that
suspend (without any additional info) == s2ram. 

So I propose to switch behavior of the binary on the name it is called
by. So if you call

/usr/sbin/s2both

It will suspend to ram after saving state to disk if called as. 

/usr/sbin/s2disk (and any other name, as a matter of fact)

It will simply power off. 

So know we have s2disk, s2ram and s2both. Isn't that nice and
consistent;)?

I attached a patch that does just that. To avoid confusion it also
removes the s2ram configuration option. Oh, the patch also includes
some additional changes to the Makefile to make installation by
distributions easier (by setting DESTDIR).

grts Tim


s2both.patch
Description: Binary data
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] whitelist entries

2006-06-27 Thread Tim Dijkstra
Hi,

I added my machines to the whitelist.c. One is a desktop system, 's2ram
-n' only identifies it with the bios version. Also the work around is
likely to be only necessary because of the video card (nvidia riva tnt)
I use, isn't it? So I don't know if it is wise to add it. Seems like a
deficiency in the way s2ram tries to match the system to me... Shouldn't
it also look at the graphics card?

patch attached.

grts Tim


whitelist.patch
Description: Binary data
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] s2both and s2disk

2006-06-27 Thread Tim Dijkstra
On Tue, 27 Jun 2006 21:08:32 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > While packaging suspend I ran in a few design problems, which I
> > solved (IMHO) in an elegant way.
> > 
> > First the fact that if you want to both suspend-to-disk and
> > suspend-to-both in a regular basis you need to config files which
> > are identical except for a line 'suspend to both ='.
> 
> Why? You just add -b command line option.

There is no such option at the moment, could add it of course. But
s2both/s2disk solution seems nicer to me, but that's just me of
course...

grts Tim


signature.asc
Description: PGP signature
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] s2both and s2disk

2006-06-27 Thread Tim Dijkstra
[ Not need to cc, I joined the list ]

On Tue, 27 Jun 2006 21:22:40 +0200
Luca <[EMAIL PROTECTED]> wrote:

> Il Tue, Jun 27, 2006 at 01:11:23PM +0200, Tim Dijkstra ha scritto: 
> > Second, suspend is not a good name for a binary. Because (as other
> > people have brought up already) suspend is a build in command in
> > bash.
> 
> This was rasied a few days ago, it was decided to change name after
> 0.2.

OK, that's nice, didn't know that.

> > 
> > I attached a patch that does just that.
> 
> Please, put the patch inline for easier review.

Will do that next time ;)
 
> > diff -ur suspend-0.2/Makefile trunk/Makefile
> > --- suspend-0.2/Makefile2006-05-01 12:40:21.0 +0200
> > +++ trunk/Makefile  2006-06-27 10:39:42.0 +0200
> > @@ -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) $(S2BOTH) suspend-keygen suspend.keys
> > resume s2ram *.o vbetool/*.o vbetool/x86emu/*.o vbetool/x86emu/*.a
> 
> We build an object called s2disk, s2both is just a symlink done by
> 'install', it's not present in the source dir.

Right, I made the link during my tests, not anymore. Well spotted...


> Coding style:
..

> Same here.
..
 
> These minor issues aside I like the idea :)

I will use more spaces next time, I promise;) Or do you want me to redo
the patch? 

grts Tim


signature.asc
Description: PGP signature
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] s2both and s2disk

2006-06-28 Thread Tim Dijkstra
[ 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.h2006-02-14 23:16:34.0 +0100
+++ trunk/config.h  2006-06-26 21:54:37.0 +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/Makefile2006-05-01 12:40:21.0 +0200
+++ trunk/Makefile  2006-06-27 10:39:42.0 +0200
@@ -20,10 +20,14 @@
 RESUME_DEVICE=
 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.c2006-05-01 12:40:21.0 +0200
+++ trunk/resume.c  2006-06-26 20:25:26.0 +0200
@@ -105,11 +105,6 @@
   

Re: [Suspend-devel] whitelist entries

2006-06-28 Thread Tim Dijkstra
On Wed, 28 Jun 2006 00:29:13 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > I added my machines to the whitelist.c. One is a desktop system,
> > 's2ram -n' only identifies it with the bios version. Also the work
> > around is likely to be only necessary because of the video card
> > (nvidia riva tnt) I use, isn't it? So I don't know if it is wise to
> > add it. Seems like a deficiency in the way s2ram tries to match the
> > system to me... Shouldn't it also look at the graphics card?
> 
> Well, not sure here. Desktop systems should work with
> S3_MODE|S3_BIOS, because they have separate video bios...
> 
> ...actually all desktop systems without integrated video...

Then we need a way to distinguish those from the rest.
 
> ...so DMI-based whitelist _might_ do the trick by luck. Yes, it would
> be better to list by pci ids here.

But still, how would you detect if a system doesn't have integrated
video (sorry, don't know much about these thing)? 
So basically desktop systems will have to wait for the new whitelist 
system? Or do we need a way to --force s2both just like s2ram?

grts Tim

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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] s2both and s2disk

2006-06-29 Thread Tim Dijkstra
On Wed, 28 Jun 2006 21:51:08 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> On Wednesday 28 June 2006 16:10, Pavel Machek wrote:
> > Hi!
> > 
> > > [ Not need to cc, I joined the list ]
> > 
> > I'll cc you anyway; because otherwise _other_ Ccs will get lost (and
> > some people -- like me -- prefer to be cced even when they are
> > subscribed).
> > 
> > > > 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:
> > 
> > Applied, please do cvs update and check it went okay.
> 
> Appears to be OK.  I changed the configuration file name in the
> Makefile back to suspend.conf, because that's what we have in the
> conf/ directory (already committed).

Oops, that was a remnant of debian packaging, didn't mean to change 
the config file for you. For the rest it seems OK here to.

grts Tim

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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Which archs are supported?

2006-06-30 Thread Tim Dijkstra
Hi all,

As you all know by now I'm perfecting my debian package of uswsusp.
Debian currently supprts on the order of 10 archs.  In was wondering
what archs are supported by uswsusp. I guess the s2ram bit is powerpc,
i386 and amd. But for s2disk you more or less only need swap, right?

Does anybody know on what machines is it tested so far?

grts Tim

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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Which archs are supported?

2006-06-30 Thread Tim Dijkstra
On Fri, 30 Jun 2006 11:22:20 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> On Friday 30 June 2006 10:44, Tim Dijkstra wrote:
> > As you all know by now I'm perfecting my debian package of uswsusp.
> > Debian currently supprts on the order of 10 archs.  In was wondering
> > what archs are supported by uswsusp. I guess the s2ram bit is
> > powerpc, i386 and amd. But for s2disk you more or less only need
> > swap, right?
> 
> No.  You also need some low-level arch-dependent code in the kernel.
> Currently only ppc, i386 and x86_64 (Intel too ;-) ) are supported.

Just to be clear x86_64 are the amd64 and em64t processors, it doesn't include
ia-64, does it?

grts Tim

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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Which archs are supported?

2006-06-30 Thread Tim Dijkstra
On Fri, 30 Jun 2006 22:44:42 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > > > > As you all know by now I'm perfecting my debian package of
> > > > > uswsusp. Debian currently supprts on the order of 10 archs.
> > > > > In was wondering what archs are supported by uswsusp. I guess
> > > > > the s2ram bit is powerpc, i386 and amd. But for s2disk you
> > > > > more or less only need swap, right?
> > > > 
> > > > No.  You also need some low-level arch-dependent code in the
> > > > kernel. Currently only ppc, i386 and x86_64 (Intel too ;-) )
> > > > are supported.
> > > 
> > > And FRV -- AFAICT. I'm not sure what supports s2ram in kernel, but
> > > userland package currently only makes sense on i386 and x86_64. 
> > 
> > I'm thinking it may be a good idea to make s2disk and s2both
> > actually differ, so that s2disk doesn't containg the s2ram code
> > neede for s2both. In that case s2disk would be usable on anything
> > supported by the kernel.
> 
> Agreed. Someone needs to create a patch ;-).
>   Pavel

That should be as simple as making it a config option, just like
compress or encrypt. If you want to compile it on powerpc, you just
don't add that option. Maybe uswsusp could use some autotooling?

grts Tim


signature.asc
Description: PGP signature
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] initramfs generation with yaird

2006-07-03 Thread Tim Dijkstra
On Mon, 03 Jul 2006 11:46:53 -0400
Marten van Kerkwijk <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> before anything, congratulations and thanks for making this nice
> project!
> 
> But this is mostly to confirm that the patch for yaird suggested by
> Jason Lunz works well, though I had to do two fairly obvious
> additional steps:
> 
> - install resume to /usr/local/sbin
> 
> - add option "resume" to the entry for my swap partition in /etc/fstab
>   (alternatively, one has to name the resume partition explicitly in
>   /etc/yaird/Default.cfg). 
> 
> I hope this can become part of the Debian package! 

I have a debian package ready at

http://www.famdijkstra.org/~tdykstra/debian/uswsusp

(it will be uploaded soon), unfortunately for you it uses
initramfs-tools to build the initramfs. This is mostly because I use it
myself, but it also seems to become the default for debian. When I'm
back from holidays I'll take a look at yaird and see if I can provide
scripts for that too.

> For the documentation (HOWTO), it might be worth adding a paragraph
> for people who do not use initrd, but rather some version of
> initramfs; without Jason's message, I probably would not have figured
> it out.

grts Tim


signature.asc
Description: PGP signature
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Userspace splash?

2006-07-07 Thread Tim Dijkstra
Hi,

I'm trying to integrate another splash system into suspend. 
It's a userspace splash program (splashy) so it should be easier for people 
to use (no kernel patches), but 'm not really sure if it's going to work at 
all. 

Being a userspace program, is it going to be frozen? I guess it will from 
the point we call freeze(), right?
So for it to be allowed to draw on the screen till the end of the process, 
we'll have to do the drawing ourselves? Do children also get frozen?


I also have some questions about the code related to that.

First:

What is this switch_vt_mode macro used in suspend_system supposed to do? 
Whatever it is, I don't think it's doing the right thing now. My console_ioctls 
man page says if you want to set you KD_GRAPHICS or KD_TEXT you need the 
KDSETMODE ioctl, not KDSKBMOD.


#define switch_vt_mode(fd, vt, ioc1, ioc2)  ioctl(fd, KDSKBMODE, ioc1); \
ioctl(fd, VT_ACTIVATE, vt); \
ioctl(fd, VT_WAITACTIVE, vt); \
ioctl(fd, KDSKBMODE, ioc2);

int suspend_system(int snapshot_fd, int resume_fd, int vt_fd, int vt_no)
{
loff_t avail_swap;
unsigned long image_size;
int attempts, in_suspend, error = 0;

avail_swap = check_free_swap(snapshot_fd);
if (avail_swap > pref_image_size)
image_size = pref_image_size;
else
image_size = avail_swap;
if (!image_size) {
fprintf(stderr, "suspend: No swap space for suspend\n");
return ENOSPC;
}

switch_vt_mode(vt_fd, vt_no, K_MEDIUMRAW, KD_GRAPHICS);
error = freeze(snapshot_fd);
switch_vt_mode(vt_fd, vt_no, KD_TEXT, K_XLATE);

splash.switch_to();
splash.progress(15);


Is this KDSETMODE juggling also the reason to switch to splash only at this 
point?

Another question:

Is there any particular reason to splash_prepare() before console_prepare() ?
I rather have it the other way around.

Thanks for the answers.

grts Tim


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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] Fix console ioctls in suspend.c:suspend_system()

2006-07-07 Thread Tim Dijkstra
On Fri, 7 Jul 2006 13:25:20 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> Apparently we have used wrond console ioctls around freeze() in
> suspend_system() and in a wrong order.  The appended patch fixes
> this.
> 
> Comments welcome.

Just some questions. You told me this was a hack to get the user not 
to switch VTs. 

I guess the VT_ACTIVATE before the freeze is need  because we can't
be sure the user didn't switch since the last time with switched.
Is the second needed, because there is a (slim) chance they did just before 
the freeze after the first VT_ACTIVATE?

Why do we switch to KD_GRAPHIC just before freeze and KD_TEXT just after?
Shouldn't we KDGETMODE and restore that?

> 
> -- 
>  suspend.c |   15 ---
>  1 files changed, 8 insertions(+), 7 deletions(-)
> 
> Index: suspend/suspend.c
> ===
> --- suspend.orig/suspend.c
> +++ suspend/suspend.c
> @@ -620,11 +620,6 @@ static void shutdown(void)
>   while(1);
>  }
> 
> -#define switch_vt_mode(fd, vt, ioc1, ioc2)   ioctl(fd, KDSKBMODE, ioc1); \
> - ioctl(fd, VT_ACTIVATE, vt); \
> - ioctl(fd, VT_WAITACTIVE, vt); \
> - ioctl(fd, KDSKBMODE, ioc2);
> -
>  int suspend_system(int snapshot_fd, int resume_fd, int vt_fd, int vt_no)
>  {
>   loff_t avail_swap;
> @@ -641,9 +636,15 @@ int suspend_system(int snapshot_fd, int 
>   return ENOSPC;
>   }
>  
> - switch_vt_mode(vt_fd, vt_no, K_MEDIUMRAW, KD_GRAPHICS);
> + ioctl(vt_fd, KDSKBMODE, K_MEDIUMRAW);
> + ioctl(vt_fd, VT_ACTIVATE, vt_no);
> + ioctl(vt_fd, VT_WAITACTIVE, vt_no);
> + ioctl(vt_fd, KDSETMODE, KD_GRAPHICS);
>   error = freeze(snapshot_fd);
> - switch_vt_mode(vt_fd, vt_no, KD_TEXT, K_XLATE);
> + ioctl(vt_fd, KDSETMODE, KD_TEXT);
> + ioctl(vt_fd, KDSKBMODE, K_XLATE);
> + ioctl(vt_fd, VT_ACTIVATE, vt_no);
> + ioctl(vt_fd, VT_WAITACTIVE, vt_no);
>  
>   splash.switch_to();
>   splash.progress(15);

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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] Fix console ioctls in suspend.c:suspend_system()

2006-07-07 Thread Tim Dijkstra
On Fri, 7 Jul 2006 14:44:19 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> On Friday 07 July 2006 14:30, Tim Dijkstra wrote:
> > On Fri, 7 Jul 2006 13:25:20 +0200
> > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:
> > 
> > > Hi,
> > > 
> > > Apparently we have used wrond console ioctls around freeze() in
> > > suspend_system() and in a wrong order.  The appended patch fixes
> > > this.
> > > 
> > > Comments welcome.
> > 
> > Just some questions. You told me this was a hack to get the user not 
> > to switch VTs. 
> > 
> > I guess the VT_ACTIVATE before the freeze is need  because we can't
> > be sure the user didn't switch since the last time with switched.
> > Is the second needed, because there is a (slim) chance they did just before 
> > the freeze after the first VT_ACTIVATE?
> 
> It just returns to the previous state.  

Because freeze will mess with the VT state?

> I think even if the user manages to
> trigger the switch after the first VT_ACTIVATE, it won't hurt us after the 
> second
> VT_ACTIVATE, because X is now frozen and it won't take over the hardware.

> > Why do we switch to KD_GRAPHIC just before freeze and KD_TEXT just after?
> > Shouldn't we KDGETMODE and restore that?
> 
> prepare_console() is supposed to leave is in KD_TEXT.  However it's probably
> a good idea to use KDGETMODE anyway.

I did a bit of reading on this, isn't using VT_SETMODE to set VT_PROCESS 
precisely
what we want? If I read it correctly that will block all VT switching unless we 
issue the VT_RELDISP ioctl.

grts Tim

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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] Fix console ioctls in suspend.c:suspend_system()

2006-07-07 Thread Tim Dijkstra
On Fri, 7 Jul 2006 23:23:07 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> On Friday 07 July 2006 21:13, Rafael J. Wysocki wrote:
> > On Friday 07 July 2006 15:02, Tim Dijkstra wrote:
> > > On Fri, 7 Jul 2006 14:44:19 +0200
> > > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:
> > > 
> > > > On Friday 07 July 2006 14:30, Tim Dijkstra wrote:
> > > > > On Fri, 7 Jul 2006 13:25:20 +0200
> > > > > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:
> > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > Apparently we have used wrond console ioctls around
> > > > > > freeze() in suspend_system() and in a wrong order.  The
> > > > > > appended patch fixes this.
> > > > > > 
> > > > > > Comments welcome.
> > > > > 
> > > > > Just some questions. You told me this was a hack to get the
> > > > > user not to switch VTs. 
> > > > > 
> > > > > I guess the VT_ACTIVATE before the freeze is need  because we
> > > > > can't be sure the user didn't switch since the last time with
> > > > > switched. Is the second needed, because there is a (slim)
> > > > > chance they did just before the freeze after the first
> > > > > VT_ACTIVATE?
> > > > 
> > > > It just returns to the previous state.  
> > > 
> > > Because freeze will mess with the VT state?
> > 
> > It shouldn't, but generally we can't assume it never will.
> > 
> > > > I think even if the user manages to
> > > > trigger the switch after the first VT_ACTIVATE, it won't hurt
> > > > us after the second VT_ACTIVATE, because X is now frozen and it
> > > > won't take over the hardware.
> > > 
> > > > > Why do we switch to KD_GRAPHIC just before freeze and KD_TEXT
> > > > > just after? Shouldn't we KDGETMODE and restore that?
> > > > 
> > > > prepare_console() is supposed to leave is in KD_TEXT.  However
> > > > it's probably a good idea to use KDGETMODE anyway.
> > > 
> > > I did a bit of reading on this, isn't using VT_SETMODE to set
> > > VT_PROCESS precisely what we want? If I read it correctly that
> > > will block all VT switching unless we issue the VT_RELDISP ioctl.
> > 
> > Well, that should work, at least at first sight.
> 
> At the second sight, however, it looks like after VT_PROCESS the
> kernel will block switching _to_ the VT in question and not _from_
> it, and we're trying to prevent the latter from happening here.

Hmm, maybe your right. I was reading this

The "switch-from" process will need to perform any cleanup, and
issue the VT_RELDISP ioctl, telling the kernel that it is OK to
continue the switch. It is also possible for it to deny the
switch, in which case the kernel discontinues the switch.

But maybe this is only true if the _to_ process set the VT_PROCESS,
seems odd though. There should also be a way to prevent switching
from. Maybe I'll try and test this tomorrow.

grts Tim


signature.asc
Description: PGP signature
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Need #include to compile

2006-08-09 Thread Tim Dijkstra
Hi,

With the libc6-dev in current debian sid, I need to include 
to compile. Else gcc will complain

swsusp.h:141: error: "SYNC_FILE_RANGE_WRITE" undeclared

This problem was hidden by the fact that that constant is defined
in swsusp.h if SYS_sync_file_range was not, which wasn't defined  
in older version of libc6.

#ifndef SYS_sync_file_range
 #ifdef __i386__
  #define SYS_sync_file_range   314
 #endif
 #ifdef __x86_64__
  #define SYS_sync_file_range   277
 #endif
 #define SYNC_FILE_RANGE_WRITE  2
#endif


--- trunk/suspend-0.2/swsusp.h  2006-08-09 11:25:06.0 +0200
+++ suspend-cvs/swsusp.h2006-08-08 13:50:19.0 +0200
@@ -10,7 +10,6 @@
  */
  
 #include 
-#include 
  
 #include "encrypt.h"
  

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] s2disk: potential problems with HPA (host protected area)

2006-08-09 Thread Tim Dijkstra
Hi,

I got a bug report in the debian BTS which is beyond my knowledge. 
Could one of you shed some light on the issue?

Thanks,

Tim


Forwarded message:

Machine: IBM Thinkpad R50p

I recognized following issues concerning s2ram/s2disk/s2both:

  - calling s2ram works fine, resuming from RAM works
  - after having resumed and calling s2disk the machine hangs with 
heavy HD load
  - it's not possible to terminate or kill any process with SysRq+E/I
  - following messgages appears again and again if SysRq+E is pressed:

  hda: task_out_intr: status=0x51 { DriveReady SeekComplete Error }
  hda: task_out_intr: status=0x10 { SectorIdNotFound }, \ 
  LBAsect=110561486, sector=110561486
  hda: failed opcode was: unknown

  where 'LBAsect' and 'sector' will have values above 1100 each 
  time the behaviour is reproduced

After having disabled the so called "IBM Predesktop Area" in the BIOS
everything works (in the BIOS setup: Security -> IBM Predesktop Area ->
Current Setting: Disabled).
As far as I know this IBM Predesktop Area is located in a HPA.
I'm not sure, if this is really a bug (and if so, if it is related to
uswsusp).
Hope anyone will find out.

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] s2disk: potential problems with HPA (host protected area)

2006-08-11 Thread Tim Dijkstra
On Wed, 9 Aug 2006 17:13:47 +0200
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> It is not related to uswsusp, it is related to suspend to ram. The kernel
> disables the HPA on boot. The harddrive is power cycled during suspend to
> RAM. After resume, HPA is not disabled again. => boom.

OK, so the kernel needs to disable HPA on resume to.
 
> You can verify this with:
> - "hdparm -I /dev/hda > /tmp/identify-before"
> - s2ram
> - "hdparm -I /dev/hda > /tmp/identify-after"
> 
> then diff identify-before and identify-after, the disk will report different
> sizes.
> 
> Unfortunately, once the Predesktop Area was disabled, you cannot reenable
> it, so the bug is only reproducible until the "fix" with disabling the hpa
> is made.

So Daniel won't be able to reproduce this anymore... is that correct Daniel?

> I will have a novell bugzilla report number about this soon.

Does this mean you (stefan) are going to make sure this gets fixed in the 
kernel?

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] s2disk: potential problems with HPA (host protected area)

2006-08-11 Thread Tim Dijkstra
On Fri, 11 Aug 2006 12:04:14 +0200
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> On Fri, Aug 11, 2006 at 11:50:50AM +0200, Tim Dijkstra wrote:
> > On Wed, 9 Aug 2006 17:13:47 +0200
> > Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> > > I will have a novell bugzilla report number about this soon.
> 
> https://bugzilla.novell.com/show_bug.cgi?id=198401 BTW.
>  
> > Does this mean you (stefan) are going to make sure this gets fixed in the 
> > kernel?
> 
> Unfortunately not, but i will try to poke somebody to get them to get 
> somebody to fix it. :-)

Well, that's good enough for me;)

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Splash support

2006-08-28 Thread Tim Dijkstra
Hi,

As I announced a long time ago, I'm trying to get uswsusp to work with
splashy. I've been working on getting splashy to expose a nice library
interface which uswsusp can hook into. It is now more or less working,
but before I produce a patch I have a few questions.

The splash stucture as it is defined now, has a few functions of which
don't quite understand the meaning:

splash->switch_to
splash->to_silent
splash->to_verbose

Am I correct to say that that to_silent/to_verbose are meant to make
bootsplash drop in a mode where a user can provide some interaction?

resume.c:
splash.to_verbose();
encrypt_init(key, ivec, buffer, 0);
splash.to_silent();

If that's true, than I think that could be changed in suspend.c too:

suspend.c
chvt(vt_no);
encrypt_init(key_data->key, key_data->ivec, handle.write_buffer, 1);
splash.switch_to();

Then there's one more call of switch_to, namely just after freeze

suspend.c
error = freeze(snapshot_fd);
.
.
splash->switch_to();


which IIRC was to workaround a bug in bootsplash, right?


Thanks for any comments,

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Fw: Does not properly resume from S3 with kernel 2.6.17

2006-08-28 Thread Tim Dijkstra
Hi,

Christian can't get s2ram to work to work with a 2.6.17 kernel, although
it is in the whitelist. It used to work with 2.6.16. Do you now of any
regressions? 
Could anybody give him a hand in trying to get it to work again?

In the mean time I asked him to try with minimal number modules loaded.

Thanks,

Tim

Begin forwarded message:

Date: Sat, 19 Aug 2006 08:15:27 -0500
From: Christian Perrier <[EMAIL PROTECTED]>
Subject: Does not properly exit sleep mode with kernel 2.6.17

When used on my laptop with kernel 2.6.17, s2ram never properly exits
sleep mode while it works well with 2.6.16 kernels (both are stock
Debian kernels: linux-image-2.6.16-2-686 version 2.6.16-17 and
linux-image-2.6.17-1-686 version 2.6.17-5).

[EMAIL PROTECTED]:~> s2ram -n
Machine matched entry 88:
sys_vendor   = 'Dell Inc.'
sys_product  = 'Latitude X1*'
sys_version  = ''
bios_version = ''
Fixes: 0x2c  VBE_SAVE VBE_POST
Machine is in the whitelist but perhaps using vbetool unnecessarily.
Please try to find minimal options.

This machine can be identified by:
sys_vendor   = "Dell Inc."
sys_product  = "Latitude X1 "
sys_version  = ""
bios_version = "A03"
See http://en.opensuse.org/S2ram for details.


> Does the the screen just stay black, but for the rest it is OK? Can you
> still ssh into your machine?

I finally have been able to check this. The machine is really locked
down. No more accessible by network and screen is black.

OK, I narrowed the problem a little. Even though I don't know whether
the machine is still alive because I can't try ssh'ing to it right now
(being in a plane), I can confirm that the screen just stays
black. No matter, indeed, whether I launch s2ram from X or from a
virtual console.

Doing the very same with a 2.6.16 kernel gives a quite classical
result: the screen flashes slightly (probably the VBESAVE stuff), then
comes back to life with minimal backlight-->I indeed have to use the
screen light key of the laptop to bring it to life

With 2.6.17, this "flash" never happens and the screen just sits
there, completely black.

 
> If that's not the case and it locks hard, you can try to unload some
> modules first; the usb and ieee1394 modules for example.


I tried unloading all the ieee1394 stuff and as much USB stuff as
possible but it didn't give much results.

lsmod output (before any unloading):

Kernel 2.6.16:
Module  Size  Used by
i915   17536  1 
drm61972  2 i915
ipw2200   100844  0 
ipv6  217760  8 
xfs   482676  7 
exportfs5024  1 xfs
dm_snapshot15324  0 
dm_mirror  17236  0 
dm_mod 47892  2 dm_snapshot,dm_mirror
battery 9252  0 
ac  4612  0 
button  6320  0 
fan 4452  0 
thermal12968  0 
cpufreq_userspace   3732  0 
cpufreq_conservative 6180  1 
cpufreq_ondemand5468  0 
cpufreq_stats   3844  0 
speedstep_centrino  6712  1 
freq_table  4196  2 cpufreq_stats,speedstep_centrino
processor  21696  2 thermal,speedstep_centrino
joydev  8864  0 
tsdev   7200  0 
eth139417924  0 
snd_intel8x0   29436  0 
ehci_hcd   26856  0 
uhci_hcd   26640  0 
snd_ac97_codec 82784  1 snd_intel8x0
snd_ac97_bus2048  1 snd_ac97_codec
snd_pcm_oss43520  0 
snd_mixer_oss  15584  1 snd_pcm_oss
psmouse34248  0 
i2c_i8017884  0 
snd_pcm74408  3 snd_intel8x0,snd_ac97_codec,snd_pcm_oss
snd_timer  20292  1 snd_pcm
pcspkr  2948  0 
serio_raw   6436  0 
yenta_socket   23660  0 
rsrc_nonstatic 11840  1 yenta_socket
pcmcia_core37264  2 yenta_socket,rsrc_nonstatic
ieee80211  27368  1 ipw2200
ieee80211_crypt 5312  1 ieee80211
intel_agp  20860  1 
usbcore   110560  3 ehci_hcd,uhci_hcd
snd46080  6 
snd_intel8x0,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer
soundcore   8672  1 snd
i2c_core   19312  1 i2c_i801
snd_page_alloc  9800  2 snd_intel8x0,snd_pcm
ohci1394   29328  0 
ieee1394   85560  2 eth1394,ohci1394
agpgart29232  3 drm,intel_agp
firmware_class  9472  1 ipw2200
rtc11252  0 
ext3  115880  1 
jbd46932  1 ext3
mbcache 7652  1 ext3
ide_disk   14528  10 
generic 4164  0 [permanent]
piix8932  0 [permanent]
ide_core  111440  3 ide_disk,generic,piix
evdev   8736  1 
mousedev   10368  1 



---

Re: [Suspend-devel] Splash support

2006-08-28 Thread Tim Dijkstra
On Mon, 28 Aug 2006 11:28:19 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > As I announced a long time ago, I'm trying to get uswsusp to work with
> > splashy. I've been working on getting splashy to expose a nice library
> > interface which uswsusp can hook into. It is now more or less working,
> > but before I produce a patch I have a few questions.
> > 
> > The splash stucture as it is defined now, has a few functions of which
> > don't quite understand the meaning:
> > 
> > splash->switch_to
> > splash->to_silent
> > splash->to_verbose
> > 
> > Am I correct to say that that to_silent/to_verbose are meant to make
> > bootsplash drop in a mode where a user can provide some interaction?
> 
> Yes, we need password from user.
> 
> > resume.c:
> > splash.to_verbose();
> > encrypt_init(key, ivec, buffer, 0);
> > splash.to_silent();
> > 
> > If that's true, then I think that could be changed in suspend.c too:
> > 
> > suspend.c
> > chvt(vt_no);
> > encrypt_init(key_data->key, key_data->ivec, handle.write_buffer, 1);
> > splash.switch_to();
> 
> Would not this need one more virtual terminal?

We should be on our own VT since prepare_console. And why wouldn't we need
that in resume.c then?


grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] [PATCH] PARAM_NO of by one

2006-09-03 Thread Tim Dijkstra
Hi,

If I can count, than PARAM_NO is of by one;)

GEN_PARAM is defined as 8, which is correct because there is no #ifdef
SPLASH_CONFIG anymore. SPLASH_PARAM still adds one to PARAM_NO though. 

This crashes s2disk/resume when there's an error in the config file.

--- swsusp.h--  2006-09-03 20:56:35.0 +0200
+++ swsusp.h2006-09-03 20:56:58.0 +0200
@@ -183,6 +183,4 @@
 #define ENCRYPT_PARAM  0
 #endif
 
-#define SPLASH_PARAM   1
-
-#define PARAM_NO   (GEN_PARAM + COMPRESS_PARAM + ENCRYPT_PARAM + 
SPLASH_PARAM)
+#define PARAM_NO   (GEN_PARAM + COMPRESS_PARAM + ENCRYPT_PARAM)


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] PARAM_NO of by one

2006-09-03 Thread Tim Dijkstra
On Sun, 3 Sep 2006 22:49:57 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> On Sun 2006-09-03 21:06:12, Tim Dijkstra wrote:
> > Hi,
> > 
> > If I can count, than PARAM_NO is of by one;)
> > 
> > GEN_PARAM is defined as 8, which is correct because there is no
> > #ifdef SPLASH_CONFIG anymore. SPLASH_PARAM still adds one to
> > PARAM_NO though. 
> > 
> > This crashes s2disk/resume when there's an error in the config file.
> 
> Will not your patch break splash? Ugh, I do not see how param system
> works :-(.

No it will not break. SPLASH_PARAM is only used to increment PARAM_NO
by one. PARAM_NO is used to limit the loop through all options while 
parsing the config file.

grep SPLASH_PARAM suspend-cvs/*
suspend-cvs/swsusp.h:#define SPLASH_PARAM   1
suspend-cvs/swsusp.h:#define PARAM_NO   (GEN_PARAM + COMPRESS_PARAM + 
ENCRYPT_PARAM + SPLASH_PARAM)


> 
> > --- swsusp.h--  2006-09-03 20:56:35.0 +0200
> > +++ swsusp.h2006-09-03 20:56:58.0 +0200
> > @@ -183,6 +183,4 @@
> >  #define ENCRYPT_PARAM  0
> >  #endif
> >  
> > -#define SPLASH_PARAM   1
> > -
> > -#define PARAM_NO   (GEN_PARAM + COMPRESS_PARAM +
> > ENCRYPT_PARAM + SPLASH_PARAM) +#define PARAM_NO (GEN_PARAM +
> > COMPRESS_PARAM + ENCRYPT_PARAM)
> 


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Makefile cleanup

2006-09-11 Thread Tim Dijkstra
On Mon, 11 Sep 2006 11:33:52 +0200
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> I also tried to make the use and ordering of "-c" and "-o" to $(CC) a bit
> more consistent throughout the Makefile.
> 
> Any objections?


Why don't you use something like

vbetool/vbetool.o:  vbetool/vbetool.c
$(CC) $(CFLAGS) -g -c $< -o $@

Much cleaner, less typos.

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] 1/5 splashy support

2006-09-12 Thread Tim Dijkstra
Hi,

I'm sending some patches adding support for splashy
(http://splashy.alioth.debian.org). It is a bootsplash system
implemented in user space using the directfb library. The experimental
branch in svn (svn://svn.debian.org/svn/splashy/branches/0.3) now
produces a library to which uswsusp can link.

Is is a series of 5 patches, the second and the third are not directly
related to splashy support, but they are related to splash and output.

--

This moves the order of prepare_console and prepare_splash. This is
because the splash system may launch on a different console and
prepare_console will then switch away.
Also it removes the ioctls around freeze(), IIRC this is an attempt 
to lock against VT-switching. The way it is implemented now will 
make s2disk switch away from the splash VT. IMHO it is unneeded.


Index: suspend.c
===
--- suspend.c   (revision 155)
+++ suspend.c   (revision 156)
@@ -661,17 +661,12 @@
return ENOSPC;
}
 
-   ioctl(vt_fd, KDSKBMODE, K_MEDIUMRAW);
-   ioctl(vt_fd, VT_ACTIVATE, vt_no);
-   ioctl(vt_fd, VT_WAITACTIVE, vt_no);
-   ioctl(vt_fd, KDSETMODE, KD_GRAPHICS);
error = freeze(snapshot_fd);
-   ioctl(vt_fd, KDSETMODE, KD_TEXT);
-   ioctl(vt_fd, KDSKBMODE, K_XLATE);
-   ioctl(vt_fd, VT_ACTIVATE, vt_no);
-   ioctl(vt_fd, VT_WAITACTIVE, vt_no);

+   /* This a hack for a bug in bootsplash. Apparently it will
+* drop to 'verbose mode' after the freeze() call.
+*/
splash.switch_to();
splash.progress(15);
 
if (error)
@@ -1158,8 +1149,6 @@
goto Close_snapshot_fd;
}
 
-   splash_prepare(&splash, splash_param);
-
vt_fd = prepare_console(&orig_vc, &suspend_vc);
if (vt_fd < 0) {
ret = errno;
@@ -1167,6 +1156,8 @@
goto Close_snapshot_fd;
}
 
+   splash_prepare(&splash, splash_param);
+
splash.progress(5);
 
 #ifdef CONFIG_BOTH
@@ -1206,8 +1197,8 @@
close_swappiness();
 
 Restore_console:
-   restore_console(vt_fd, orig_vc);
splash.finish();
+   restore_console(vt_fd, orig_vc);
 Close_snapshot_fd:
close(snapshot_fd);
 Close_resume_fd:


-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] 3/5 splashy support

2006-09-12 Thread Tim Dijkstra
Some changes related to output and user interaction.

- Change some printf(...)s into fprintf(stderr,...)s
- Remove one "Press enter to continue", if it's triggered it would
  always trigger a second instance further down the code path.
- Make print_checksum print to a buffer instead of stdout

Index: resume.c
===
--- resume.c(revision 159)
+++ resume.c(revision 160)
@@ -359,12 +359,14 @@
return error;
 }
 
-static inline void print_checksum(unsigned char *checksum)
+static char * print_checksum(char * buf, unsigned char *checksum)
 {
int j;
 
for (j = 0; j < 16; j++)
-   printf("%02hhx ", checksum[j]);
+   buf += sprintf(buf, "%02hhx ", checksum[j]);
+
+   return buf;
 }
 
 #ifdef CONFIG_ENCRYPT
@@ -529,7 +531,7 @@
fd = open(resume_dev_name, O_RDWR);
if (fd < 0) {
ret = -errno;
-   printf("resume: Could not open the resume device\n");
+   fprintf(stderr,"resume: Could not open the resume device\n");
return ret;
}
if (lseek(fd, shift, SEEK_SET) != shift)
@@ -546,9 +548,8 @@
if (!error) {
if(header->image_flags & IMAGE_CHECKSUM) {
memcpy(orig_checksum, header->checksum, 16);
-   printf("resume: MD5 checksum ");
-   print_checksum(orig_checksum);
-   printf("\n");
+   printf("resume: MD5 checksum %s\n",
+   print_checksum(buffer, orig_checksum));
verify_checksum = 1;
}
splash.progress(10);
@@ -557,7 +558,7 @@
 #ifdef CONFIG_COMPRESS
decompress = 1;
 #else
-   printf("resume: Compression not supported\n");
+   fprintf(stderr,"resume: Compression not supported\n");
error = -EINVAL;
 #endif
}
@@ -595,11 +596,11 @@
if (decrypt)
gcry_cipher_close(handle.cipher_handle);
decrypt = 0;
-   printf("resume: libgcrypt error: %s\n",
+   fprintf(stderr, "resume: libgcrypt error: %s\n",
gcry_strerror(error));
}
 #else
-   printf("resume: Encryption not supported\n");
+   fprintf(stderr, "resume: Encryption not supported\n");
error = -EINVAL;
 #endif
}
@@ -615,7 +616,8 @@
error = load_image(&handle, dev, nr_pages);
}
if (error) {
-   printf("\nresume: The system snapshot image could not be 
read.\n\n"
+   fprintf(stderr,
+   "\nresume: The system snapshot image could not be 
read.\n\n"
 #ifdef CONFIG_ENCRYPT
"\tThis might be a result of booting a wrong kernel\n"
"\tor typing in a wrong passphrase.\n\n"
@@ -639,11 +641,9 @@
if (!error && verify_checksum) {
md5_finish_ctx(&handle.ctx, checksum);
if (memcmp(orig_checksum, checksum, 16)) {
-   printf("resume: MD5 checksum does not match\n");
-   printf("resume: Computed MD5 checksum ");
-   print_checksum(checksum);
-   printf("\nPress ENTER to continue ");
-   getchar();
+   fprintf(stderr,"resume: MD5 checksum does not 
match\n");
+   fprintf(stderr,"resume: Computed MD5 checksum 
%s\n",
+   print_checksum(buffer, checksum));
error = -EINVAL;
}
}
@@ -686,7 +683,7 @@
 
if (stat(procname, &stat_buf) && errno == ENOENT) {
if (mount("none", "/proc", "proc", 0, NULL)) {
-   printf("resume: Could not mount proc\n");
+   fprintf(stderr, "resume: Could not mount proc\n");
return;
} else
proc_mounted = 1;
@@ -731,7 +728,8 @@
splash_param = 0;
 
while (stat(resume_dev_name, &stat_buf)) {
-   printf("resume: Could not stat the resume device file.\n"
+   fprintf(stderr, 
+   "resume: Could not stat the resume device file.\n"
"\tPlease type in the file name to try again"
"\tor press ENTER to boot the system: ");
fgets(resume_dev_name, MAX_STR_LEN - 1, stdin);
Index: suspend.c

[Suspend-devel] 2/5 splashy support

2006-09-12 Thread Tim Dijkstra
The progress would halt at 20% for a while. This will make it run nice
and continuously.


Index: suspend.c
===
--- suspend.c   (revision 158)
+++ suspend.c   (revision 159)
@@ -425,8 +425,7 @@
break;
if (!(nr_pages % m)) {
printf("\b\b\b\b%3d%%", nr_pages / m);
-   if ((nr_pages / m) >= 20 && (nr_pages / m) <= 
95)
-   splash.progress(nr_pages / m);
+   splash.progress(20 + (nr_pages / m) * 0.75);
}
if (!(nr_pages % writeout_rate))
start_writeout(handle->fd);

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] 4/5 splashy support

2006-09-12 Thread Tim Dijkstra
Splashy can display a popup if it needs user interaction. Make user 
queries go through the splash struct to be able to use that.

- Remove to_silent/to_verbose these are private to bootsplash
- Add read_password/getchar to the struct
- Ask the password not from within encrypt_init, but separately.
- Make some wrapper functions for bootsplash

Index: splash.h
===
--- splash.h(revision 160)
+++ splash.h(revision 164)
@@ -14,11 +14,11 @@
 
 /* generic interface functions for an arbitary splash method */
 struct splash {
-   int (*to_silent)  (void);
-   int (*to_verbose) (void);
int (*finish) (void);
int (*progress)   (int p);
void (*switch_to) (void);
+   void (*read_password) (char *, int);
+   int (*getchar) (void);
 };
 
 void splash_prepare(struct splash *splash, int enabled);
Index: resume.c
===
--- resume.c(revision 160)
+++ resume.c(revision 164)
@@ -402,7 +402,7 @@
ivec_buf = key_buf + PK_KEY_SIZE;
out = ivec_buf + PK_CIPHER_BLOCK;
do {
-   read_password(pass_buf, 0);
+   splash.read_password(pass_buf, 0);
memset(ivec_buf, 0, PK_CIPHER_BLOCK);
strncpy((char *)ivec_buf, pass_buf, PK_CIPHER_BLOCK);
md5_init_ctx(&ctx);
@@ -567,17 +567,16 @@
static unsigned char key[KEY_SIZE], ivec[CIPHER_BLOCK];
 
printf("resume: Encrypted image\n");
-   splash.to_verbose();
if (header->image_flags & IMAGE_USE_RSA) {
error = decrypt_key(header, key, ivec, buffer);
} else {
int j;
 
-   encrypt_init(key, ivec, buffer, 0);
+   splash.read_password(buffer, 0);
+   encrypt_init(key, ivec, buffer);
for (j = 0; j < CIPHER_BLOCK; j++)
ivec[j] ^= header->salt[j];
}
-   splash.to_silent();
splash.progress(15);
if (!error)
error = gcry_cipher_open(&handle.cipher_handle,
@@ -630,7 +629,7 @@
"\tnow and successful resume. That would badly damage\n"
"\taffected filesystems.]\n\n"
"\tDo you want to continue boot (Y/n)? ");
-   c = getchar();
+   c = splash.getchar();
ret = (c == 'n' || c == 'N');
if (ret) {
close(fd);
@@ -671,7 +671,7 @@
} else {
printf("resume: Error %d loading the image\n"
"\nPress ENTER to continue", error);
-   getchar();
+   splash.getchar();
}
return error;
 }
Index: bootsplash.c
===
--- bootsplash.c(revision 160)
+++ bootsplash.c(revision 164)
@@ -16,6 +16,7 @@
 #include 
 
 #include "vt.h"
+#include "encrypt.h"
 
 #define BOOTSPLASH_PROC "/proc/splash"
 #define MAX_LINE_SIZE   1024
@@ -32,6 +33,34 @@
return 0;
 }
 
+static int bootsplash_write(const char *buf)
+{
+   int error = 0;
+
+   if (!splash_file)
+   return -1;
+
+   error = fputs(buf, splash_file);
+   if (error == EOF) {
+   fprintf(stderr, "Could not write '%s' to %s: %s\n",
+   buf, BOOTSPLASH_PROC, strerror(errno));
+   bootsplash_finish();
+   return error;
+   }
+   fflush(splash_file);
+   return 0;
+}
+
+static int bootsplash_to_silent(void)
+{
+   return bootsplash_write("silent\n");
+}
+
+static int bootsplash_to_verbose(void)
+{
+   return bootsplash_write("verbose\n");
+}
+
 int bootsplash_open(void)
 {
char *str, buf[MAX_LINE_SIZE];
@@ -47,6 +76,7 @@
if (!strstr(buf, ": on"))
goto close;
 
+   bootsplash_to_silent();
return 0;
 close:
bootsplash_finish();
@@ -62,24 +92,6 @@
}
 }
 
-static int bootsplash_write(const char *buf)
-{
-   int error = 0;
-
-   if (!splash_file)
-   return -1;
-
-   error = fputs(buf, splash_file);
-   if (error == EOF) {
-   fprintf(stderr, "Could not write '%s' to %s: %s\n",
-   buf, BOOTSPLASH_PROC, strerror(errno));
-   bootsplash_finish();
-   return error;
-   }
-   fflush(splash_file);
-   return 0;
-}
-
 inline int bootsplash_progress(int p)
 {
char buf[MAX_LINE_SIZE];
@@ -92,12 +104,21 @@
return bootsplash_write(buf);
 }
 
-int bootsplash_to_silent(void)
-{
-   return bootspla

[Suspend-devel] 5/5 splashy support

2006-09-12 Thread Tim Dijkstra
Finally, support for splashy itself.

Index: splashy_funcs.c
===
--- splashy_funcs.c (revision 0)
+++ splashy_funcs.c (revision 169)
@@ -0,0 +1,71 @@
+/*
+ * splashy.c
+ *
+ * Splashy (userspace splash) splash method support
+ *
+ * Copyright (C) 2006 Tim Dijkstra <[EMAIL PROTECTED]>
+ *
+ * This file is released under the GPLv2.
+ *
+ */
+
+#ifdef CONFIG_SPLASHY
+#include 
+
+#include 
+
+#include "encrypt.h"
+#include "splashy_funcs.h"
+
+int splashy_open() //char *mode)
+{
+char * mode="suspend";
+   /* Do some detecting logic here ... */
+   if (!splashy_init (NULL,mode))
+   return -1;
+
+   if (splashy_start_splash () < 0)
+   return -1;
+
+   return 0;
+}
+
+
+inline int splashy_finish(void)
+{
+
+   splashy_stop_splash();
+
+   return 0;
+}
+
+inline int splashy_progress(int p)
+{
+
+   splashy_update_progressbar (p);
+
+   return 0;
+}
+
+void splashy_read_password (char *buf, int vrfy)
+{
+#if CONFIG_ENCRYPT
+char *vrfy_buf = vrfy ? buf + PASS_SIZE : buf;
+
+do {
+while (splashy_get_password(buf,PASS_SIZE, 
+"Passphrase please (must be non-empty): ") <= 0);
+
+if (vrfy)
+while (splashy_get_password(vrfy_buf,PASS_SIZE,
+"Verify passphrase: ") <= 0);
+
+   } while (vrfy && strncmp(buf, vrfy_buf, PASS_SIZE));
+#endif
+}
+
+void splashy_print(const char *str) {
+   splashy_printline(str);
+}
+
+#endif
Index: splashy_funcs.h
===
--- splashy_funcs.h (revision 0)
+++ splashy_funcs.h (revision 169)
@@ -0,0 +1,25 @@
+/*
+ * splashy.h
+ *
+ * Boot splash related definitions for splashy method
+ *
+ * Copyright (C) 2006 Tim Dijkstra <[EMAIL PROTECTED]>
+ *
+ * This file is released under the GPLv2.
+ *
+ */
+
+#ifndef SPLASHY_FUNCS_H
+#define SPLASHY_FUNCS_H
+#ifdef CONFIG_SPLASHY
+
+int splashy_open(void);
+int splashy_finish(void);
+int splashy_progress(int p);
+void splashy_read_password(char *, int);
+int splashy_getchar(void);
+void splashy_print(const char *);
+
+#endif
+#endif /* SPLASHY_FUNCS_H */
+
Index: splash.c
===
--- splash.c(revision 164)
+++ splash.c(revision 169)
@@ -14,6 +14,7 @@
 
 #include "splash.h"
 #include "bootsplash.h"
+#include "splashy_funcs.h"
 #include "encrypt.h"
 
 /**
@@ -52,6 +53,14 @@
splash->switch_to   = bootsplash_switch_to;
splash->getchar = bootsplash_getchar;
splash->read_password = bootsplash_read_password;
+#ifdef CONFIG_SPLASHY
+   } else if (!splashy_open()) {
+   splash->finish  = splashy_finish;
+   splash->progress= splashy_progress;
+   splash->getchar = splashy_getchar;
+   splash->read_password   = splashy_read_password;
+
+#endif
} else if (0) {
/* add another splash system here */
} else {
Index: Makefile
===
--- Makefile2006-09-11 21:05:07.0 +0200
+++ Makefile2006-09-11 23:27:36.0 +0200
@@ -1,5 +1,6 @@
 #CONFIG_COMPRESS=yes
 #CONFIG_ENCRYPT=yes
+CONFIG_SPLASHY=yes
 
 ARCH:=$(shell uname -m)
 
@@ -41,7 +42,20 @@
 S2RAMOBJ=vt.o vbetool/thunk.o vbetool/x86-common.o vbetool/vbetool.o 
vbetool/x86emu/libx86emu.a radeontool.o dmidecode.o
 endif
 
-SPLASHOBJ = splash.o bootsplash.o
+SPLASHOBJ = splash.o bootsplash.o 
+
+ifdef CONFIG_SPLASHY
+CC_FLAGS   += -DCONFIG_SPLASHY
+LD_FLAGS   += -lsplashy
+SPLASHOBJ  += splashy_funcs.o 
+STATIC_LD_FLAGS= -lsplashycnf \
+   $(shell directfb-config  --libs --input=keyboard \
+   --imageprovider=jpeg,gif,png\
+   --font=ft2,default) \
+   $(shell pkg-config --static --libs glib-2.0)
+STATIC_CC_FLAGS=$(shell directfb-config --cflags)\
+   $(shell pkg-config --static --cflags glib-2.0)
+endif
 
 clean:
rm -f $(S2DISK) suspend-keygen suspend.keys resume s2ram *.o 
vbetool/*.o vbetool/x86emu/*.o vbetool/x86emu/*.a
@@ -85,9 +99,12 @@
 bootsplash.o: bootsplash.h bootsplash.c
$(CC) -g $(CFLAGS) $(CC_FLAGS) -c bootsplash.c -o bootsplash.o
 
-splash.o: splash.h splash.c bootsplash.o vt.o
+splash.o: splash.h splash.c bootsplash.o vt.o splashy_funcs.o
$(CC) -g $(CFLAGS) $(CC_FLAGS) -c splash.c -o splash.o
 
+splashy_funcs.o: splashy_funcs.c splashy_funcs.h
+   $(CC) -g $(CFLAGS) $(CC_FLAGS) -c $< -o $@
+
 $(S2DISK): vt.o md5.o encrypt.o config.o suspend.c swsusp.h config.h 
encrypt.h md5.h $(SPLASHOBJ)
$(CC) -g $(CFLAGS) $(CC_FLAGS) v

Re: [Suspend-devel] 1/5 splashy support

2006-09-14 Thread Tim Dijkstra
On Wed, 13 Sep 2006 22:52:26 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> On Tuesday, 12 September 2006 11:02, Tim Dijkstra wrote:
> > 
> > Also it removes the ioctls around freeze(), IIRC this is an attempt 
> > to lock against VT-switching. The way it is implemented now will 
> > make s2disk switch away from the splash VT. IMHO it is unneeded.
> 
> Well, we can do without these ioctls, I think.
> 
> The patch looks good.

Thanks.

I've played around a bit with different ioctls to lock against VT
switching, but that would IMHO be to complicated to worth the trouble.
If people are bitten by this I can have another look at it, but most
probably they will just learn not to press ctr-alt-f7 in the middle of 
the suspend process ;)

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] 1/5 splashy support

2006-09-14 Thread Tim Dijkstra
On Thu, 14 Sep 2006 10:34:38 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > > > Also it removes the ioctls around freeze(), IIRC this is an attempt 
> > > > to lock against VT-switching. The way it is implemented now will 
> > > > make s2disk switch away from the splash VT. IMHO it is unneeded.
> > > 
> > > Well, we can do without these ioctls, I think.
> > > 
> > > The patch looks good.
> > 
> > Thanks.
> > 
> > I've played around a bit with different ioctls to lock against VT
> > switching, but that would IMHO be to complicated to worth the trouble.
> > If people are bitten by this I can have another look at it, but most
> > probably they will just learn not to press ctr-alt-f7 in the middle of 
> > the suspend process ;)
> 
> Just for the record... I'd prefer not to depend on _that_.
> 
> "Hey, I suspended yesterday, and now I'm trying to resume, but X will
> not wakeup."
> 
> "WTF?"
> 
> ...user may not remember he pressed c-a-f7 during suspend.

Hmm, maybe your right. Although the released version has the wrong
ioctl's and I haven't heard anybody complaining, yet. But that is not an
excuse, I know. I haven't actually _tried_ switching away to see what
happens... 

I'll see if I can make the locking work properly. It will probably
introduce a call splash->lock, splash->unlock. Can you apply the patches
now Rafeal ACK'd them? Then I'll prepare a patch on top of those.

grts Tim


-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] 1/5 splashy support

2006-09-14 Thread Tim Dijkstra
On Thu, 14 Sep 2006 12:55:06 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> On Thursday, 14 September 2006 11:04, Pavel Machek wrote:
> > Hi!
> > 
> > 
> > I thought Rafael is going to apply them... he has CVS write access,
> > too. Or just send me a patch (one, I'm lazy) and a changelog to put
> > into CVS.
> > 
> > Alternatively, you can get CVS write access, too, with "commit after
> > someone acked it" rule...?
> 
> To be honest, I'd prefer the last one. ;-)

OK, my sf.net account is tdykstra. If you add me, I will commit it myself.

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] 1/5 splashy support

2006-09-14 Thread Tim Dijkstra
On Thu, 14 Sep 2006 14:29:34 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> On Thu 2006-09-14 13:22:29, Tim Dijkstra wrote:
> > On Thu, 14 Sep 2006 12:55:06 +0200
> > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:
> > 
> > > Hi,
> > > 
> > > On Thursday, 14 September 2006 11:04, Pavel Machek wrote:
> > > > Hi!
> > > > 
> > > > 
> > > > I thought Rafael is going to apply them... he has CVS write access,
> > > > too. Or just send me a patch (one, I'm lazy) and a changelog to put
> > > > into CVS.
> > > > 
> > > > Alternatively, you can get CVS write access, too, with "commit after
> > > > someone acked it" rule...?
> > > 
> > > To be honest, I'd prefer the last one. ;-)
> > 
> > OK, my sf.net account is tdykstra. If you add me, I will commit it myself.
> 
> Done.

Done.

I also updated the HOWTO, OK to commit?

Index: HOWTO
===
RCS file: /cvsroot/suspend/suspend/HOWTO,v
retrieving revision 1.11
diff -u -r1.11 HOWTO
--- HOWTO   23 Jul 2006 11:34:33 -  1.11
+++ HOWTO   14 Sep 2006 14:55:20 -
@@ -17,6 +17,7 @@
  
 (e) [optionally] Marc Lehmann's libLZF library (for image compression)
 (f) [optionally] libgcrypt (for image encryption)
+(g) [optionally] libsplashy (for user space splash)
  
 2) Basic steps
  
@@ -76,7 +77,13 @@
 Still, if your distribution doesn't provide the binary package, you can refer
 to the documentation at http://www.gnupg.org/ for installation instructions.
  
-(d) Configure, build and install the suspend utilities
+(d) [optionally] install libsplashy-dev
+
+If you want to use splashy to display a splash screen on resume/suspend.
+For now you need the experimental version of splashy, which can be
+found at svn://svn.debian.org/svn/splashy/branches/0.3 .
+
+(w) Configure, build and install the suspend utilities
  
 - Edit Makefile and the conf/suspend.conf file to reflect the configuration
 of your system (please refer to Section II of this document for details).  The
@@ -198,12 +205,15 @@
 respectively.  Short instructions related to these packages have been
 given in Secion I above.
  
+If you want a user space splash screen you will need a splashy theme,
+you also have to copy the theme files to your initramfs/initrd.
+
 3) Configuration and compilation of suspend tools
  
-(a) [optional] If you want to use the compression and/or encryption
-capabilities of the suspend tools and you have installed the necessary
-packages referred to in subsection 2), you need to set
-CONFIG_COMPRESS and/or CONFIG_ENCRYPT in the Makefile to "yes".
+(a) [optional] If you want to use the compression, encryption and/or
+user space splash capabilities of the suspend tools and you have installed
+the necessary packages referred to in subsection 2), you need to set
+CONFIG_COMPRESS, CONFIG_ENCRYPT and/or CONFIG_SPLASHY in the Makefile to "yes".
  
 (b) Compile the s2disk and resume binaries by running:
  
@@ -267,7 +277,10 @@
 boxes and eliminates the "fast progress meter and long fsync wait" effect.]
  
 The "splash" parameter is used to make s2disk and/or resume use a splash system
-(when set to 'y').  Currently the bootsplash.org's splash system is supported.
+(when set to 'y').  Currently the bootsplash.org and splashy splash systems
+are supported. Note that for both systems your initrd or initramfs will
+need additional files. See the documentation of your splash system for
+more information.
  
 The resume tool can use the same configuration file that is used by the
 s2disk tool, but it will ignore most of the above parameters.  It will use the

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] 1/5 splashy support

2006-09-14 Thread Tim Dijkstra
On Thu, 14 Sep 2006 17:10:18 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> > -(a) [optional] If you want to use the compression and/or encryption
> > -capabilities of the suspend tools and you have installed the necessary
> > -packages referred to in subsection 2), you need to set
> > -CONFIG_COMPRESS and/or CONFIG_ENCRYPT in the Makefile to "yes".
> > +(a) [optional] If you want to use the compression, encryption and/or
> > +user space splash capabilities of the suspend tools and you have installed
> > +the necessary packages referred to in subsection 2), you need to set
> > +CONFIG_COMPRESS, CONFIG_ENCRYPT and/or CONFIG_SPLASHY in the Makefile to 
> > "yes".
> 
> Please separate the splashy-related paragraph from (a), as (b), and change
> (b) below to (c) etc.

Is this really necessary? (b) would just be a copy of (a) with CONFIG_COMPRESS, 
CONFIG_ENCRYPT
subed by CONFIG_SPLASHY.

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] 1/5 splashy support

2006-09-14 Thread Tim Dijkstra
On Thu, 14 Sep 2006 17:26:45 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> On Thursday, 14 September 2006 17:22, Tim Dijkstra wrote:
> > On Thu, 14 Sep 2006 17:10:18 +0200
> > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:
> > 
> > > > -(a) [optional] If you want to use the compression and/or
> > > > encryption -capabilities of the suspend tools and you have
> > > > installed the necessary -packages referred to in subsection 2),
> > > > you need to set -CONFIG_COMPRESS and/or CONFIG_ENCRYPT in the
> > > > Makefile to "yes". +(a) [optional] If you want to use the
> > > > compression, encryption and/or +user space splash capabilities
> > > > of the suspend tools and you have installed +the necessary
> > > > packages referred to in subsection 2), you need to set
> > > > +CONFIG_COMPRESS, CONFIG_ENCRYPT and/or CONFIG_SPLASHY in the
> > > > Makefile to "yes".
> > > 
> > > Please separate the splashy-related paragraph from (a), as (b),
> > > and change (b) below to (c) etc.
> > 
> > Is this really necessary? (b) would just be a copy of (a) with
> > CONFIG_COMPRESS, CONFIG_ENCRYPT subed by CONFIG_SPLASHY.
> 
> All right then.  However, this functionality is quite not related, so
> to speak.
> 

I think that is clear from the rest of the HOWTO. This paragraph is
only about howto configure suspend.

I've adopted your other comments.

grts Tim


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Lock VT against switching

2006-09-14 Thread Tim Dijkstra
Hi,

This patch will lock the VT that is active just after splash is
initialized and release it just before the splash system is stopped.

I haven't tested it extensively with bootsplash.org, but it seems to
work with that (in vmware) too.

Comments?

Index: suspend.c
===
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.52
diff -u -r1.52 suspend.c
--- suspend.c   14 Sep 2006 14:18:58 -  1.52
+++ suspend.c   14 Sep 2006 20:48:53 -
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef CONFIG_COMPRESS
 #include 
 #else
@@ -66,6 +67,8 @@
 
 static int suspend_swappiness = SUSPEND_SWAPPINESS;
 static struct splash splash;
+static struct vt_mode orig_vtm;
+static int vfd;
 
 static struct config_par parameters[PARAM_NO] = {
{
@@ -487,7 +490,7 @@
  * write_image - Write entire image and metadata.
  */
 
-int write_image(int snapshot_fd, int resume_fd, int vt_no)
+int write_image(int snapshot_fd, int resume_fd)
 {
static struct swap_map_handle handle;
struct swsusp_info *header = mem_pool;
@@ -644,7 +647,7 @@
while(1);
 }
 
-int suspend_system(int snapshot_fd, int resume_fd, int vt_fd, int vt_no)
+int suspend_system(int snapshot_fd, int resume_fd)
 {
loff_t avail_swap;
unsigned long image_size;
@@ -683,7 +686,7 @@
free_snapshot(snapshot_fd);
break;
}
-   error = write_image(snapshot_fd, resume_fd, vt_no);
+   error = write_image(snapshot_fd, resume_fd);
if (!error) {
splash.progress(100);
 #ifdef CONFIG_BOTH
@@ -1027,6 +1030,75 @@
 }
 #endif
 
+
+static void release_vt(int signo)
+{
+   printf("Ignoring request to release VT\n");
+   ioctl(vfd, VT_RELDISP, 0);
+}
+
+static void acquire_vt(int signo)
+{
+   printf("Ignoring request to acquire VT\n");
+   ioctl(vfd, VT_RELDISP, VT_ACKACQ);
+}
+
+static void unlock_vt(void)
+{
+   ioctl(vfd, VT_SETMODE, &orig_vtm);
+   close(vfd);
+}
+
+static int lock_vt()
+{
+   struct sigaction sa;
+   struct vt_mode vtm;
+   struct vt_stat vtstat;
+   char *vt_name = mem_pool;
+   int fd, error;
+
+   fd = console_fd("/dev/console");
+   if (fd < 0)
+   return fd;
+
+   error = ioctl(fd, VT_GETSTATE, &vtstat);
+   close(fd);
+   
+   if ( error < 0 )
+   return -1;
+
+   sprintf(vt_name, "/dev/tty%d", vtstat.v_active);
+   vfd = open(vt_name, O_RDWR);
+   if (vfd < 0)
+   return vfd;
+
+   if (ioctl(vfd, VT_GETMODE, &vtm) < 0) 
+   return -1;
+
+   /* Setting vt mode to VT_PROCESS means this process
+* will handle vt switching requests.
+* We installed handlers for release and acquire requests.
+*/
+   sigemptyset(&(sa.sa_mask));
+   sa.sa_flags = SA_RESTART;
+   sa.sa_handler = release_vt;
+   sigaction(SIGUSR1, &sa, NULL);
+   sa.sa_handler = acquire_vt;
+   sigaction(SIGUSR2, &sa, NULL);
+
+   orig_vtm = vtm;
+   vtm.mode = VT_PROCESS;
+   vtm.relsig = SIGUSR1;
+   vtm.acqsig = SIGUSR2;
+   if (ioctl(vfd, VT_SETMODE, &vtm) < 0)
+   return -1;
+
+   printf("Locked against VT switching\n");
+   return 0;
+}
+
+
+
 int main(int argc, char *argv[])
 {
unsigned int mem_size;
@@ -1161,6 +1233,9 @@
 
splash_prepare(&splash, splash_param);
 
+   if (lock_vt() < 0)
+   goto Restore_console;
+
splash.progress(5);
 
 #ifdef CONFIG_BOTH
@@ -1187,7 +1262,7 @@
if (!s2ram && chroot(chroot_path)) {
ret = errno;
fprintf(stderr, "suspend: Could not chroot to %s\n", 
chroot_path);
-   goto Restore_console;
+   goto Unlock_vt;
}
chdir("/");
 
@@ -1195,7 +1270,7 @@
 
splash.progress(10);
 
-   ret = suspend_system(snapshot_fd, resume_fd, vt_fd, suspend_vc);
+   ret = suspend_system(snapshot_fd, resume_fd);
 
if (orig_loglevel >= 0)
set_kernel_console_loglevel(orig_loglevel);
@@ -1205,6 +1280,8 @@


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Lock VT against switching

2006-09-15 Thread Tim Dijkstra
On Fri, 15 Sep 2006 11:06:36 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > This patch will lock the VT that is active just after splash is
> > initialized and release it just before the splash system is stopped.
> > 
> > I haven't tested it extensively with bootsplash.org, but it seems to
> > work with that (in vmware) too.
> > 
> > Comments?
> > 
> 
> > @@ -1027,6 +1030,75 @@
> >  }
> >  #endif
> >  
> > +
> > +static void release_vt(int signo)
> > +{
> > +   printf("Ignoring request to release VT\n");
> > +   ioctl(vfd, VT_RELDISP, 0);
> > +}
> > +
> 
> Is printf safe to call from signal handler?

It seems to work. But these were there mainly for testing, so  
they can go.
 
> > +static int lock_vt()
> 
> (void).
> 
> > +   error = ioctl(fd, VT_GETSTATE, &vtstat);
> > +   close(fd);
> > +   
> > +   if ( error < 0 )
> 
> (error < 0), (no spaces) please.
> 
> > +   /* Setting vt mode to VT_PROCESS means this process
> > +* will handle vt switching requests.
> > +* We installed handlers for release and acquire requests.
> > +*/
> 
> Is it possible to just ignore those signals? Kernel will be unable to
> switch, anyway, no?

I think we can drop the handler for the acquire event. That should
never happen anyway.

Hmm, I could have sworn that I tested with SIG_IGN as a handler, and
that it did not work. After testing it again, it does seem to do the
trick ...

But installing that handler can't hurt, right? It does explicitly
dismiss the switch. But indeed, after reading the linux source, I think 
ignoring the signal works also.
  
> > +   printf("Locked against VT switching\n");
> 
> This should be gone in final version.
> 
> Otherwise looks okay to me...
>   Pavel

Rafael: 
> It looks good to me too except for one thing: could we please return
> well-defined error codes from lock_vt() instead of -1?

What do you propose? Return -errno?

grts Tim


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Lock VT against switching

2006-09-15 Thread Tim Dijkstra
On Fri, 15 Sep 2006 22:15:09 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> On Friday, 15 September 2006 21:39, Tim Dijkstra wrote:
> > On Fri, 15 Sep 2006 11:06:36 +0200
> > Pavel Machek <[EMAIL PROTECTED]> wrote:
> > 
> > > Hi!
> > > 
> > > > This patch will lock the VT that is active just after splash is
> > > > initialized and release it just before the splash system is
> > > > stopped.
> > > > 
> > > > I haven't tested it extensively with bootsplash.org, but it
> > > > seems to work with that (in vmware) too.
> > > > 
> > > > Comments?
> > > > 
> > > 
> > > > @@ -1027,6 +1030,75 @@
> > > >  }
> > > >  #endif
> > > >  
> > > > +
> > > > +static void release_vt(int signo)
> > > > +{
> > > > +   printf("Ignoring request to release VT\n");
> > > > +   ioctl(vfd, VT_RELDISP, 0);
> > > > +}
> > > > +
> > > 
> > > Is printf safe to call from signal handler?
> > 
> > It seems to work. But these were there mainly for testing, so  
> > they can go.
> >  
> > > > +static int lock_vt()
> > > 
> > > (void).
> > > 
> > > > +   error = ioctl(fd, VT_GETSTATE, &vtstat);
> > > > +   close(fd);
> > > > +   
> > > > +   if ( error < 0 )
> > > 
> > > (error < 0), (no spaces) please.
> > > 
> > > > +   /* Setting vt mode to VT_PROCESS means this process
> > > > +* will handle vt switching requests.
> > > > +* We installed handlers for release and acquire
> > > > requests.
> > > > +*/
> > > 
> > > Is it possible to just ignore those signals? Kernel will be
> > > unable to switch, anyway, no?
> > 
> > I think we can drop the handler for the acquire event. That should
> > never happen anyway.
> > 
> > Hmm, I could have sworn that I tested with SIG_IGN as a handler, and
> > that it did not work. After testing it again, it does seem to do the
> > trick ...
> > 
> > But installing that handler can't hurt, right? It does explicitly
> > dismiss the switch. But indeed, after reading the linux source, I
> > think ignoring the signal works also.
> >   
> > > > +   printf("Locked against VT switching\n");
> > > 
> > > This should be gone in final version.
> > > 
> > > Otherwise looks okay to me...
> > >   Pavel
> > 
> > Rafael: 
> > > It looks good to me too except for one thing: could we please
> > > return well-defined error codes from lock_vt() instead of -1?
> > 
> > What do you propose? Return -errno?
> 
> For example:
> 
> error = ioctl(vfd, VT_GETMODE, &vtm);
> if (error)
>   return error;

AFAIK ioctl will on error always return -1

grts Tim


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Lock VT against switching, new patch

2006-09-16 Thread Tim Dijkstra
Hi,

Here's a new version of the patch:

Index: suspend.c
===
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.52
diff -u -r1.52 suspend.c
--- suspend.c   14 Sep 2006 14:18:58 -  1.52
+++ suspend.c   16 Sep 2006 07:33:48 -
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #ifdef CONFIG_COMPRESS
 #include 
 #else
@@ -66,6 +67,8 @@
 
 static int suspend_swappiness = SUSPEND_SWAPPINESS;
 static struct splash splash;
+static struct vt_mode orig_vtm;
+static int vfd;
 
 static struct config_par parameters[PARAM_NO] = {
{
@@ -487,7 +490,7 @@
  * write_image - Write entire image and metadata.
  */
 
-int write_image(int snapshot_fd, int resume_fd, int vt_no)
+int write_image(int snapshot_fd, int resume_fd)
 {
static struct swap_map_handle handle;
struct swsusp_info *header = mem_pool;
@@ -644,7 +647,7 @@
while(1);
 }
 
-int suspend_system(int snapshot_fd, int resume_fd, int vt_fd, int vt_no)
+int suspend_system(int snapshot_fd, int resume_fd)
 {
loff_t avail_swap;
unsigned long image_size;
@@ -683,7 +686,7 @@
free_snapshot(snapshot_fd);
break;
}
-   error = write_image(snapshot_fd, resume_fd, vt_no);
+   error = write_image(snapshot_fd, resume_fd);
if (!error) {
splash.progress(100);
 #ifdef CONFIG_BOTH
@@ -1027,6 +1030,61 @@
 }
 #endif
 
+static void unlock_vt(void)
+{
+   ioctl(vfd, VT_SETMODE, &orig_vtm);
+   close(vfd);
+}
+
+static int lock_vt(void)
+{
+   struct sigaction sa;
+   struct vt_mode vtm;
+   struct vt_stat vtstat;
+   char *vt_name = mem_pool;
+   int fd, error;
+
+   fd = console_fd("/dev/console");
+   if (fd < 0)
+   return fd;
+
+   error = ioctl(fd, VT_GETSTATE, &vtstat);
+   close(fd);
+   
+   if (error < 0)
+   return error;
+
+   sprintf(vt_name, "/dev/tty%d", vtstat.v_active);
+   vfd = open(vt_name, O_RDWR);
+   if (vfd < 0)
+   return vfd;
+
+   error = ioctl(vfd, VT_GETMODE, &vtm);
+   if (error < 0) 
+   return error;
+
+   /* Setting vt mode to VT_PROCESS means this process
+* will handle vt switching requests.
+* We just ignore all request by installing SIG_IGN.
+*/
+   sigemptyset(&(sa.sa_mask));
+   sa.sa_flags = SA_RESTART;
+   sa.sa_handler = SIG_IGN;
+   sigaction(SIGUSR1, &sa, NULL);
+
+   orig_vtm = vtm;
+   vtm.mode = VT_PROCESS;
+   vtm.relsig = SIGUSR1;
+   vtm.acqsig = SIGUSR1;
+   error = ioctl(vfd, VT_SETMODE, &vtm);
+   if (error < 0)
+   return error;
+
+   return 0;
+}
+
+
+
 int main(int argc, char *argv[])
 {
unsigned int mem_size;
@@ -1161,6 +1219,9 @@
 
splash_prepare(&splash, splash_param);
 
+   if (lock_vt() < 0)
+   goto Restore_console;
+
splash.progress(5);
 
 #ifdef CONFIG_BOTH
@@ -1187,7 +1248,7 @@
if (!s2ram && chroot(chroot_path)) {
ret = errno;
fprintf(stderr, "suspend: Could not chroot to %s\n", 
chroot_path);
-   goto Restore_console;
+   goto Unlock_vt;
}
chdir("/");
 
@@ -1195,7 +1256,7 @@
 
splash.progress(10);
 
-   ret = suspend_system(snapshot_fd, resume_fd, vt_fd, suspend_vc);
+   ret = suspend_system(snapshot_fd, resume_fd);
 
if (orig_loglevel >= 0)
set_kernel_console_loglevel(orig_loglevel);
@@ -1205,6 +1266,8 @@
set_swappiness(orig_swappiness);
close_swappiness();
 
+Unlock_vt:
+   unlock_vt();
 Restore_console:
splash.finish();
restore_console(vt_fd, orig_vc);


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Small fixes, clean ups

2006-09-16 Thread Tim Dijkstra
Hi,

Three small cleanups:
- Remove s2both binary at 'make clean'
- Remove unused #define
- Add \n to message, looks better imho. 

Index: Makefile
===
diff -u -r1.36 Makefile
--- Makefile14 Sep 2006 14:58:21 -  1.36
+++ Makefile16 Sep 2006 07:42:36 -
@@ -58,7 +58,7 @@
 endif
 
 clean:
-   rm -f $(S2DISK) suspend-keygen suspend.keys resume s2ram *.o 
vbetool/*.o vbetool/x86emu/*.o vbetool/x86emu/*.a
+   rm -f $(S2DISK) $(S2BOTH) 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) $(CFLAGS) -g s2ram.c $(S2RAMOBJ) -lpci -o s2ram
Index: config.h
===
diff -u -r1.2 config.h
--- config.h28 Jun 2006 14:11:42 -  1.2
+++ config.h16 Sep 2006 07:42:36 -
@@ -27,4 +27,3 @@
char *special);
 
 #define CONFIG_FILE"/etc/suspend.conf"
-#define S2BOTH_NAME"s2both"
Index: resume.c
===
diff -u -r1.29 resume.c
--- resume.c14 Sep 2006 14:18:58 -  1.29
+++ resume.c16 Sep 2006 07:42:37 -
@@ -670,7 +670,7 @@
printf("resume: Image successfully loaded\n");
} else {
printf("resume: Error %d loading the image\n"
-   "\nPress ENTER to continue", error);
+   "\nPress ENTER to continue\n", error);
splash.getchar();
}
return error;



signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Lock VT against switching, new patch

2006-09-16 Thread Tim Dijkstra
On Sat, 16 Sep 2006 10:00:19 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> On Saturday, 16 September 2006 09:37, Tim Dijkstra wrote:
> > Hi,
> > 
> > Here's a new version of the patch:
> 
> Looks good to me.
> 
> Greetings,
> Rafael

Committed,

Tim


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Make splash.getchar show prompt

2006-09-16 Thread Tim Dijkstra
Hi,

Because splashy by default doesn't show the printf statements, the user
wouldn't know that he/she would have to push a button on splash.getchar.
This adds a prompt to splash.getchar

Index: resume.c
===
diff -u -r1.29 resume.c
--- resume.c14 Sep 2006 14:18:58 -  1.29
+++ resume.c16 Sep 2006 13:58:14 -
@@ -615,7 +615,7 @@
error = load_image(&handle, dev, nr_pages);
}
if (error) {
-   fprintf(stderr,
+   c = splash.getchar(
"\nresume: The system snapshot image could not be 
read.\n\n"
 #ifdef CONFIG_ENCRYPT
"\tThis might be a result of booting a wrong kernel\n"
@@ -629,7 +629,6 @@
"\tnow and successful resume. That would badly damage\n"
"\taffected filesystems.]\n\n"
"\tDo you want to continue boot (Y/n)? ");
-   c = splash.getchar();
ret = (c == 'n' || c == 'N');
if (ret) {
close(fd);
@@ -669,9 +668,9 @@
if (!error) {
printf("resume: Image successfully loaded\n");
} else {
-   printf("resume: Error %d loading the image\n"
-   "\nPress ENTER to continue", error);
-   splash.getchar();
+   sprintf(buffer, "resume: Error %d loading the image\n"
+   "\nPress ENTER to continue\n", error);
+   splash.getchar(buffer);
}
return error;
 }
Index: splash.c
===
diff -u -r1.3 splash.c
--- splash.c14 Sep 2006 14:22:00 -  1.3
+++ splash.c16 Sep 2006 13:58:14 -
@@ -27,6 +27,11 @@
 #ifndef CONFIG_ENCRYPT
 static void splash_dummy_readpass (char *a, int b) { }
 #endif
+static int splash_getchar (const char *prompt) 
+{
+   printf(prompt);
+   return getchar();
+}
 
 /* Tries to find a splash system and initializes interface functions */
 void splash_prepare(struct splash *splash, int enabled)
@@ -36,7 +41,7 @@
splash->finish  = splash_dummy_int_void;
splash->progress= splash_dummy_int_int;
splash->switch_to   = splash_dummy_void_void;
-   splash->getchar = getchar;
+   splash->getchar = splash_getchar;
 #ifdef CONFIG_ENCRYPT
splash->read_password   = read_password;
 #else
@@ -57,7 +62,7 @@
} else if (!splashy_open()) {
splash->finish  = splashy_finish;
splash->progress= splashy_progress;
-   splash->getchar = splashy_getchar;
+   splash->getchar = splashy_get_char;
splash->read_password   = splashy_read_password;
 
 #endif
Index: splash.h
===
diff -u -r1.2 splash.h
--- splash.h14 Sep 2006 14:18:58 -  1.2
+++ splash.h16 Sep 2006 13:58:14 -
@@ -18,7 +18,7 @@
int (*progress)   (int p);
void (*switch_to) (void);
void (*read_password) (char *, int);
-   int (*getchar) (void);
+   int (*getchar) (const char *);
 };
 
 void splash_prepare(struct splash *splash, int enabled);
Index: splashy_funcs.c
===
diff -u -r1.1 splashy_funcs.c
--- splashy_funcs.c 14 Sep 2006 14:22:00 -  1.1
+++ splashy_funcs.c 16 Sep 2006 13:58:14 -
@@ -64,8 +64,10 @@
 #endif
 }
 
-void splashy_print(const char *str) {
-   splashy_printline(str);
+int splashy_get_char (const char *prompt) 
+{
+   splashy_printline(prompt);
+   return splashy_getchar();
 }
 
 #endif
Index: splashy_funcs.h
===
diff -u -r1.1 splashy_funcs.h
--- splashy_funcs.h 14 Sep 2006 14:22:00 -  1.1
+++ splashy_funcs.h 16 Sep 2006 13:58:14 -
@@ -17,7 +17,7 @@
 int splashy_finish(void);
 int splashy_progress(int p);
 void splashy_read_password(char *, int);
-int splashy_getchar(void);
+int splashy_get_char(const char *);
 void splashy_print(const char *);
 
 #endif


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Make splash.getchar show prompt

2006-09-18 Thread Tim Dijkstra
On Sat, 16 Sep 2006 22:41:08 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Can we rename this thing to splash.dialog()?  I don't think .getchar()
> should print.

Sound sensible ;)

> The rest looks good, but I think we should ask Holger if he agrees with it.

_This_ patch doesn't changes anything for bootsplash.org, it just
reorders some things. It could be, however, that the VT switch locking
has some advert effect.

Here's the patch. I renamed getchar to dialog and removed some white space.

Index: bootsplash.c
===
diff -u -r1.2 bootsplash.c
--- bootsplash.c14 Sep 2006 14:18:58 -  1.2
+++ bootsplash.c18 Sep 2006 09:26:50 -
@@ -113,10 +113,11 @@
 #endif
 }
 
-int bootsplash_getchar (void)
+int bootsplash_dialog (const char *prompt)
 {
int ret;
bootsplash_to_verbose();
+   printf(prompt);
ret = getchar();
bootsplash_to_silent();
 
Index: bootsplash.h
===
diff -u -r1.2 bootsplash.h
--- bootsplash.h14 Sep 2006 14:18:58 -  1.2
+++ bootsplash.h18 Sep 2006 09:26:50 -
@@ -18,6 +18,6 @@
 int bootsplash_progress(int p);
 void bootsplash_switch_to(void);
 void bootsplash_read_password(char *, int);
-int bootsplash_getchar(void);
+int bootsplash_dialog(void);
 
 #endif /* BOOTSPLASH_H */
Index: resume.c
===
diff -u -r1.29 resume.c
--- resume.c14 Sep 2006 14:18:58 -  1.29
+++ resume.c18 Sep 2006 09:26:50 -
@@ -615,7 +615,7 @@
error = load_image(&handle, dev, nr_pages);
}
if (error) {
-   fprintf(stderr,
+   c = splash.dialog(
"\nresume: The system snapshot image could not be 
read.\n\n"
 #ifdef CONFIG_ENCRYPT
"\tThis might be a result of booting a wrong kernel\n"
@@ -629,7 +629,6 @@
"\tnow and successful resume. That would badly damage\n"
"\taffected filesystems.]\n\n"
"\tDo you want to continue boot (Y/n)? ");
-   c = splash.getchar();
ret = (c == 'n' || c == 'N');
if (ret) {
close(fd);
@@ -669,9 +668,9 @@
if (!error) {
printf("resume: Image successfully loaded\n");
} else {
-   printf("resume: Error %d loading the image\n"
-   "\nPress ENTER to continue", error);
-   splash.getchar();
+   sprintf(buffer, "resume: Error %d loading the image\n"
+   "\nPress ENTER to continue\n", error);
+   splash.dialog(buffer);
}
return error;
 }
Index: splash.c
===
RCS file: /cvsroot/suspend/suspend/splash.c,v
retrieving revision 1.3
diff -u -r1.3 splash.c
--- splash.c14 Sep 2006 14:22:00 -  1.3
+++ splash.c18 Sep 2006 09:26:50 -
@@ -25,8 +25,13 @@
 static int splash_dummy_int_int(int p) { return 0; }
 static void splash_dummy_void_void(void) { return; }
 #ifndef CONFIG_ENCRYPT
-static void splash_dummy_readpass (char *a, int b) { }
+static void splash_dummy_readpass(char *a, int b) { }
 #endif
+static int splash_dialog(const char *prompt) 
+{
+   printf(prompt);
+   return getchar();
+}
 
 /* Tries to find a splash system and initializes interface functions */
 void splash_prepare(struct splash *splash, int enabled)
@@ -36,7 +41,7 @@
splash->finish  = splash_dummy_int_void;
splash->progress= splash_dummy_int_int;
splash->switch_to   = splash_dummy_void_void;
-   splash->getchar = getchar;
+   splash->dialog  = splash_dialog;
 #ifdef CONFIG_ENCRYPT
splash->read_password   = read_password;
 #else
@@ -51,13 +56,13 @@
splash->finish  = bootsplash_finish;
splash->progress= bootsplash_progress;
splash->switch_to   = bootsplash_switch_to;
-   splash->getchar = bootsplash_getchar;
+   splash->dialog  = bootsplash_dialog;
splash->read_password = bootsplash_read_password;
 #ifdef CONFIG_SPLASHY
} else if (!splashy_open()) {
splash->finish  = splashy_finish;
splash->progress= splashy_progress;
-   splash->getchar = splashy_getchar;
+   splash->dialog  = splashy_dialog;
splash->read_password   = splashy_read_password;
 
 #endif
Index: splash.h
===
diff -u -r1.2 splash.h
--- splash.h14 Sep 2006 14:18:58 -  1.2
+++ splash.h18 Sep 2006 09:26:50 -
@@ -14,11 +14,11 @@
 
 /* generic interface functions for an arbitary splash method */

Re: [Suspend-devel] [PATCH] smooth image writeout progress display

2006-09-18 Thread Tim Dijkstra
On Sun, 17 Sep 2006 20:05:29 -0400
Jason Lunz <[EMAIL PROTECTED]> wrote:

> 
> Increase the granularity of calls to start_writeout() when
> early_writeout is used. This results in a smooth progress display
> during writeout, rather than a noticeable pause each 20% of the way
> through.

Yes, I noticed this too on some machines.

> I think performance shouldn't be hurt, since we're still batching
> pages 1% at a time, down from 20%. A normal image has 10's of
> thousands of pages (mine 512M laptop is ~55000 pages, for example) so
> 1% is still~500 pages or ~2M at a time.

I don't know to if it would impact performance, somebody else
should think a bit more about that maybe. The option (early writeout) is
configurable however, so people can shut it of if they think it slows
writing down.
 
The patch looks OK to me.


> Jason
> 
> ---
>  suspend.c |5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> Index: suspend-0.2/suspend.c
> ===
> --- suspend-0.2.orig/suspend.c
> +++ suspend-0.2/suspend.c
> @@ -416,8 +416,9 @@
>   m = nr_pages / 100;
>   if (!m)
>   m = 1;
> - writeout_rate = nr_pages / 5;
> - if (!writeout_rate || !early_writeout)
> + if (early_writeout)
> + writeout_rate = m;
> + else
>   writeout_rate = nr_pages;
>   nr_pages = 0;
>   do {


-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Make splash.getchar show prompt

2006-09-18 Thread Tim Dijkstra
On Mon, 18 Sep 2006 11:35:56 +0200
Tim Dijkstra <[EMAIL PROTECTED]> wrote:

> Index: bootsplash.h
> ===
> diff -u -r1.2 bootsplash.h
> --- bootsplash.h  14 Sep 2006 14:18:58 -  1.2
> +++ bootsplash.h  18 Sep 2006 09:26:50 -
> @@ -18,6 +18,6 @@
>  int bootsplash_progress(int p);
>  void bootsplash_switch_to(void);
>  void bootsplash_read_password(char *, int);
> -int bootsplash_getchar(void);
> +int bootsplash_dialog(void);

Oops, should be

+int bootsplash_dialog(const char *);

 grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] smooth image writeout progress display

2006-09-18 Thread Tim Dijkstra
On Mon, 18 Sep 2006 12:01:05 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > > I think performance shouldn't be hurt, since we're still batching
> > > pages 1% at a time, down from 20%. A normal image has 10's of
> > > thousands of pages (mine 512M laptop is ~55000 pages, for example) so
> > > 1% is still~500 pages or ~2M at a time.
> > 
> > I don't know to if it would impact performance, somebody else
> > should think a bit more about that maybe. The option (early writeout) is
> > configurable however, so people can shut it of if they think it slows
> > writing down.
> >  
> > The patch looks OK to me.
> 
> Well, patch does not look too bad to me, but...
> 
> "It is an option, so it is not important to get it right" is ugly. 

That was not what I said. I meant to say, that it could be that people
find it more important that the progress bar runs nice and smoothly,
than that it takes a few seconds longer.

> It would be nice to actually benchmark this, and hardcode the option that
> provides acceptable performance...

Sure, maybe Jason can provide some numbers. 

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] smooth image writeout progress display

2006-09-18 Thread Tim Dijkstra
On Mon, 18 Sep 2006 13:27:19 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> On Monday, 18 September 2006 13:17, Pavel Machek wrote:
> > > > "It is an option, so it is not important to get it right" is
> > > > ugly. It would be nice to actually benchmark this,
> > > 
> > > Agreed.
> > > 
> > > > and hardcode the option that provides acceptable performance...
> > > 
> > > That would be difficult, because it changes substantially from one
> > > machine to another (depends on the CPU speed, hard disk speed
> > > etc.).
> > 
> > Well, our task is "write image to disk, as fast as possible". That
> > should be doable, no?
> 
> The problem is on some machines the early writeout hurts performance
> and improves it on some others ...
> 
> > > But I think it only is useful with splash, isn't it?  

I don't really know, but the HOWTO says 'early writeout' actually speeds the
process up on some machines. 

> > > If so, we can hardcode something reasonable that will be used if
> > > splash_param is set and won't be used at all otherwise.
> > 
> > Hmm.. we can probably do that. Is smoothly-running progressbar
> > really all that important?

Apparently it is important to Jason;)

For me, it all depends on how much the trade of is. If it is an
unnoticeable difference (1-2 seconds) on average hardware, than I would
rather have a smooth progress bar. If it is more than that ...

grts Tim



-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Make splash.getchar show prompt

2006-09-18 Thread Tim Dijkstra
On Mon, 18 Sep 2006 11:50:45 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:
> > 
> > > Can we rename this thing to splash.dialog()?  I don't think .getchar()
> > > should print.
> > 
> > Sound sensible ;)
> > 
> > > The rest looks good, but I think we should ask Holger if he agrees with 
> > > it.
> > 
> > _This_ patch doesn't changes anything for bootsplash.org, it just
> > reorders some things. It could be, however, that the VT switch locking
> > has some advert effect.
> > 
> > Here's the patch. I renamed getchar to dialog and removed some white space.
> 
> Looks okay to me, please commit... 

done.


> > -int bootsplash_getchar (void)
> > +int bootsplash_dialog (const char *prompt)
> ~- this space can die, too.
>   Pavel

Argg, die, white space, die!

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Suspend read/write "benchmarks"

2006-09-19 Thread Tim Dijkstra
On Tue, 19 Sep 2006 21:33:14 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> On Tuesday, 19 September 2006 20:31, Pavel Machek wrote:
> > > > > I'd say this is in agreement with the LZF documentation I
> > > > > read.  It says the _decompression_ should be (almost) as fast
> > > > > as a "bare" read, and there's much less data to read if they
> > > > > are compressed.  However, _compression_ takes time which
> > > > > offsets the gain resulting from the decreased amount of data
> > > > > to write.
> > > > 
> > > > Then Nigel is doing something clever and we do something stupid.
> > > 
> > > Well, I don't think we do anything stupid.  Of course you're free
> > > to review the code anyway. ;-)
> > > 
> > > Nigel may be using another version of the LZF algorithm which is
> > > optimized for speed.  I didn't experiment with libLZF too much,
> > > so we're just using the default settings.  Still AFAIR it is
> > > configurable to some extent.
> > 
> > Maybe we can just ask Nigel? ;-).
> > 
> > > > > > - early writeout is as fast with 1% steps as it is with 20%
> > > > > > steps. It does not really matter in my tests (this is why i
> > > > > > did not retry compression with 20% steps).
> > > > > 
> > > > > This is what we wanted to verify. ;-)
> > > > 
> > > > For one machine, we'd probably need to test more machines.
> > > 
> > > Yes, certainly.
> > 
> > I'd go for 1% steps. If someone finds it slows his machine down,
> > he's the one that needs to do the benchmarking.
> 
> I guess this means we should apply the Jason's patch?

Should we also make early write the default? If I followed the thread,
I think the conclusion was that it is faster, right?

grts Tim 


signature.asc
Description: PGP signature
-
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


Re: [Suspend-devel] Suspend read/write "benchmarks"

2006-09-20 Thread Tim Dijkstra
On Wed, 20 Sep 2006 01:01:26 +0200
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> On Wednesday, 20 September 2006 00:07, Pavel Machek wrote:
> > Hi!
> > 
> > > > > > > Yes, certainly.
> > > > > > 
> > > > > > I'd go for 1% steps. If someone finds it slows his machine down,
> > > > > > he's the one that needs to do the benchmarking.
> > > > > 
> > > > > I guess this means we should apply the Jason's patch?
> > > > 
> > > > Should we also make early write the default? If I followed the thread,
> > > > I think the conclusion was that it is faster, right?
> > > 
> > > Yes, I think we can do that, but let's leave the option to swich it off, 
> > > at
> > > least for now.
> > 
> > Ok, Rafael, can you do the commits? ;-).
> 
> Generally, I can, but not in the nearest future.

Well, it is not a very big commit, and I had it in my working dir
already so I commited it. For the good order of things, this was the diff:



Index: suspend.c
===
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.53
diff -u -r1.53 suspend.c
--- suspend.c   16 Sep 2006 12:52:54 -  1.53
+++ suspend.c   20 Sep 2006 07:40:11 -
@@ -417,8 +417,9 @@
m = nr_pages / 100;
if (!m)
m = 1;
-   writeout_rate = nr_pages / 5;
-   if (!writeout_rate || !early_writeout)
+   if (early_writeout)
+   writeout_rate = m
+   else
writeout_rate = nr_pages;
nr_pages = 0;
do {
@@ -1122,8 +1123,8 @@
if (splash_param != 'y' && splash_param != 'Y')
splash_param = 0;
  
-   if (early_writeout != 'y' && early_writeout != 'Y')
-   early_writeout = 0;
+   if (early_writeout != 'n' && early_writeout != 'N')
+   early_writeout = 1;
  
page_size = getpagesize();
buffer_size = BUFFER_PAGES * page_size;

-
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


[Suspend-devel] Don't make /dev/snapshot patch

2006-09-20 Thread Tim Dijkstra
Hi,

Many people have udev, which will make /dev/snapshot dynamically if
support is available in the kernel. And if it didn't, making it from the
Makefile wouldn't be a solution because it would disappear on the next
reboot.
This patch adds another CONFIG option to the Makefile to not make /dev/snapshot.

Index: Makefile
===
RCS file: /cvsroot/suspend/suspend/Makefile,v
retrieving revision 1.37
diff -u -u -r1.37 Makefile
--- Makefile17 Sep 2006 18:41:23 -  1.37
+++ Makefile20 Sep 2006 09:52:14 -
@@ -1,6 +1,7 @@
 #CONFIG_COMPRESS=yes
 #CONFIG_ENCRYPT=yes
 #CONFIG_SPLASHY=yes
+#CONFIG_UDEV=yes
 
 ARCH:=$(shell uname -m)
 
@@ -30,6 +31,12 @@
 S2DISK=s2disk
 CONFIGFILE=suspend.conf
 
+ifndef CONFIG_UDEV
+SNAPSHOT=$(DESTDIR)/dev/snapshot
+else
+SNAPSHOT=
+endif
+
 ifdef CONFIG_ENCRYPT
 all: $(S2DISK) $(S2BOTH) suspend-keygen resume s2ram
 else
@@ -118,27 +125,23 @@
 suspend-keygen:md5.o keygen.c encrypt.h md5.h
$(CC) $(CFLAGS) -DHAVE_INTTYPES_H -DHAVE_STDINT_H $(CC_FLAGS) md5.o 
keygen.c -o suspend-keygen $(LD_FLAGS)
 
-install-s2disk: $(S2DISK) suspend-keygen conf/$(CONFIGFILE)
-   if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
+install-s2disk: $(S2DISK) suspend-keygen conf/$(CONFIGFILE) $(SNAPSHOT)
install --mode=755 suspend-keygen $(DESTDIR)$(SUSPEND_DIR)
install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install 
--mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else 
install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR); fi
 
-install-suspend: $(S2DISK) $(S2BOTH) suspend-keygen conf/$(CONFIGFILE)
-   if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
+install-suspend: $(S2DISK) $(S2BOTH) suspend-keygen conf/$(CONFIGFILE) 
$(SNAPSHOT)
install --mode=755 suspend-keygen $(DESTDIR)$(SUSPEND_DIR)
install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
install --mode=755 $(S2BOTH) $(DESTDIR)$(SUSPEND_DIR)
if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install 
--mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else 
install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR); fi
install --mode=755 s2ram $(DESTDIR)$(SUSPEND_DIR)
 else
-install-s2disk: $(S2DISK) conf/$(CONFIGFILE)
-   if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
+install-s2disk: $(S2DISK) conf/$(CONFIGFILE) $(SNAPSHOT)
install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install 
--mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else 
install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR); fi
 
-install-suspend: $(S2DISK) $(S2BOTH) conf/$(CONFIGFILE)
-   if [ ! -c /dev/snapshot ]; then mknod /dev/snapshot c 10 231; fi
+install-suspend: $(S2DISK) $(S2BOTH) conf/$(CONFIGFILE) $(SNAPSHOT)
install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
install --mode=755 $(S2BOTH) $(DESTDIR)$(SUSPEND_DIR)
if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install 
--mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else 
install --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR); fi
@@ -151,3 +154,6 @@
 install-resume:resume 
./scripts/install-resume.sh
 
+$(SNAPSHOT):
+   mknod $(SNAPSHOT) c 10 231;
+   

-
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


Re: [Suspend-devel] Don't make /dev/snapshot patch

2006-09-20 Thread Tim Dijkstra
On Wed, 20 Sep 2006 12:44:46 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > Many people have udev, which will make /dev/snapshot dynamically if
> > support is available in the kernel. And if it didn't, making it from the
> > Makefile wouldn't be a solution because it would disappear on the next
> > reboot.
> > This patch adds another CONFIG option to the Makefile to not make
> > /dev/snapshot.
> 
> Otoh if we do not have udev, we make a /dev/snapshot (and nothing bad
> happens), and if we do not have udev, we make a /dev/snapshot and it
> helps us... So... why does this need to be configurable?

Well, another reason is that, when building a package and installing
with DESTDIR, the makefile will fail because of lack of privileges.

Separate from other arguments, I think the patch also cleans up the
Makefile. It introduces a separate target for /dev/snapshot, which 
removes quadruplication of code.

Granted I could remove the configurability by replacing

+ifndef CONFIG_UDEV
+SNAPSHOT=$(DESTDIR)/dev/snapshot
+endif

with

+SNAPSHOT=$(DESTDIR>/dev/snapshot

But I think those two lines do not hurt and saves packagers (me;) the
bother of having to edit the makefile everytime they sync with upstream.

grts Tim

-
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


Re: [Suspend-devel] Don't make /dev/snapshot patch

2006-09-20 Thread Tim Dijkstra
On Wed, 20 Sep 2006 14:38:53 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> On Wed 2006-09-20 14:20:19, Stefan Seyfried wrote:
> > On Wed, Sep 20, 2006 at 02:12:30PM +0200, Tim Dijkstra wrote:
> > 
> > > But I think those two lines do not hurt and saves packagers (me;) the
> > > bother of having to edit the makefile everytime they sync with upstream.
> > 
> > ACK. I also have to edit out the mknod in my build. This option saves me
> > a local patch.
> 
> Ok, ok, go ahead with the commit.
> 
> (Or could we do mknod ... || echo "Note enough permissions, hope you
> are using udev" to make error message non-fatal?)

I left the default at mknod'ing /dev/snapshot. Also s2disk will complain
loudly if it can't find /dev/snapshot.
So I don't think we need a message.

grts Tim

-
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


Re: [Suspend-devel] freeze everything but s2ram?

2006-10-06 Thread Tim Dijkstra
On Fri, 6 Oct 2006 15:54:08 +0200
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> i just had an idea :-)
> 
> Is it possible, by using the uswsusp infrastructure, to freeze everything
> but the s2ram process during suspend to RAM? I mean the following:
> 
> start s2ram
> - chvt away from X
> - freeze everything else
> - save video state etc.
> - echo mem > /sys/power/state
> - post video etc.
> - thaw everything else
> 
> When doing it this way, nothing could interfere with video POST (on some
> machines the VBE calls take some seconds, the user might already press
> ALT-F7 in the meantime), the whole video resume business would be "almost"
> in-kernel.
> 
> Is this a good idea? Is it doable?

Just curious; why do you ever want to do s2ram instead of s2disk?

grts Tim


signature.asc
Description: PGP signature
-
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


Re: [Suspend-devel] freeze everything but s2ram?

2006-10-06 Thread Tim Dijkstra
On Fri, 6 Oct 2006 21:58:40 +0200
Tim Dijkstra <[EMAIL PROTECTED]> wrote:

> On Fri, 6 Oct 2006 15:54:08 +0200
> Stefan Seyfried <[EMAIL PROTECTED]> wrote:
> 
> > Hi,
> > 
> > i just had an idea :-)
> > 
> > Is it possible, by using the uswsusp infrastructure, to freeze everything
> > but the s2ram process during suspend to RAM? I mean the following:
> > 
> > start s2ram
> > - chvt away from X
> > - freeze everything else
> > - save video state etc.
> > - echo mem > /sys/power/state
> > - post video etc.
> > - thaw everything else
> > 
> > When doing it this way, nothing could interfere with video POST (on some
> > machines the VBE calls take some seconds, the user might already press
> > ALT-F7 in the meantime), the whole video resume business would be "almost"
> > in-kernel.
> > 
> > Is this a good idea? Is it doable?
> 
> Just curious; why do you ever want to do s2ram instead of s2disk?

I meant s2both, duh...

grts Tim


signature.asc
Description: PGP signature
-
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


Re: [Suspend-devel] freeze everything but s2ram?

2006-10-07 Thread Tim Dijkstra
On Sat, 7 Oct 2006 14:51:31 +0200
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> On Fri, Oct 06, 2006 at 10:30:25PM +0200, Tim Dijkstra wrote:
> 
> > > Just curious; why do you ever want to do s2ram instead of s2disk?
> > 
> > I meant s2both, duh...
> 
> It's a waste of battery power.
> 
> s2ram only takes about two seconds, alone the "snapshotting machine" takes
> at least 10 seconds on my machines.
> With suspend to RAM the machine is already woken up again while suspend to
> disk is not even writing.

That it takes some extra time to suspend is not a problem, IMHO. If I
put it a sleep, I generally want that to be longer than 2 sec ;)
I really like the safety net that s2both provides, but apparently
that's personal;)

grts Tim


signature.asc
Description: PGP signature
-
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


Re: [Suspend-devel] refactor console code / get rid of vt.[ch]

2006-10-08 Thread Tim Dijkstra
On Sat, 7 Oct 2006 20:39:22 +0200
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> good. I'll wait for some mor ACKs before committing, so whoever knows
> something about consoles or had something to do with splash code, please
> take a look at that patch. Thanks.

Looks good to me. It's mostly moving code to console.[ch]
I tested with splashy, that still works.

grts Tim


signature.asc
Description: PGP signature
-
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


[Suspend-devel] [PATCH] Minor change in wording

2006-10-11 Thread Tim Dijkstra
Hi,

I got a bug report telling me that one of the prompts in resume is
confusing and misses a newline. This fixes that.

Index: resume.c
===
RCS file: /cvsroot/suspend/suspend/resume.c,v
retrieving revision 1.32
diff -u -r1.32 resume.c
--- resume.c24 Sep 2006 08:09:59 -  1.32
+++ resume.c11 Oct 2006 18:20:21 -
@@ -758,7 +758,7 @@
while (stat(resume_dev_name, &stat_buf)) {
fprintf(stderr,
"resume: Could not stat the resume device file.\n"
-   "\tPlease type in the file name to try again"
+   "\tPlease type in its full path to try again\n"
"\tor press ENTER to boot the system: ");
fgets(resume_dev_name, MAX_STR_LEN - 1, stdin);
n = strlen(resume_dev_name) - 1;


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Release, maybe?

2006-10-13 Thread Tim Dijkstra
On Fri, 13 Oct 2006 00:43:55 +0200
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > Unfortunately I now have only a little time for programming due to my work
> > on the university, but I hope to be less busy around 11 November, so I'd 
> > like
> > to make a release at that time.

That's a good idea. I have one really small thing related to splash I
want to get in, for the rest I'm pretty content.

> > I think we've got almost everything we wanted (compression, encryption,
> > checksumming, splash support, swap files support) in s2disk and we can do
> > s2both quite reliably, so I guess we can call the release 1.0. ;-)
> 
> I'd call it 0.8, maybe 0.9. It is not widely-enough tested to be
> called 1.0, yet. In fact I do not think it is tested at all :-).

Part of it has had some testing, I've put a cvs snapshot in debian
unstable around end september. It does encryption and compression, no
splash and swap file support.
Apart from some minor details, I haven't had much complains yet.

I do think 1.0 is a bit premature though. There's a few things that
would be nice to have. For one the possibility to cancel the suspend
process. Second, I think we have reconsider the whitelist a bit, it's a
bit of nuisance to have to recompile for every addition. Or maybe that's
a feature? Third, for better integration with HAL and pm-utils I think we 
need the options we have on s2ram for s2both too.

I'm willing to work on this myself, but I first have to get that damn
thesis finished...

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Suspend with cryptsetup encrypted swap?

2006-10-16 Thread Tim Dijkstra
On Mon, 16 Oct 2006 13:26:16 +0200
Matej Cepl <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> is something like this possible? I have here notebook with Fedora Core
> 5 with swap encrypted using cryptsetup create. Is it possible to
> suspend/resume such notebook with ususpend?
> 

Dunno much about encrypted swap, but I would think that wouldn't be a
problem. I imagine that when cryptsetup has run you just have a normal
block device. If that is the case, you just have to setup you swap
partition in your initramfs before you call the resume binary. This
would be just like swap on lvm. Could very well be this works in debian
out of the box already (haven't tested it though...)

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Suspend with cryptsetup encrypted swap?

2006-10-30 Thread Tim Dijkstra
On Sun, 29 Oct 2006 23:15:15 + (UTC)
"Matej Cepl" <[EMAIL PROTECTED]> wrote:

> Jason Lunz scripst:
> > Yes, it works just fine. I've been running a laptop with dm-crypt on
> > swap and root for months now - only /boot is unencrypted.
> 
> That's cool -- more I am thinking about that more I don't understand how
> is something like that possible. Suspend writes to (then encrypted with
> /dev/urandom key) image of the frozen memory, so how can resume decrypt
Random key? 

> it? Or do you have to in the moment swap is not used for swapping anymore,
> remove it and replace it with unencrypted swap (or encrypted only with
> suspend's own resources)?

You have to supply the key which is used for encrypting at the moment 
you setup the encrypted partitions. swap is not different than /home
 
> > on debian unstable, yaird supports it more or less out of the box. In
> > the beginning I had to patch Templates.cfg to add ususpend support, but
> > not anymore iirc. I don't know how fedora generates its initrd.
> 
> I am afraid that it is mkinitrd. I really hoped that I will not be forced
> to compile my own kernel anymore. Oh well :-(.

Note that an initrd/initramfs can be generated apart from compiling the
kernel. On debian it is generated at install time, based on how you configured
your system, I would guess other distros do the same.

grts Tim


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] Avoid modifying file access time after creating the image

2006-10-30 Thread Tim Dijkstra
On Mon, 30 Oct 2006 00:20:50 +0100
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Unfortunately in its current form s2disk causes the access time of the resume
> device special file to be updated after the suspend image has been created,
> which is potentially dangerous.

Why is that dangerous?

grts Tim


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] Allow users to abort image saving

2006-11-02 Thread Tim Dijkstra
Op Thu, 2 Nov 2006 08:07:36 +0100
schreef "Rafael J. Wysocki" <[EMAIL PROTECTED]>:

> Hi,
> 
> The appended patch allows the users of suspend to abort the image
> saving by pressing Ctrl+c.
> 
> Comments welcome.

This is not going to work for splashy. We will need wrap the call to
'read' in the splashy structure and let splashy use some alternative.
It will not be difficult to do, but  I'm a bit busy at the moment. I'll
have some time in a week or two.

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] Allow users to abort image saving

2006-11-02 Thread Tim Dijkstra
Op Thu, 2 Nov 2006 16:10:04 +0100
schreef "Rafael J. Wysocki" <[EMAIL PROTECTED]>:

> On Thursday, 2 November 2006 14:49, Tim Dijkstra wrote:
> > Op Thu, 2 Nov 2006 08:07:36 +0100
> > schreef "Rafael J. Wysocki" <[EMAIL PROTECTED]>:
> > 
> > > Hi,
> > > 
> > > The appended patch allows the users of suspend to abort the image
> > > saving by pressing Ctrl+c.
> > > 
> > > Comments welcome.
> > 
> > This is not going to work for splashy. We will need wrap the call to
> > 'read' in the splashy structure and let splashy use some
> > alternative. It will not be difficult to do, but  I'm a bit busy at
> > the moment. I'll have some time in a week or two.
> 
> Will it break splashy or it just won't work if the splashy is used?

I think it just won't work, it will probably not break. But I think it
can easily made to work. I'll just have to add a non-blocking read
function to libsplashy, which suspend then can call.

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] [PATCH] Allow users to abort image saving

2006-11-02 Thread Tim Dijkstra
On Thu, 2 Nov 2006 17:20:39 +0100
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> On Thursday, 2 November 2006 16:55, Tim Dijkstra wrote:
> > Op Thu, 2 Nov 2006 16:10:04 +0100
> > schreef "Rafael J. Wysocki" <[EMAIL PROTECTED]>:
> > 
> > > On Thursday, 2 November 2006 14:49, Tim Dijkstra wrote:
> > > > Op Thu, 2 Nov 2006 08:07:36 +0100
> > > > schreef "Rafael J. Wysocki" <[EMAIL PROTECTED]>:
> > > > 
> > > > > Hi,
> > > > > 
> > > > > The appended patch allows the users of suspend to abort the image
> > > > > saving by pressing Ctrl+c.
> > > > > 
> > > > > Comments welcome.
> > > > 
> > > > This is not going to work for splashy. We will need wrap the call to
> > > > 'read' in the splashy structure and let splashy use some
> > > > alternative. It will not be difficult to do, but  I'm a bit busy at
> > > > the moment. I'll have some time in a week or two.
> > > 
> > > Will it break splashy or it just won't work if the splashy is used?
> > 
> > I think it just won't work, it will probably not break. But I think it
> > can easily made to work. I'll just have to add a non-blocking read
> > function to libsplashy, which suspend then can call.
> 
> Sounds good, but generally we have two options now: We can apply the patch
> as is and then add the libsplashy function or we can wait with applying the
> patch until the libsplashy function is ready. 
> 
> So, if the patch doesn't break splashy, I'd like to apply it and you will add
> the splashy thing when you have time.  Is that acceptable?

That's fine with me.

grts Tim


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] results report for Dell Inspiron 1300

2006-11-16 Thread Tim Dijkstra
On Thu, 16 Nov 2006 12:26:45 +0100
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> If the framebuffer is really a problem, it might of course be that Tim just
> never tried it with a framebuffer driver.

I don't remember. I will check this when I get my hands on this laptop again.

grts Tim


signature.asc
Description: PGP signature
-
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


[Suspend-devel] Remove useless errror messages

2006-11-29 Thread Tim Dijkstra
Hi guys,

If the kernel doesn't have support for platform mode, uswsusp complains
loudly.

suspend: pm_ops->prepare returned error -1
suspend: Snapshotting system
...
suspend: Saving image data pages ...
suspend: pm_ops->enter returned error -1, calling power_off

These are harmless messages, because it will just fallback to poweroff,
but it confuses users. I propose to remove the messages.

OK to commit?


Index: suspend-cvs20060928/suspend.c
===
--- suspend-cvs20060928/suspend.c   (revision 263)
+++ suspend-cvs20060928/suspend.c   (working copy)
@@ -666,9 +666,6 @@
reboot();
else if (use_platform_suspend) {
int ret = platform_enter(snapshot_fd);
-   if (ret < 0)
-   fprintf(stderr, "suspend: pm_ops->enter returned"
-   " error %d, calling power_off\n", ret);
}
power_off();
/* Signature is on disk, it is very dangerous to continue now.
@@ -706,9 +703,6 @@

if (use_platform_suspend) {
int ret = platform_prepare(snapshot_fd);
-   if (ret < 0)
-   fprintf(stderr, "suspend: pm_ops->prepare returned "
-   "error %d\n", ret);
}

printf("suspend: Snapshotting system\n");

-
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


Re: [Suspend-devel] Remove useless errror messages

2006-11-29 Thread Tim Dijkstra
On Wed, 29 Nov 2006 12:09:02 +0100
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> On Wednesday, 29 November 2006 11:59, Tim Dijkstra wrote:
> > Hi guys,
> > 
> > If the kernel doesn't have support for platform mode, uswsusp complains
> > loudly.
> > 
> > suspend: pm_ops->prepare returned error -1
> > suspend: Snapshotting system
> > ...
> > suspend: Saving image data pages ...
> > suspend: pm_ops->enter returned error -1, calling power_off
> > 
> > These are harmless messages, because it will just fallback to poweroff,
> > but it confuses users. I propose to remove the messages.
> > 
> > OK to commit?
> 
> As far as I'm concerned it's OK, but this is Stefan's code, IIRC, so let's
> wait for him to comment. ;-)

OK. What do you think stefan?

grts Tim

-
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


Re: [Suspend-devel] Remove useless errror messages

2006-11-30 Thread Tim Dijkstra
Op Thu, 30 Nov 2006 08:11:09 +0100
schreef Stefan Seyfried <[EMAIL PROTECTED]>:

> Hi,
> 
> On Wed, Nov 29, 2006 at 10:16:12PM +0100, Tim Dijkstra wrote:
> > On Wed, 29 Nov 2006 12:09:02 +0100
> > "Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:
> 
> > > On Wednesday, 29 November 2006 11:59, Tim Dijkstra wrote:
> 
> > > > If the kernel doesn't have support for platform mode, uswsusp
> > > > complains loudly.
> > > > 
> > > > suspend: pm_ops->prepare returned error -1
> > > > suspend: Snapshotting system
> > > > ...
> > > > suspend: Saving image data pages ...
> > > > suspend: pm_ops->enter returned error -1, calling power_off
> > > > 
> > > > These are harmless messages, because it will just fallback to
> > > > poweroff, but it confuses users. I propose to remove the
> > > > messages.
> > > > 
> > > > OK to commit?
> > > 
> > > As far as I'm concerned it's OK, but this is Stefan's code, IIRC,
> > > so let's wait for him to comment. ;-)
> > 
> > OK. What do you think stefan?
> 
> I think it would be better to check errno on the first of the ioctls
> and if it says ENOTTY ("not implemented" in our case), then just
> print a harmless "suspend: falling back to shutdown mode" message and
> set use_platform_mode to 0.

> I'll try to do a patch for this if nobody beats me to it :-)
> 
> I don't like to silently ignore such possible errors, even if i have
> not yet seen a machine where they actually happened (other than on an
> too old kernel). This said, reporting the "-1" from the ioctl is of
> course pretty useless ;-)

So by checking errno we can distinguish 'to old
kernel' from 'real error'? If that is the case I would suggest
silently falling back to shutdown for 'to old kernel'.

BTW, what is the first kernel with the correct code? It's not in
2.16.18, is it? Ah, I see they just released 2.6.19, is it in there?

grts Tim

-
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


Re: [Suspend-devel] Remove useless errror messages

2006-11-30 Thread Tim Dijkstra
Op Thu, 30 Nov 2006 13:53:46 +0100
schreef Stefan Seyfried <[EMAIL PROTECTED]>:
 
> > BTW, what is the first kernel with the correct code? It's not in
> > 2.16.18, is it? Ah, I see they just released 2.6.19, is it in there?
> 
> I think it is (i pushed it through Andrew), but i have not checked it.
> "grep SNAPSHOT_PMOPS kernel/power/power.h" should tell you :-)

bzgrep SNAPSHOT_PMOPS patch-2.6.19.bz2

finds nothing, I guess it is not in there then.

grts Tim

-
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


[Suspend-devel] RSA_DATA_SIZE to small

2006-12-11 Thread Tim Dijkstra
Hi,

suspend-keygen fails silently generating keys larger than approximately
3500 bits. The problem is that RSA_DATA_SIZE is to small for the test

if (offset + size >= RSA_DATA_SIZE)

to pass. Although RSA_DATA_SIZE is big enough to accommodate the biggest
keys in practice. The theoretical size the keygen.c code could write to the
buffer is 3072. The patch fixes this.

OK, to commit?

grts Tim


RCS file: /cvsroot/suspend/suspend/encrypt.h,v
retrieving revision 1.5
diff -u -r1.5 encrypt.h
--- encrypt.h   14 Sep 2006 14:18:58 -  1.5
+++ encrypt.h   11 Dec 2006 12:17:18 -
@@ -28,7 +28,7 @@
 #define PK_KEY_SIZE16
 #define PK_CIPHER_BLOCK16
 /* Auxiliary constants */
-#define RSA_DATA_SIZE  2000
+#define RSA_DATA_SIZE  3072
 #define KEY_DATA_SIZE  1000
 #define RSA_FIELDS 6
 #define RSA_FIELDS_PUB 2

-
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


[Suspend-devel] Fw: My machine is not in the whitelist of the s2ram/s2both

2006-12-11 Thread Tim Dijkstra
Hi,

I have one for the whitelist.

OK, to commit?

grts Tim

Begin forwarded message:

Date: Sat, 09 Dec 2006 22:22:44 +0100
From: Andreas Mainik <[EMAIL PROTECTED]>
To: Debian Bug Tracking System <[EMAIL PROTECTED]>
Subject: Bug#402365: uswsusp: My machine is not in the whitelist of the 
s2ram/s2both


Package: uswsusp
Version: 0.3~cvs20060928-4
Severity: normal
Tags: patch


Please insert my machine in the whitelist.

#s2ram -i

This machine can be identified by:
sys_vendor   = "FUJITSU SIEMENS"
sys_product  = "D1547"
sys_version  = ""
bios_version = "4.06  Rev. 1.08.1547"

s2ram -f works fine for me. The workarounds are not needed.
I use Matrox MGA 550 card + Xorg 7.1 + Matrox drivers.
(Xorg-mga-driver does not support DVI.)




--- whitelist.c 27 Nov 2006 10:54:07 -  1.72
+++ whitelist.c 11 Dec 2006 12:47:31 -
@@ -109,6 +109,8 @@
{ "FUJITSU SIEMENS","Amilo A7640 ", "", "", 
VBE_POST|VBE_SAVE|S3_BIOS },
/* reported by Thomas Halva Labella <[EMAIL PROTECTED]> */
{ "FUJITSU SIEMENS","Amilo A7645 ", "", "", 
VBE_SAVE|S3_BIOS|S3_MODE },
+   /* reported by Andreas Mainik <[EMAIL PROTECTED]> */
+   { "FUJITSU SIEMENS","D1547","", "", 0 
},
/* <[EMAIL PROTECTED]>, tested with X only */
{ "FUJITSU SIEMENS","LIFEBOOK S7010",   "", "", 0 
},
/* Eckhart Woerner <[EMAIL PROTECTED]> */

-
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


Re: [Suspend-devel] Fw: My machine is not in the whitelist of the s2ram/s2both

2006-12-11 Thread Tim Dijkstra
On Mon, 11 Dec 2006 14:43:46 +0100
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> On Mon, Dec 11, 2006 at 01:49:44PM +0100, Tim Dijkstra wrote:

> > Please insert my machine in the whitelist.
> > 
> > #s2ram -i
> > 
> > This machine can be identified by:
> > sys_vendor   = "FUJITSU SIEMENS"
> > sys_product  = "D1547"
> > sys_version  = ""
> > bios_version = "4.06  Rev. 1.08.1547"
> > 
> > s2ram -f works fine for me. The workarounds are not needed.
> > I use Matrox MGA 550 card + Xorg 7.1 + Matrox drivers.
> > (Xorg-mga-driver does not support DVI.)
> 
> This is a desktop with non-onboard graphics. I'm not sure we want to
> add such systems to the whitelist.
> What happens if you plug in an NVidia card? Will it still work?
 
> But we should provide an option for s2both to also specify the
> video workarounds.

You are right of course. This of course means that the matching as done know
is broken. 
I haven't tried to see some structure in the whitelist, but isn't there a
pattern that matches with the video cards?

Stefan, do you remember if hal was going the same route in matching? 

grts Tim



-
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


Re: [Suspend-devel] Fw: My machine is not in the whitelist of the s2ram/s2both

2006-12-11 Thread Tim Dijkstra
On Mon, 11 Dec 2006 17:26:01 +0100
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> On Mon, Dec 11, 2006 at 05:01:49PM +0100, Tim Dijkstra wrote:
> 
> > You are right of course. This of course means that the matching as done know
> > is broken. 
> 
> It is "incomplete" as i would put it :-)
> 
> > I haven't tried to see some structure in the whitelist, but isn't there a
> > pattern that matches with the video cards?
> 
> No. We only match for DMI info, not for PCI IDs.

Yes, I know. This has probably been discussed ages ago, but I meant to ask if
we can't distill something like
- machines with graphics chipset X from nvidia need FOO|BAR
- those with chipset Y from ATI need BAR

> > Stefan, do you remember if hal was going the same route in matching? 
> 
> HAL can match on almost anything in its FDI files IIUC. I think you even could
> match on "X driver version foo.bar installed" or maybe "X is running"/"console
> is active".
> 
> Because HAL already has all these matching capabilities, i think it is the
> way to go, means: let HAL determine the needed options, pass them down
> to pm-utils and pm-utils then call s2ram/s2both with the appropriate command
> line to specify the workaround.

Yes. Only that it is a bit annoying that you need hal for something as lowlevel 
as
putting your machine to sleep.

grs TIm

-
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


[Suspend-devel] [PATCH] Move abort logic to spash struct

2007-01-09 Thread Tim Dijkstra
Hi,

To be able to abort suspending while using splashy, we have to move the
abort logic to the splashy struct so it can be overridden when
libsplashy is used for splashy support.

OK to commit?

grts Tim

Index: splash.c
===
RCS file: /cvsroot/suspend/suspend/splash.c,v
retrieving revision 1.4
diff -u -r1.4 splash.c
--- splash.c18 Sep 2006 12:00:09 -  1.4
+++ splash.c9 Jan 2007 15:34:43 -
@@ -16,6 +16,8 @@
 #include "bootsplash.h"
 #include "splashy_funcs.h"
 #include "encrypt.h"
+#include 
+#include 
 
 /**
  * dummy functions in case if no splash system was found or
@@ -32,6 +34,33 @@
printf(prompt);
return getchar();
 }
+static int prepare_abort(struct termios *oldtrm, struct termios *newtrm) {
+int ret;
+
+   ret = !tcgetattr(0, oldtrm);
+if (ret) {
+*newtrm = *oldtrm;
+newtrm->c_cc[VMIN] = 0;
+newtrm->c_cc[VTIME] = 1;
+newtrm->c_iflag = IGNBRK | IGNPAR | ICRNL | IMAXBEL;
+newtrm->c_lflag = 0;
+ret = !tcsetattr(0, TCSANOW, newtrm);
+}
+
+   return ret;
+}
+
+static int key_pressed(const char key){
+   char c;
+   if (read(0, &c, 1) > 0 && c == key) 
+   return 1;
+
+   return 0;
+}
+
+static void restore_abort(struct termios *oldtrm) {
+   tcsetattr(0, TCSANOW, oldtrm);
+}
 
 /* Tries to find a splash system and initializes interface functions */
 void splash_prepare(struct splash *splash, int enabled)
@@ -47,6 +76,9 @@
 #else
splash->read_password   = splash_dummy_readpass;
 #endif
+   splash->prepare_abort   = prepare_abort;
+   splash->restore_abort   = restore_abort;
+   splash->key_pressed = key_pressed;
if (!enabled)
return;
 
Index: splash.h
===
RCS file: /cvsroot/suspend/suspend/splash.h,v
retrieving revision 1.3
diff -u -r1.3 splash.h
--- splash.h18 Sep 2006 12:00:09 -  1.3
+++ splash.h9 Jan 2007 15:34:43 -
@@ -12,6 +12,8 @@
 #ifndef SPLASH_H
 #define SPLASH_H
 
+#include 
+
 /* generic interface functions for an arbitary splash method */
 struct splash {
int (*finish) (void);
@@ -19,6 +21,9 @@
void (*switch_to) (void);
void (*read_password) (char *, int);
int (*dialog) (const char *);
+   int (*prepare_abort) (struct termios *, struct termios *);
+   int (*key_pressed) (const char key);
+   void (*restore_abort) (struct termios *);
 };
 
 void splash_prepare(struct splash *splash, int enabled);
Index: suspend.c
===
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.65
diff -u -r1.65 suspend.c
--- suspend.c   7 Nov 2006 21:13:33 -   1.65
+++ suspend.c   9 Jan 2007 15:34:43 -
@@ -446,7 +446,6 @@
unsigned int m, writeout_rate;
int ret, abort_possible;
struct termios newtrm, savedtrm;
-   char c = 0;
int error = 0;
 
/* Switch the state of the terminal so that we can read the keyboard
@@ -454,15 +453,8 @@
 *
 * stdin must be attached to the terminal now.
 */
-   abort_possible = !tcgetattr(0, &savedtrm);
-   if (abort_possible) {
-   newtrm = savedtrm;
-   newtrm.c_cc[VMIN] = 0;
-   newtrm.c_cc[VTIME] = 1;
-   newtrm.c_iflag = IGNBRK | IGNPAR | ICRNL | IMAXBEL;
-   newtrm.c_lflag = 0;
-   abort_possible = !tcsetattr(0, TCSANOW, &newtrm);
-   }
+   abort_possible = splash.prepare_abort(&savedtrm, &newtrm);
+
if (abort_possible)
printf("suspend: Saving %u image data pages "
"(press " ABORT_KEY_NAME " to abort) ... ",
@@ -491,13 +483,11 @@
if (!(nr_pages % m)) {
printf("\b\b\b\b%3d%%", nr_pages / m);
splash.progress(20 + (nr_pages / m) * 0.75);
-   if (abort_possible) {
-   ret = read(0, &c, 1);
-   if (ret > 0 && c == ABORT_KEY_CODE) {
-   printf(" aborted!\n");
-   return -EINTR;
-   }
-   ret = 1;
+   if (abort_possible && 
+   splash.key_pressed(ABORT_KEY_CODE) ) {
+
+   printf(" aborted!\n");
+   return -EINTR;
}
}
if (!(nr_pages % writeout_rate))
@@ -513,7 +503,7 @@
printf(" done (%u pages)\n", nr_pa

Re: [Suspend-devel] [PATCH] Move abort logic to spash struct

2007-01-10 Thread Tim Dijkstra
On Wed, 10 Jan 2007 08:38:13 +0100
Pavel Machek <[EMAIL PROTECTED]> wrote:


> > +ret = !tcgetattr(0, oldtrm);
>  
> > +if (ret) {
> > +*newtrm = *oldtrm;
> > +newtrm->c_cc[VMIN] = 0;
> > +newtrm->c_cc[VTIME] = 1;
> > +newtrm->c_iflag = IGNBRK | IGNPAR | ICRNL | IMAXBEL;
> > +newtrm->c_lflag = 0;
> > +ret = !tcsetattr(0, TCSANOW, newtrm);
> > +}
> > +
> > +return ret;
> > +}
> 
> Normal error convention is 0 for success, -ERRNO for a problem. This
> seems to use something different.

The return value of this function is put into `abort_possible' which 
is used as a boolean in the rest of the code.

abort_possible = splash.prepare_abort(&savedtrm, &newtrm);

I could of course reverse the logic here in:

prepare_abort {
ret = tcgetattr(0, oldtrm)

if (!ret) {

ret = tcsetattr(0, TCSANOW, newtrm);
}

return ret;
}

...

abort_possible = !splash.prepare_abort(&savedtrm, &newtrm);


Would that be better?


> > +   printf(" aborted!\n");
> > +   return -EINTR;
> > }
> 
> Do we want to do something else than printf() in splash case here?

Mayb. For now all printf are hidden by the splash screen.
They only get a progress bar, that is what they asked for...


grts Tim

-
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


Re: [Suspend-devel] [PATCH] Move abort logic to spash struct

2007-01-10 Thread Tim Dijkstra
Hi,

Here is an updated patch:

Index: splash.c
===
RCS file: /cvsroot/suspend/suspend/splash.c,v
retrieving revision 1.4
diff -u -r1.4 splash.c
--- splash.c18 Sep 2006 12:00:09 -  1.4
+++ splash.c10 Jan 2007 11:43:45 -
@@ -16,6 +16,8 @@
 #include "bootsplash.h"
 #include "splashy_funcs.h"
 #include "encrypt.h"
+#include 
+#include 
 
 /**
  * dummy functions in case if no splash system was found or
@@ -32,6 +34,36 @@
printf(prompt);
return getchar();
 }
+static int prepare_abort(struct termios *oldtrm, struct termios *newtrm) 
+{
+   int ret;
+
+   ret = tcgetattr(0, oldtrm);
+   if (!ret) {
+   *newtrm = *oldtrm;
+   newtrm->c_cc[VMIN] = 0;
+   newtrm->c_cc[VTIME] = 1;
+   newtrm->c_iflag = IGNBRK | IGNPAR | ICRNL | IMAXBEL;
+   newtrm->c_lflag = 0;
+   ret = tcsetattr(0, TCSANOW, newtrm);
+   }
+
+   return ret;
+}
+
+static int key_pressed(const char key)
+{
+   char c;
+   if (read(0, &c, 1) > 0 && c == key) 
+   return 1;
+
+   return 0;
+}
+
+static void restore_abort(struct termios *oldtrm) 
+{
+   tcsetattr(0, TCSANOW, oldtrm);
+}
 
 /* Tries to find a splash system and initializes interface functions */
 void splash_prepare(struct splash *splash, int enabled)
@@ -47,6 +79,9 @@
 #else
splash->read_password   = splash_dummy_readpass;
 #endif
+   splash->prepare_abort   = prepare_abort;
+   splash->restore_abort   = restore_abort;
+   splash->key_pressed = key_pressed;
if (!enabled)
return;
 
Index: splash.h
===
RCS file: /cvsroot/suspend/suspend/splash.h,v
retrieving revision 1.3
diff -u -r1.3 splash.h
--- splash.h18 Sep 2006 12:00:09 -  1.3
+++ splash.h10 Jan 2007 11:43:45 -
@@ -12,6 +12,8 @@
 #ifndef SPLASH_H
 #define SPLASH_H
 
+#include 
+
 /* generic interface functions for an arbitary splash method */
 struct splash {
int (*finish) (void);
@@ -19,6 +21,9 @@
void (*switch_to) (void);
void (*read_password) (char *, int);
int (*dialog) (const char *);
+   int (*prepare_abort) (struct termios *, struct termios *);
+   int (*key_pressed) (const char key);
+   void (*restore_abort) (struct termios *);
 };
 
 void splash_prepare(struct splash *splash, int enabled);
Index: suspend.c
===
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.65
diff -u -r1.65 suspend.c
--- suspend.c   7 Nov 2006 21:13:33 -   1.65
+++ suspend.c   10 Jan 2007 11:43:45 -
@@ -446,7 +446,6 @@
unsigned int m, writeout_rate;
int ret, abort_possible;
struct termios newtrm, savedtrm;
-   char c = 0;
int error = 0;
 
/* Switch the state of the terminal so that we can read the keyboard
@@ -454,15 +453,8 @@
 *
 * stdin must be attached to the terminal now.
 */
-   abort_possible = !tcgetattr(0, &savedtrm);
-   if (abort_possible) {
-   newtrm = savedtrm;
-   newtrm.c_cc[VMIN] = 0;
-   newtrm.c_cc[VTIME] = 1;
-   newtrm.c_iflag = IGNBRK | IGNPAR | ICRNL | IMAXBEL;
-   newtrm.c_lflag = 0;
-   abort_possible = !tcsetattr(0, TCSANOW, &newtrm);
-   }
+   abort_possible = !splash.prepare_abort(&savedtrm, &newtrm);
+
if (abort_possible)
printf("suspend: Saving %u image data pages "
"(press " ABORT_KEY_NAME " to abort) ... ",
@@ -491,13 +483,11 @@
if (!(nr_pages % m)) {
printf("\b\b\b\b%3d%%", nr_pages / m);
splash.progress(20 + (nr_pages / m) * 0.75);
-   if (abort_possible) {
-   ret = read(0, &c, 1);
-   if (ret > 0 && c == ABORT_KEY_CODE) {
-   printf(" aborted!\n");
-   return -EINTR;
-   }
-   ret = 1;
+   if (abort_possible && 
+   splash.key_pressed(ABORT_KEY_CODE)) {
+
+   printf(" aborted!\n");
+   return -EINTR;
}
}
if (!(nr_pages % writeout_rate))
@@ -513,7 +503,7 @@
printf(" done (%u pages)\n", nr_pages);
 
if (abort_possible)
-   tcsetattr(0, TCSANOW, &savedtrm);
+   splash.restore_abort(&savedtrm);
 
return error;
 }


---

[Suspend-devel] resume in /usr/sbin

2007-01-10 Thread Tim Dijkstra
Hi,

I just noticed that the new version of the Makefile installs resume
in /usr/sbin (or whatever you configured $(DESTDIR)$(SUSPEND_DIR) to be).
Is there any reason to do that? It's not that you would be calling it by
hand on a normal running system...

Of course you need the binary on initrd or initramfs. On debian it is
installed under /usr/lib/uswsusp/resume, to signal the fact that it
is a binary not to be used 'by hand'.

grts Tim

-
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


Re: [Suspend-devel] resume in /usr/sbin

2007-01-10 Thread Tim Dijkstra
On Wed, 10 Jan 2007 13:10:49 +0100
Tim Dijkstra <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I just noticed that the new version of the Makefile installs resume
> in /usr/sbin (or whatever you configured $(DESTDIR)$(SUSPEND_DIR) to be).
> Is there any reason to do that? It's not that you would be calling it by
> hand on a normal running system...
> 
> Of course you need the binary on initrd or initramfs. On debian it is
> installed under /usr/lib/uswsusp/resume, to signal the fact that it
> is a binary not to be used 'by hand'.

OK, I updated the Makefile a bit so the directory where resume gets
installed is configurable.
BTW, resume was also missing as an dependency of the install target.

OK to commit?



Index: Makefile
===
RCS file: /cvsroot/suspend/suspend/Makefile,v
retrieving revision 1.44
diff -u -r1.44 Makefile
--- Makefile14 Nov 2006 14:20:47 -  1.44
+++ Makefile10 Jan 2007 12:21:19 -
@@ -23,6 +23,7 @@
 endif
 
 SUSPEND_DIR=/usr/local/sbin
+RESUME_DIR=/usr/local/lib/suspend
 CONFIG_DIR=/etc
 RESUME_DEVICE=
 BOOT_DIR=/boot
@@ -131,25 +132,25 @@
install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install 
--mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else 
install -D --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE); 
fi
 
-install: $(S2DISK) $(S2BOTH) suspend-keygen swap-offset conf/$(CONFIGFILE) 
$(SNAPSHOT)
+install: $(S2DISK) $(S2BOTH) resume suspend-keygen swap-offset 
conf/$(CONFIGFILE) $(SNAPSHOT)
install -D --mode=755 suspend-keygen 
$(DESTDIR)$(SUSPEND_DIR)/suspend-keygen
install --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)
install --mode=755 $(S2BOTH) $(DESTDIR)$(SUSPEND_DIR)
if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install 
--mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else 
install -D --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE); 
fi
install --mode=755 s2ram $(DESTDIR)$(SUSPEND_DIR)
-   install --mode=755 resume $(DESTDIR)$(SUSPEND_DIR)
+   install --mode=755 resume $(DESTDIR)$(RESUME_DIR)
install --mode=755 swap-offset $(DESTDIR)$(SUSPEND_DIR)
 else
 install-s2disk: $(S2DISK) swap-offset conf/$(CONFIGFILE) $(SNAPSHOT)
install -D --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)/$(S2DISK)
if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install 
--mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else 
install -D --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE); 
fi
 
-install: $(S2DISK) $(S2BOTH) swap-offset conf/$(CONFIGFILE) $(SNAPSHOT)
+install: $(S2DISK) $(S2BOTH) resume swap-offset conf/$(CONFIGFILE) $(SNAPSHOT)
install -D --mode=755 $(S2DISK) $(DESTDIR)$(SUSPEND_DIR)/$(S2DISK)
install --mode=755 $(S2BOTH) $(DESTDIR)$(SUSPEND_DIR)
if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then install 
--mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new; else 
install -D --mode=644 conf/$(CONFIGFILE) $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE); 
fi
install --mode=755 s2ram $(DESTDIR)$(SUSPEND_DIR)
-   install --mode=755 resume $(DESTDIR)$(SUSPEND_DIR)
+   install --mode=755 resume $(DESTDIR)$(RESUME_DIR)
install --mode=755 swap-offset $(DESTDIR)$(SUSPEND_DIR)
 endif
 

-
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


Re: [Suspend-devel] [PATCH] writeout_time not saved with CONFIG_ENCRYPT=yes

2007-01-22 Thread Tim Dijkstra
On Mon, 22 Jan 2007 18:48:30 +0100
Michal Schmidt <[EMAIL PROTECTED]> wrote:

> Consider adding this one too. It makes RSA_data itself much smaller. Not 
> all RSA components need to take 512 bytes:

Yes I noticed this too, but it didn't seem relevant at the time. Patch
looks good.

grts Tim

-
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


[Suspend-devel] Reordering in resume 0/2

2007-01-22 Thread Tim Dijkstra
Hi,

I got some bug reports and unwanted behavior by resume. The problem
boiled down to the fact that resume treats 'no image in partition' as a
regular, while it is of course expected behavior on a normal boot.

Some symptoms that will be fixed by these patches
- resume sets console loglevel to some high value on fail (hence also
  on normal boot)
- On normal boot splash gets started really short, just on and off.



First patch is somewhat unrelated. While fixing this I was trying to
get the logic of read_image(). The last part is unnecessary complex. The
if(!error || !ret) should always be true. The only reason I can think
of is reboot() failing. This patch just removes that `if' and adds 
some protection for a failing reboot();


Index: resume.c
===
RCS file: /cvsroot/suspend/suspend/resume.c,v
retrieving revision 1.37
diff -u -r1.37 resume.c
--- resume.c3 Dec 2006 11:29:59 -   1.37
+++ resume.c15 Jan 2007 15:01:53 -
@@ -669,31 +669,35 @@
if (ret) {
close(fd);
reboot();
+   fprintf(stderr,"resume: Reboot failed, please reboot it 
manually.\n");
+   while(1);
}
}
-   if (!error || !ret) {
-   if (!error && verify_checksum) {
-   md5_finish_ctx(&handle.ctx, checksum);
-   if (memcmp(orig_checksum, checksum, 16)) {
-   fprintf(stderr,"resume: MD5 checksum does not 
match\n");
-   fprintf(stderr,"resume: Computed MD5 checksum 
%s\n",
-   print_checksum(buffer, checksum));
-   error = -EINVAL;
-   }
+
+   /* I guess this is after the 'continue boot'-question because
+* there is no sense in not reseting the signature on error */
+   if (!error && verify_checksum) {
+   md5_finish_ctx(&handle.ctx, checksum);
+   if (memcmp(orig_checksum, checksum, 16)) {
+   fprintf(stderr,"resume: MD5 checksum does not match\n");
+   fprintf(stderr,"resume: Computed MD5 checksum %s\n",
+   print_checksum(buffer, checksum));
+   error = -EINVAL;
}
-   /* Reset swap signature now */
-   memcpy(swsusp_header.sig, swsusp_header.orig_sig, 10);
-   if (lseek(fd, shift, SEEK_SET) != shift) {
-   error = -EIO;
-   } else {
-   ret = write(fd, &swsusp_header, size);
-   if (ret != size) {
-   error = ret < 0 ? -errno : -EIO;
-   fprintf(stderr,
-   "resume: Could not restore the 
partition header\n");
-   }
+   }
+   /* Reset swap signature now */
+   memcpy(swsusp_header.sig, swsusp_header.orig_sig, 10);
+   if (lseek(fd, shift, SEEK_SET) != shift) {
+   error = -EIO;
+   } else {
+   ret = write(fd, &swsusp_header, size);
+   if (ret != size) {
+   error = ret < 0 ? -errno : -EIO;
+   fprintf(stderr,
+   "resume: Could not restore the partition 
header\n");
}
}
+
fsync(fd);
close(fd);
 #ifdef CONFIG_ENCRYPT


-
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


[Suspend-devel] Reordering in resume 1/2

2007-01-22 Thread Tim Dijkstra
This adds some functions to get_kernel_console_loglevel, inspired by
those in suspend.c. We could also move parts to a shared file, if
desired. 
Also sets kernel_loglevel back to the original if there were no errors.

--- ../suspend-cvs-1/resume.c   2007-01-15 16:07:41.0 +0100
+++ resume.c2007-01-15 16:47:56.0 +0100
@@ -715,12 +717,13 @@
return error;
 }
 
-static void set_kernel_console_loglevel(int level)
+static FILE *printk_file;
+static int proc_mounted = 0;
+
+static inline void open_printk(void)
 {
-   FILE *file;
struct stat stat_buf;
char *procname = "/proc/sys/kernel/printk";
-   int proc_mounted = 0;
 
if (stat(procname, &stat_buf) && errno == ENOENT) {
if (mount("none", "/proc", "proc", 0, NULL)) {
@@ -729,11 +732,36 @@
} else
proc_mounted = 1;
}
-   file = fopen(procname, "w");
-   if (file) {
-   fprintf(file, "%d\n", level);
-   fclose(file);
-   }
+
+printk_file = fopen(procname, "r+");
+}
+
+static inline int get_kernel_console_loglevel(void)
+{
+int level = -1;
+
+if (printk_file) {
+rewind(printk_file);
+fscanf(printk_file, "%d", &level);
+}
+return level;
+}
+
+static inline void set_kernel_console_loglevel(int level)
+{
+if (printk_file) {
+rewind(printk_file);
+fprintf(printk_file, "%d\n", level);
+fflush(printk_file);
+}
+
+}
+
+static inline void close_printk(void)
+{
+if (printk_file)
+fclose(printk_file);
+
if (proc_mounted)
umount("/proc");
 }
@@ -788,7 +816,7 @@
unsigned int mem_size;
struct stat stat_buf;
int dev;
-   int n, error;
+   int n, error, orig_loglevel;
 
error = get_config(argc, argv);
if (error)
@@ -813,6 +841,10 @@
return error;
}
 
+   open_printk();
+   orig_loglevel = get_kernel_console_loglevel();
+   set_kernel_console_loglevel(suspend_loglevel);
+
while (stat(resume_dev_name, &stat_buf)) {
fprintf(stderr, 
"resume: Could not stat the resume device file '%s'\n"
@@ -830,8 +862,6 @@
resume_dev_name[n] = '\0';
}
 
-   set_kernel_console_loglevel(suspend_loglevel);
-
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
 
@@ -865,9 +895,14 @@
splash.finish();
 Close:
close(dev);
-
-   set_kernel_console_loglevel(max_loglevel);
 Free:
+   if (error)
+   set_kernel_console_loglevel(max_loglevel);
+   else if (orig_loglevel >= 0)
+   set_kernel_console_loglevel(orig_loglevel);
+
+   close_printk();
+
free(mem_pool);
 
return error;

-
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


[Suspend-devel] Reordering in resume 2/2

2007-01-22 Thread Tim Dijkstra
Split the opening of resume_dev and retrieval of the header from
read_image into a new function. That way we can do something else if
everything is OK, but there just isn't an image.
The new function return ENOMEDIUM in case of no image, better
suggestions welcome.


diff -u ../suspend-cvs-1/resume.c ./resume.c
--- ../suspend-cvs-1/resume.c   2007-01-15 16:52:19.0 +0100
+++ ./resume.c  2007-01-20 13:57:36.0 +0100
@@ -531,18 +531,12 @@
 }
 #endif
 
-static int read_image(int dev, char *resume_dev_name)
+static int open_resume_dev(char *resume_dev_name, 
+   struct swsusp_header *swsusp_header)
 {
-   static struct swsusp_header swsusp_header;
-   static struct swap_map_handle handle;
-   static unsigned char orig_checksum[16], checksum[16];
-   int fd, ret, error = 0;
-   struct swsusp_info *header = mem_pool;
-   char *buffer = (char *)mem_pool + page_size;
-   unsigned int nr_pages;
unsigned int size = sizeof(struct swsusp_header);
unsigned int shift = (resume_offset + 1) * page_size - size;
-   char c;
+   int fd, ret;
 
fd = open(resume_dev_name, O_RDWR);
if (fd < 0) {
@@ -552,15 +546,34 @@
}
if (lseek(fd, shift, SEEK_SET) != shift)
return -EIO;
-   ret = read(fd, &swsusp_header, size);
+   ret = read(fd, swsusp_header, size);
if (ret == size) {
-   if (memcmp(SWSUSP_SIG, swsusp_header.sig, 10))
-   return -EINVAL;
+   if (memcmp(SWSUSP_SIG, swsusp_header->sig, 10)) {
+   close(fd);
+   return -ENOMEDIUM;
+   }
} else {
-   error = ret < 0 ? ret : -EIO;
+   ret = ret < 0 ? ret : -EIO;
+   return ret;
}
-   if (!error)
-   error = read_area(fd, header, swsusp_header.image, page_size);
+   
+   return fd;
+}
+
+static int read_image(int dev, int fd, struct swsusp_header *swsusp_header)
+{
+   static struct swap_map_handle handle;
+   static unsigned char orig_checksum[16], checksum[16];
+   int ret, error = 0;
+   struct swsusp_info *header = mem_pool;
+   char *buffer = (char *)mem_pool + page_size;
+   unsigned int nr_pages;
+   unsigned int size = sizeof(struct swsusp_header);
+   unsigned int shift = (resume_offset + 1) * page_size - size;
+   char c;
+
+   error = read_area(fd, header, swsusp_header->image, page_size);
+
if (!error) {
if(header->image_flags & IMAGE_CHECKSUM) {
memcpy(orig_checksum, header->checksum, 16);
@@ -686,11 +699,11 @@
}
}
/* Reset swap signature now */
-   memcpy(swsusp_header.sig, swsusp_header.orig_sig, 10);
+   memcpy(swsusp_header->sig, swsusp_header->orig_sig, 10);
if (lseek(fd, shift, SEEK_SET) != shift) {
error = -EIO;
} else {
-   ret = write(fd, &swsusp_header, size);
+   ret = write(fd, swsusp_header, size);
if (ret != size) {
error = ret < 0 ? -errno : -EIO;
fprintf(stderr,
@@ -813,8 +826,9 @@
 {
unsigned int mem_size;
struct stat stat_buf;
-   int dev;
+   int dev, resume_dev;
int n, error, orig_loglevel;
+   static struct swsusp_header swsusp_header;
 
error = get_config(argc, argv);
if (error)
@@ -869,27 +883,41 @@
goto Free;
}
 
-   splash_prepare(&splash, splash_param);
-   splash.progress(5);
 
dev = open(snapshot_dev_name, O_WRONLY);
if (dev < 0) {
error = ENOENT;
goto Free;
}
-   error = read_image(dev, resume_dev_name);
+
+   resume_dev = open_resume_dev(resume_dev_name, &swsusp_header);
+   if (resume_dev == -ENOMEDIUM) {
+   error = 0;
+   goto Close;
+   } else if (resume_dev < 0) {
+   error = -resume_dev;
+   goto Close;
+   }
+
+   splash_prepare(&splash, splash_param);
+   splash.progress(5);
+
+   error = read_image(dev, resume_dev, &swsusp_header);
if (error) {
fprintf(stderr, "resume: Could not read the image\n");
error = -error;
-   goto Close;
+   goto Close_splash;
}
+
if (freeze(dev)) {
error = errno;
fprintf(stderr, "resume: Could not freeze processes\n");
-   goto Close;
+   goto Close_splash;
}
atomic_restore(dev);
unfreeze(dev);
+
+Close_splash:
splash.finish();
 Close:
close(dev);

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opi

Re: [Suspend-devel] Reordering in resume 0/2

2007-01-23 Thread Tim Dijkstra
On Tue, 23 Jan 2007 10:08:44 +0100
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> On Mon, Jan 22, 2007 at 11:43:21PM +0100, Tim Dijkstra wrote:
> > Hi,
> 
> > First patch is somewhat unrelated. While fixing this I was trying to
> > get the logic of read_image(). The last part is unnecessary complex. The
> > if(!error || !ret) should always be true. The only reason I can think
> > of is reboot() failing. This patch just removes that `if' and adds 
> > some protection for a failing reboot();
> 
> This looks sane, maybe for the failed reboot a 
> 
>   while(1)
>   sleep(1);
> 
> construct would be better (i hate busy loops, even if they can never
> happen :-)

If it makes your day, I'll change that for you;)

grts Tim

-
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


Re: [Suspend-devel] Reordering in resume 2/2

2007-01-23 Thread Tim Dijkstra
On Tue, 23 Jan 2007 13:00:08 +0100
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> On Tuesday, 23 January 2007 10:51, Pavel Machek wrote:
> > Hi!
> > 
> > > Split the opening of resume_dev and retrieval of the header from
> > > read_image into a new function. That way we can do something else if
> > > everything is OK, but there just isn't an image.
> > > The new function return ENOMEDIUM in case of no image, better
> > > suggestions welcome.
> 
> I think EINVAL is also acceptable here.

Well in theory read() could also return a EINVAL, so I can't
distinguish anymore between a failed read and 'no image'.

grts Tim

-
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


Re: [Suspend-devel] Reordering in resume 1/2

2007-01-24 Thread Tim Dijkstra
On Tue, 23 Jan 2007 09:49:27 +
Pavel Machek <[EMAIL PROTECTED]> wrote:

> Hi!
> 
> > This adds some functions to get_kernel_console_loglevel, inspired by
> > those in suspend.c. We could also move parts to a shared file, if
> > desired. 
> 
> Yep, they should move to shared file.

Yes, they were even more equal then I remembered. Well here goes. This
patch introduces loglevel.[ch]

Index: Makefile
===
RCS file: /cvsroot/suspend/suspend/Makefile,v
retrieving revision 1.45
diff -u -r1.45 Makefile
--- Makefile10 Jan 2007 13:24:27 -  1.45
+++ Makefile24 Jan 2007 12:52:19 -
@@ -111,14 +111,14 @@
 splashy_funcs.o: splashy_funcs.c splashy_funcs.h
$(CC) -g $(CFLAGS) $(CC_FLAGS) -c $< -o $@
 
-$(S2DISK): vt.o md5.o encrypt.o config.o suspend.c swsusp.h config.h 
encrypt.h md5.h $(SPLASHOBJ)
-   $(CC) -g $(CFLAGS) $(CC_FLAGS) vt.o md5.o encrypt.o config.o suspend.c 
-o $@ $(SPLASHOBJ) $(LD_FLAGS)
+$(S2DISK): vt.o md5.o encrypt.o config.o loglevel.o suspend.c swsusp.h 
config.h encrypt.h md5.h $(SPLASHOBJ)
+   $(CC) -g $(CFLAGS) $(CC_FLAGS) vt.o md5.o encrypt.o config.o loglevel.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 $(CFLAGS) -DCONFIG_BOTH $(CC_FLAGS) md5.o encrypt.o config.o 
suspend.c s2ram.c -o $@ $(S2RAMOBJ) $(SPLASHOBJ) $(LD_FLAGS) -lpci
+$(S2BOTH): md5.o encrypt.o config.o loglevel.o suspend.c swsusp.h config.h 
encrypt.h md5.h s2ram.c dmidecode.c whitelist.c radeontool.c $(S2RAMOBJ) 
$(SPLASHOBJ)
+   $(CC) -g $(CFLAGS) -DCONFIG_BOTH $(CC_FLAGS) md5.o encrypt.o config.o 
loglevel.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) $(CFLAGS) $(CC_FLAGS) $(STATIC_CC_FLAGS) md5.o encrypt.o config.o 
vt.o resume.c $(SPLASHOBJ) -static -o resume $(LD_FLAGS) $(STATIC_LD_FLAGS)
+resume:md5.o encrypt.o config.o loglevel.o resume.c swsusp.h config.h 
encrypt.h md5.h $(SPLASHOBJ)
+   $(CC) $(CFLAGS) $(CC_FLAGS) $(STATIC_CC_FLAGS) md5.o encrypt.o config.o 
vt.o loglevel.o resume.c $(SPLASHOBJ) -static -o resume $(LD_FLAGS) 
$(STATIC_LD_FLAGS)
 
 swap-offset: swap-offset.c
$(CC) $(CFLAGS) swap-offset.c -o swap-offset
Index: loglevel.c
===
RCS file: loglevel.c
diff -N loglevel.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ loglevel.c  24 Jan 2007 12:52:19 -
@@ -0,0 +1,63 @@
+/* loglevel.c - routines to modify kernel console loglevel
+ *
+ * Released under GPL v2.
+ * (c) 2007 Tim Dijkstra
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+static FILE *printk_file;
+static int proc_mounted = 0;
+
+inline void open_printk(void)
+{
+   struct stat stat_buf;
+   char *procname = "/proc/sys/kernel/printk";
+
+   if (stat(procname, &stat_buf) && errno == ENOENT) {
+   if (mount("none", "/proc", "proc", 0, NULL)) {
+   fprintf(stderr, "resume: Could not mount proc\n");
+   return;
+   } else
+   proc_mounted = 1;
+   }
+
+printk_file = fopen(procname, "r+");
+}
+
+inline int get_kernel_console_loglevel(void)
+{
+int level = -1;
+
+if (printk_file) {
+rewind(printk_file);
+fscanf(printk_file, "%d", &level);
+}
+return level;
+}
+
+inline void set_kernel_console_loglevel(int level)
+{
+if (printk_file) {
+rewind(printk_file);
+fprintf(printk_file, "%d\n", level);
+fflush(printk_file);
+}
+
+}
+
+inline void close_printk(void)
+{
+if (printk_file)
+fclose(printk_file);
+
+   if (proc_mounted)
+   umount("/proc");
+}
+
Index: loglevel.h
===
RCS file: loglevel.h
diff -N loglevel.h
--- /dev/null   1 Jan 1970 00:00:00 -
+++ loglevel.h  24 Jan 2007 12:52:19 -
@@ -0,0 +1,10 @@
+/* loglevel.h - routines to modify kernel console loglevel
+ *
+ * Released under GPL v2.
+ * (c) 2007 Tim Dijkstra
+ */
+
+inline void open_printk(void);
+inline int get_kernel_console_loglevel(void);
+inline void set_kernel_console_loglevel(int level);
+inline void close_printk(void);
Index: resume.c
===
RCS file: /cvsroot/suspend/suspend/resume.c,v
retrieving revision 1.38
diff -u -r1.38 resume.c
--- resume.c24 Jan 2007 12:41:40 -  1.38
+++ resume.c24 Jan 2007 12

[Suspend-devel] getconsolefd

2007-01-24 Thread Tim Dijkstra
Hi,

I was skimming trough the code some more when I found some more
duplicated code. getconsolefd in vt.c and console_fd suspend.c. The
differences are that console_fd opens like:

  fd = open(fname, O_RDONLY);
   if (fd < 0 && errno == EACCES)
   fd = open(fname, O_WRONLY);

and getconsolefd

fd = open(fnam, O_RDWR);
if (fd < 0)
return -1;

Also getconsolefd tries a bunch of device nodes, while console_fd only
tries /dev/console.

Attached patch makes resume use getconsolefd.

What do you think?

--- suspend.c   2007-01-24 13:43:55.0 +0100
+++ suspend.c   2007-01-24 14:02:54.0 +0100
@@ -828,26 +828,6 @@
return error;
 }
 
-/**
- * console_fd - get file descriptor for given file name and verify
- * if that's a console descriptor (based on the code of openvt)
- */
-
-static inline int console_fd(const char *fname)
-{
-   int fd;
-   char arg;
-
-   fd = open(fname, O_RDONLY);
-   if (fd < 0 && errno == EACCES)
-   fd = open(fname, O_WRONLY);
-   if (fd >= 0 && (ioctl(fd, KDGKBTYPE, &arg) || (arg != KB_101 && arg != 
KB_84))) {
-   close(fd);
-   return -ENOTTY;
-   }
-   return fd;
-}
-
 #ifndef TIOCL_GETKMSGREDIRECT
 #define TIOCL_GETKMSGREDIRECT  17
 #endif
@@ -867,7 +847,7 @@
struct vt_stat vtstat;
char clear_vt, tiocl[2];
 
-   fd = console_fd("/dev/console");
+   fd = getconsolefd();
if (fd < 0)
return fd;
 

-
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


[Suspend-devel] Cleaning up Makefile

2007-01-25 Thread Tim Dijkstra
Hi,

While adding the loglevel.[ch], I've got a bit annoyed with the
makefile, it has duplication of stuff all over it. I'm planning to
clean it up a bit. Some question before I do that.

Doe any body mind if I rename the target
install-resume => install-resume-on-initrd

and
install-resume-initrd => install-resume-new-initrd

To better reflect what they do?

Why is it whitelist.c and whitelist.h?


Naturally I'll update the howto.


grts Tim

-
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


Re: [Suspend-devel] Cleaning up Makefile

2007-01-25 Thread Tim Dijkstra
On Thu, 25 Jan 2007 19:04:37 +0100
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> > Why is it whitelist.c and whitelist.h?  
 /\
forgot a NOT here ---/

> 
> I only have whitelist.c?

I mean it is more a header file, we don't compile it, it is included. I
would think the proper name to call it is: whitelist.h. 

grts Tim

-
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


[Suspend-devel] New Makefile

2007-01-31 Thread Tim Dijkstra
Hi,

Here is my shot at a new Makefile. What do you think?

grts Tim


===



#CONFIG_COMPRESS=yes
#CONFIG_ENCRYPT=yes
#CONFIG_SPLASHY=yes
#CONFIG_UDEV=yes
#CONFIG_RESUME_DYN=yes

SUSPEND_DIR=/usr/local/sbin
RESUME_DIR=/usr/local/lib/suspend
CONFIG_DIR=/etc
RESUME_DEVICE=
BOOT_DIR=/boot
CONFIGFILE=suspend.conf
CFLAGS := -O2 -Wall

###

ARCH:=$(shell uname -m)

CC_FLAGS=-I/usr/local/include -DS2RAM $(CFLAGS)
LD_FLAGS=-L/usr/local/lib

BINARIES=s2disk s2both s2ram swap-offset resume
BINARIES_MIN=s2disk swap-offset

S2RAM_OBJ=vt.o vbetool/x86-common.o vbetool/vbetool.o radeontool.o dmidecode.o
SWSUSP_OBJ=vt.o md5.o encrypt.o config.o loglevel.o splash.o bootsplash.o 

S2RAM_LD_FLAGS = $(LD_FLAGS) -lpci
SWSUSP_LD_FLAGS = $(LD_FLAGS)

ifeq ($(ARCH), x86_64)
S2RAM_OBJ+=vbetool/thunk.o vbetool/x86emu/libx86emu.a 
else
S2RAM_OBJ+=vbetool/lrmi.o
endif

ifndef CONFIG_RESUME_DYN
STATIC_LD_FLAGS = -static
endif

ifdef CONFIG_COMPRESS
CC_FLAGS+= -DCONFIG_COMPRESS
SWSUSP_LD_FLAGS += -llzf
endif

ifdef CONFIG_ENCRYPT
BINARIES+= suspend-keygen 
BINARIES_MIN+= suspend-keygen 
CC_FLAGS+= -DCONFIG_ENCRYPT
GCRYPT_CC_FLAGS = $(shell libgcrypt-config --cflags)
SWSUSP_CC_FLAGS += $(GCRYPT_CC_FLAGS)
GCRYPT_LD_FLAGS = $(shell libgcrypt-config --libs)
SWSUSP_LD_FLAGS += $(GCRYPT_LD_FLAGS)
INSTALL_KEYGEN  = install-keygen
endif

ifndef CONFIG_UDEV
SNAPSHOT=$(DESTDIR)/dev/snapshot
endif

ifdef CONFIG_SPLASHY
SWSUSP_OBJ  += splashy_funcs.o 
CC_FLAGS+= -DCONFIG_SPLASHY
SWSUSP_LD_FLAGS += -lsplashy
ifndef CONFIG_RESUME_DYN
STATIC_LD_FLAGS += -lsplashycnf \
$(shell directfb-config  --libs --input=keyboard \
--imageprovider=jpeg,gif,png\
--font=ft2,default) \
$(shell pkg-config --static --libs glib-2.0)
STATIC_CC_FLAGS=$(shell directfb-config --cflags)\
$(shell pkg-config --static --cflags glib-2.0)
endif
endif

all: $(BINARIES)

clean:
rm -f $(BINARIES) suspend-keygen suspend.keys *.o vbetool/*.o 
vbetool/x86emu/*.o vbetool/x86emu/*.a


 Rules for objects
vbetool/x86emu/libx86emu.a:
make -C vbetool/x86emu -f makefile.linux

s2ram-both.o: s2ram.c s2ram.h whitelist.c
$(CC) $(CC_FLAGS) -DCONFIG_BOTH -c $< -o $@

s2ram.o: s2ram.c s2ram.h whitelist.c
$(CC) $(CC_FLAGS) -c $< -o $@

md5.o encrypt.o: %.o : %.c %.h md5.h
$(CC) $(CC_FLAGS) -DHAVE_INTTYPES_H -DHAVE_STDINT_H -c $< -o $@

# Simple objects with header
config.o vt.o bootsplash.o splash.o splashy_funcs.o vbetool/x86-common.o 
vbetool/vbetool.o: %.o : %.c %.h
$(CC) $(CC_FLAGS) -c $< -o $@

# Simple object without header
vbetool/lrmi.o vbetool/thunk.o dmidecode.o radeontool.o : %.o: %.c
$(CC) $(CC_FLAGS) -c $< -o $@


 Rules for binaries
s2disk: $(SWSUSP_OBJ) suspend.c
$(CC) -g $(CC_FLAGS)  $^ -o $@ $(SWSUSP_LD_FLAGS)

s2ram:  $(S2RAM_OBJ) s2ram.o
$(CC) -g $(CC_FLAGS)  $^ -o $@ $(S2RAM_LD_FLAGS)

s2both: $(SWSUSP_OBJ) $(S2RAM_OBJ) s2ram-both.o suspend.c 
$(CC) -g $(CC_FLAGS) -DCONFIG_BOTH  $^ -o $@ $(SWSUSP_LD_FLAGS) 
$(S2RAM_LD_FLAGS)

resume: resume.c $(SWSUSP_OBJ)
$(CC) $(CC_FLAGS) $(STATIC_CC_FLAGS) $(STATIC_LD_FLAGS) 
$(SWSUSP_LD_FLAGS) $^ -o $@ 

swap-offset: swap-offset.c
$(CC) $(CFLAGS) $< -o $@

suspend-keygen:  keygen.c md5.o encrypt.h 
$(CC) $(CC_FLAGS) $(GCRYPT_CC_FLAGS) -DHAVE_INTTYPES_H -DHAVE_STDINT_H 
md5.o $< -o $@ $(LD_FLAGS) $(GCRYPT_LD_FLAGS)




 Install targets
$(SNAPSHOT):
mknod $(SNAPSHOT) c 10 231;

install-conf: conf/$(CONFIGFILE)
if [ -f $(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE) ]; then \
install --mode=644 conf/$(CONFIGFILE) \
$(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE).new;\
else \
install -D --mode=644 conf/$(CONFIGFILE) \
$(DESTDIR)$(CONFIG_DIR)/$(CONFIGFILE); \
fi

install-resume:
install --mode=755 resume $(DESTDIR)$(RESUME_DIR)

install-% : %
install --mode=755 $< $(DESTDIR)$(SUSPEND_DIR)

#FIXME, also alter HOWTO!
install-resume-new-initrd:  resume conf/$(CONFIGFILE)
BOOT_DIR=$(DESTDIR)$(BOOT_DIR) ./scripts/create-resume-initrd.sh 
$(RESUME_DEVICE)

install-resume-on-initrd:   resume 
./scripts/install-resume.sh

install-minimal: $(patsubst %,%-install,$(BINARIES_MIN)) $(SNAPSHOT) 
install-conf

install: $(patsubst %,%-install,$(BINARIES)) $(SNAPSHOT) install-conf



-
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 maili

[Suspend-devel] What kernel has support for ...?

2007-02-02 Thread Tim Dijkstra
Hi,

Could someone please tell me what (stable) kernels have support for:

a) Suspend/Resume with swap files
b) Platform mode instead

And is there a easy way to test for swap file support, some /sys entry
perhaps?

Thanks,

Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] What kernel has support for ...?

2007-02-02 Thread Tim Dijkstra
On Fri, 2 Feb 2007 13:28:16 +0100
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> > > b) Platform mode instead  
> > 
> > I'm not sure what you mean here ...  
> 
> i guess it is SNAPSHOT_PMOPS...
> >

Ah, yes. The 'instead' is a remnant of a larger sentence that I cut out
saying something like 'instead of halt'.

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] Using a swap file

2007-02-03 Thread Tim Dijkstra
Hi,

I'm testing to see if I can suspend/resume using a swap file. I have
created a swap file on one of my (lvm) partitions and have the
the following lines in my config file (which I got with swap-offset):

resume device = /dev/mapper/vg_cs-local
resume offset = 12979490

s2disk refuses to suspend however, because in the function

static inline int set_swap_file(int dev, dev_t blkdev, loff_t offset)
.
.
error = ioctl(dev, SNAPSHOT_SET_SWAP_AREA, &swap);

Sets errno to 25.

This is on a 2.6.19.2 kernel btw. Am I doing something wrong?

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Using a swap file

2007-02-03 Thread Tim Dijkstra
On Sat, 3 Feb 2007 23:52:18 +0100
"Rafael J. Wysocki" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> On Saturday, 3 February 2007 23:10, Tim Dijkstra wrote:
> > Hi,
> > 
> > I'm testing to see if I can suspend/resume using a swap file. I have
> > created a swap file on one of my (lvm) partitions and have the
> > the following lines in my config file (which I got with swap-offset):
> > 
> > resume device = /dev/mapper/vg_cs-local
> > resume offset = 12979490
> > 
> > s2disk refuses to suspend however, because in the function
> > 
> > static inline int set_swap_file(int dev, dev_t blkdev, loff_t offset)
> > .
> > .
> > error = ioctl(dev, SNAPSHOT_SET_SWAP_AREA, &swap);
> > 
> > Sets errno to 25.
> 
> This is ENOTTY, so it means that the kernel doesn't implement the call.

Yes, that's what I figured. 

> > This is on a 2.6.19.2 kernel btw. Am I doing something wrong?
> 
> Sorry, my fault (memory doesn't serve me right, apparently).  The support
> for swap files will be included in 2.6.20 for the first time.  Currently it's
> only in -mm and -rc kernels.

OK, no problem. That's what I thought, I was a bit to lazy to grep to
the changelog;)

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


[Suspend-devel] suspend on ppc /w pmu

2007-02-07 Thread Tim Dijkstra
Hi Guys,

At the moment we support only ix86_{32,64} machines. I personally do
not have a ppc machine, but apparently bringing it in a s2ram state is
pretty easy. It is something along the lines of:

fd = open("/dev/pmu", O_RDWR);

ioctl(fd, PMU_IOC_SLEEP, arg);

If we integrate this into the s2ram binary, we can also support s2both
for them.

Maybe you have more thoughts about it, being the power-management gurus
you are... What do you think?

grts Tim

-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Bug#410320: s2ram: whitelist entry

2007-02-12 Thread Tim Dijkstra
Hi Guys,

I just got this report

On Fri, 9 Feb 2007 18:19:59 +0100
Bill Allombert <[EMAIL PROTECTED]> wrote:

> Package: uswsusp
> Version: 0.3~cvs20060928-6
> Severity: wishlist
> 
> Hello Tim,
> 
> With etch-amd64 on my new laptop, s2ram work fine with that option:
> 
> #s2ram -f -a 1
> 
> Here the laptop ID:
> 
> #This machine can be identified by:
> sys_vendor   = "FUJITSU SIEMENS"
> sys_product  = "Amilo Si 1520"
> sys_version  = "Rev 1"
> bios_version = " 1.10"

Current CVS already has this entry:

 { "FUJITSU SIEMENS","Amilo Si 1520","", "", 
S3_BIOS|S3_MODE },

I'm not really an expert in those video hacks. What would Bill have
missed without S3_MODE? Higher resolution console maybe?

grts Tim


signature.asc
Description: PGP signature
-
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
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel


Re: [Suspend-devel] Failure to resume from suspend to disk

2007-02-14 Thread Tim Dijkstra
On Wed, 14 Feb 2007 18:08:27 +0100
Christian Axelsson <[EMAIL PROTECTED]> wrote:

> Stefan Seyfried wrote:
> > On Wed, Feb 14, 2007 at 05:28:00PM +0100, Christian Axelsson wrote:
> >> Hello!
> >>
> >> Im trying to resume from disk om my dell 420 but after suspending (using 
> >> s2disk) and passing resume=/dev/hda1 the kernel just boots as normal and 
> >> then pass control over to normal init AND my swap-space is corrupt 
> >> afterwards. Am I missing something obvious...?
> > 
> > Yes. You need to setup your initrd to call the resume binary with apropriate
> > options or with a matching config file.
> > 
> > Usually the distribution does set this up for you, but there are maybe some
> > out there that are not up to date wrt. that.
> > 
> > The resume= kernel parameter is pretty meaningless for s2disk :-)
> 
> Ah that explains alot :)
> Is there any sample general initrd-scripts out there that I can use as a 
> base? (maybe this is the wrong place to ask though, sorry if that is the 
> case :)

Read the HOWTO and README please.

grts Tim

-
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


Re: [Suspend-devel] [patch] small trivial "make install" fixes

2007-02-14 Thread Tim Dijkstra
On Wed, 14 Feb 2007 12:33:24 +0100
Stefan Seyfried <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> i need these for a chrooted build (where $DESTDIR is not always present
> before make install):
> 
> 
> --- Makefile
> +++ Makefile
> @@ -137,10 +137,10 @@
>   fi
>  
>  install-resume:
> - install --mode=755 resume $(DESTDIR)$(RESUME_DIR)
> + install -D --mode=755 resume $(DESTDIR)$(RESUME_DIR)/resume
>  
>  install-% : %
> - install --mode=755 $< $(DESTDIR)$(SUSPEND_DIR)
> + install -D --mode=755 $< $(DESTDIR)$(SUSPEND_DIR)/$<
>  
>  # Some convenience targets
>  install-resume-new-initrd:   resume conf/$(CONFIGFILE)
> 
> 
> If nobody has some serious objections, i'll commit these soon (saves me a
> local patch :-)

Seems good to me.

I already wondered who added all those -Ds in the old Makefile;)

But now in the new one you only need two.

grts TIm

-
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


  1   2   >