Hi, On Tuesday, 12 September 2006 19:03, Stefan Seyfried wrote: > On Tue, Sep 12, 2006 at 08:56:33AM +0200, Stefan Seyfried wrote: > > Hi, > > > > i finally tested it and it seems to work. > > no, it didn't. But i fixed it. The placement of platform_finish() is > non-intuitive :-) > > Also, moved to one ioctl with a parameter. If the style / ioctl design is > ok, could we push this ASAP? It is pretty important to me to be able to > test this further :-) > > I'll also clean up the userspace part (add a configuration variable so once > can decide between "platform", "shutdown", maybe even "reboot", but that can > still be done once the kernel part is pushed. > > This is for the kernel: > > Add an ioctl to user.c so that uswsusp can suspend correctly using the > pm_ops methods. > > From: Stefan Seyfried <[EMAIL PROTECTED]> > > diff --exclude='.*' --exclude='*o' -ruNp /usr/src/linux/kernel/power/power.h > linux-2.6.18-rc6-2/kernel/power/power.h > --- /usr/src/linux/kernel/power/power.h 2006-09-08 19:02:33.000000000 > +0200 > +++ linux-2.6.18-rc6-2/kernel/power/power.h 2006-09-12 17:45:33.000000000 > +0200 > @@ -78,7 +78,12 @@ int snapshot_image_loaded(struct snapsho > #define SNAPSHOT_FREE_SWAP_PAGES _IO(SNAPSHOT_IOC_MAGIC, 9) > #define SNAPSHOT_SET_SWAP_FILE _IOW(SNAPSHOT_IOC_MAGIC, 10, > unsigned int) > #define SNAPSHOT_S2RAM _IO(SNAPSHOT_IOC_MAGIC, 11) > -#define SNAPSHOT_IOC_MAXNR 11 > +#define SNAPSHOT_PMOPS _IOW(SNAPSHOT_IOC_MAGIC, 12, > unsigned int) > +#define SNAPSHOT_IOC_MAXNR 12 > + > +#define PMOPS_PREPARE 1 > +#define PMOPS_ENTER 2 > +#define PMOPS_FINISH 3 > > /** > * The bitmap is used for tracing allocated swap pages > diff --exclude='.*' --exclude='*o' -ruNp /usr/src/linux/kernel/power/user.c > linux-2.6.18-rc6-2/kernel/power/user.c > --- /usr/src/linux/kernel/power/user.c 2006-06-18 03:49:35.000000000 > +0200 > +++ linux-2.6.18-rc6-2/kernel/power/user.c 2006-09-12 18:45:34.000000000 > +0200 > @@ -11,6 +11,7 @@ > > #include <linux/suspend.h> > #include <linux/syscalls.h> > +#include <linux/reboot.h> > #include <linux/string.h> > #include <linux/device.h> > #include <linux/miscdevice.h> > @@ -302,6 +303,33 @@ OutS3: > up(&pm_sem); > break; > > + case SNAPSHOT_PMOPS: > + switch (arg) { > + > + case PMOPS_PREPARE: > + if (pm_ops->prepare) { > + error = pm_ops->prepare(PM_SUSPEND_DISK); > + } > + break; > + > + case PMOPS_ENTER: > + kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK); > + error = pm_ops->enter(PM_SUSPEND_DISK); > + break; > + > + case PMOPS_FINISH: > + if (pm_ops && pm_ops->finish) { > + pm_ops->finish(PM_SUSPEND_DISK); > + } > + break; > + > + default: > + printk(KERN_ERR "SNAPSHOT_PMOPS: invalid argument > %ld\n", arg); > + error = -EINVAL; > + > + } > + break; > + > default: > error = -ENOTTY;
The kernel part looks pretty clean to me. I think we can try to push it upstream, but the interface change needs to be documented and we'll also have to prepare some uswsusp documentation for Documentation/ABI/ along with it. I can take care of that, but only after I sort out some more urgent stuff. > ------------------------------------- > and this is for userspace: > > Index: suspend.c > =================================================================== > RCS file: /cvsroot/suspend/suspend/suspend.c,v > retrieving revision 1.48 > diff -u -p -r1.48 suspend.c > --- suspend.c 23 Jul 2006 11:32:52 -0000 1.48 > +++ suspend.c 12 Sep 2006 16:56:48 -0000 > @@ -636,9 +636,10 @@ static int reset_signature(int fd) > } > #endif > > -static void suspend_shutdown(void) > +static void suspend_shutdown(int dev) > { > - power_off(); > + // power_off(); > + ioctl(dev, SNAPSHOT_PMOPS, PMOPS_ENTER); Can we have a wrapper around this? So that we don't need to repeat SNAPSHOT_PMOPS every time? Also I'd like to add a configuration parameter so the user can choose the power off method (on many machines 'shutdown' is just fine, and 'reboot' may be useful for testing). The remaining part looks okay to me (up to the wrapper remark above). Greetings, Rafael -- You never change things by fighting the existing reality. R. Buckminster Fuller ------------------------------------------------------------------------- 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