public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Pavel Machek <pavel@ucw.cz>, Andrew Morton <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -mm 1/3] swsusp: Add ioctl for swap files support
Date: Sun, 1 Oct 2006 00:04:58 +0200	[thread overview]
Message-ID: <200610010004.58984.rjw@sisk.pl> (raw)
In-Reply-To: <200609302237.22086.arnd@arndb.de>

On Saturday, 30 September 2006 22:37, Arnd Bergmann wrote:
> Am Saturday 30 September 2006 21:58 schrieb Rafael J. Wysocki:
> > > Your definition looks wrong, '_IOW(SNAPSHOT_IOC_MAGIC, 13, void *)' means
> > > your ioctl passes a pointer to a 'void *'.
> > >
> > > You probably mean
> > >
> > > #define SNAPSHOT_SET_SWAP_AREA _IOW(SNAPSHOT_IOC_MAGIC, 13, \
> > >                                               struct resume_swap_area)
> >
> > No.  I mean the ioctl passes a pointer, the size of which is sizeof(void *).
> 
> That's a very bad thing to do. It means that the ioctl number is different
> between 32 and 64 bit and you need to write a conversion handler that
> first reads your pointer and then then writes the real data.

Ouch, I meant exactly what you said above, sorry.

Now that means some other ioctl definitions in kernel/power/power.h are
wrong, but I'm not sure what I should do.

I think I'll just change the new definition and let the others stay as they
are which is done in the appended patch.

Thanks,
Rafael


---
Fix the SNAPSHOT_SET_SWAP_AREA ioctl definition.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
---
 kernel/power/power.h |   23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

Index: linux-2.6.18-mm2/kernel/power/power.h
===================================================================
--- linux-2.6.18-mm2.orig/kernel/power/power.h
+++ linux-2.6.18-mm2/kernel/power/power.h
@@ -106,6 +106,16 @@ extern int snapshot_write_next(struct sn
 extern void snapshot_write_finalize(struct snapshot_handle *handle);
 extern int snapshot_image_loaded(struct snapshot_handle *handle);
 
+/*
+ * This structure is used to pass the values needed for the identification
+ * of the resume swap area from a user space to the kernel via the
+ * SNAPSHOT_SET_SWAP_AREA ioctl
+ */
+struct resume_swap_area {
+	loff_t offset;
+	u_int32_t dev;
+} __attribute__((packed));
+
 #define SNAPSHOT_IOC_MAGIC	'3'
 #define SNAPSHOT_FREEZE			_IO(SNAPSHOT_IOC_MAGIC, 1)
 #define SNAPSHOT_UNFREEZE		_IO(SNAPSHOT_IOC_MAGIC, 2)
@@ -119,19 +129,10 @@ extern int snapshot_image_loaded(struct 
 #define SNAPSHOT_SET_SWAP_FILE		_IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned int)
 #define SNAPSHOT_S2RAM			_IO(SNAPSHOT_IOC_MAGIC, 11)
 #define SNAPSHOT_PMOPS			_IOW(SNAPSHOT_IOC_MAGIC, 12, unsigned int)
-#define SNAPSHOT_SET_SWAP_AREA		_IOW(SNAPSHOT_IOC_MAGIC, 13, void *)
+#define SNAPSHOT_SET_SWAP_AREA		_IOW(SNAPSHOT_IOC_MAGIC, 13, \
+							struct resume_swap_area)
 #define SNAPSHOT_IOC_MAXNR	13
 
-/*
- * This structure is used to pass the values needed for the identification
- * of the resume swap area from a user space to the kernel via the
- * SNAPSHOT_SET_SWAP_AREA ioctl
- */
-struct resume_swap_area {
-	loff_t offset;
-	u_int32_t dev;
-} __attribute__((packed));
-
 #define PMOPS_PREPARE	1
 #define PMOPS_ENTER	2
 #define PMOPS_FINISH	3

  reply	other threads:[~2006-09-30 22:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-28 22:05 [PATCH -mm 0/3] swsusp: Add ioctl for swap files support and update documentation Rafael J. Wysocki
2006-09-28 22:13 ` [PATCH -mm 1/3] swsusp: Add ioctl for swap files support Rafael J. Wysocki
2006-09-28 22:42   ` Andrew Morton
2006-09-28 22:58     ` Rafael J. Wysocki
2006-09-28 23:03     ` Pavel Machek
2006-09-28 23:35       ` Rafael J. Wysocki
2006-09-28 23:39         ` Pavel Machek
2006-09-30 14:15         ` Arnd Bergmann
2006-09-30 19:58           ` Rafael J. Wysocki
2006-09-30 20:37             ` Arnd Bergmann
2006-09-30 22:04               ` Rafael J. Wysocki [this message]
2006-10-01 21:52                 ` Arnd Bergmann
2006-09-28 23:04     ` Pavel Machek
2006-09-28 22:17 ` [PATCH -mm 2/3] swsusp: Update userland interface documentation Rafael J. Wysocki
2006-09-28 22:19 ` [PATCH -mm 3/3] swsusp: Document testing code Rafael J. Wysocki
2006-09-28 22:37   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200610010004.58984.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@osdl.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox