From: Michael Tokarev <mjt@tls.msk.ru>
To: Andi Kleen <andi@firstfloor.org>
Cc: Linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: compat ioctl32 for /dev/snapshot?
Date: Mon, 04 May 2009 14:55:10 +0400 [thread overview]
Message-ID: <49FEC98E.4050906@msgid.tls.msk.ru> (raw)
In-Reply-To: <87prepgqhc.fsf@basil.nowhere.org>
[-- Attachment #1: Type: text/plain, Size: 1520 bytes --]
Andi Kleen wrote:
> Michael Tokarev <mjt@tls.msk.ru> writes:
>
>> Is there any reason why 32-bit uswsusp &Friends does not work
>> on 64bits kernel?
>>
>> For one, 32bits s2disk produces the following when trying to
>> suspend:
>>
>> ioctl32(s2disk:4134): Unknown cmd fd(4) cmd(400c330d){t:'3';sz:12} arg(ff853554) on /dev/snapshot
>> ioctl32(s2disk:4134): Unknown cmd fd(4) cmd(4004330a){t:'3';sz:4} arg(00000805) on /dev/snapshot
>>
[]
> It's probably just that nobody has written the code yet. In general all
> missing compat_ioctls are bugs.
Oh well.
Is the following patch ok? I just pulled all the SNAPSHOT_* stuff from
include/linux/suspend_ioctls.h and added them into fs/compat_ioctl.c.
The ioctls are:
o argument-less (most of them are)
o have single loff_t argument (other ioctls with the same argument are
marked as COMPAT_IOCTL
o have single int argument - they's also marked as COMPAT_IOCTL,
o and one othem, SNAPSHOT_SET_SWAP_AREA, has argument pointing to
the following structure (include/linux/suspend_ioctls.h):
struct resume_swap_area {
loff_t offset;
u_int32_t dev;
} __attribute__((packed));
so I think it also does not need any translation layer.
I can't test it so far, because uswsusp tools are broken in mixed
32/64bit case in other places. But at least it compiles fine and
does not complain anymore.
I never touched this area before so I may be wrong... but if it's ok...
Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>
Thanks!
/mjt
[-- Attachment #2: snapshot-compat-ioctl.patch --]
[-- Type: text/x-patch, Size: 1000 bytes --]
Signed-Off-By: Michael Tokarev <mjt@tls.msk.ru>
--- linux-2.6.29/fs/compat_ioctl.c.orig 2009-03-24 02:12:14.000000000 +0300
+++ linux-2.6.29/fs/compat_ioctl.c 2009-05-04 14:46:49.906169841 +0400
@@ -112,2 +112,4 @@
+#include <linux/suspend_ioctls.h>
+
#ifdef CONFIG_SPARC
@@ -2301,2 +2303,17 @@ COMPATIBLE_IOCTL(SOUND_MIXER_SETLEVELS)
COMPATIBLE_IOCTL(OSS_GETVERSION)
+/* SNAPSHOT */
+COMPATIBLE_IOCTL(SNAPSHOT_FREEZE)
+COMPATIBLE_IOCTL(SNAPSHOT_UNFREEZE)
+COMPATIBLE_IOCTL(SNAPSHOT_ATOMIC_RESTORE)
+COMPATIBLE_IOCTL(SNAPSHOT_FREE)
+COMPATIBLE_IOCTL(SNAPSHOT_FREE_SWAP_PAGES)
+COMPATIBLE_IOCTL(SNAPSHOT_S2RAM)
+COMPATIBLE_IOCTL(SNAPSHOT_SET_SWAP_AREA) /* struct resume_swap_area */
+COMPATIBLE_IOCTL(SNAPSHOT_GET_IMAGE_SIZE)
+COMPATIBLE_IOCTL(SNAPSHOT_PLATFORM_SUPPORT)
+COMPATIBLE_IOCTL(SNAPSHOT_POWER_OFF)
+COMPATIBLE_IOCTL(SNAPSHOT_CREATE_IMAGE)
+COMPATIBLE_IOCTL(SNAPSHOT_PREF_IMAGE_SIZE)
+COMPATIBLE_IOCTL(SNAPSHOT_AVAIL_SWAP_SIZE)
+COMPATIBLE_IOCTL(SNAPSHOT_ALLOC_SWAP_PAGE)
/* AUTOFS */
next prev parent reply other threads:[~2009-05-04 10:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-04 9:29 compat ioctl32 for /dev/snapshot? Michael Tokarev
2009-05-04 9:35 ` Andi Kleen
2009-05-04 10:55 ` Michael Tokarev [this message]
2009-05-04 11:12 ` Andi Kleen
2009-05-04 21:55 ` Rafael J. Wysocki
2009-05-05 11:38 ` Arnd Bergmann
2009-05-05 11:43 ` Michael Tokarev
2009-05-05 23:13 ` Rafael J. Wysocki
2009-05-04 11:52 ` Arnd Bergmann
2009-05-04 22:26 ` Michael Tokarev
2009-05-05 10:58 ` Arnd Bergmann
2009-05-04 21:58 ` Rafael J. Wysocki
2009-07-10 16:21 ` Pavel Machek
2009-07-12 0:19 ` Michael Tokarev
2009-07-12 15:07 ` Arnd Bergmann
2009-07-13 6:51 ` Michael Tokarev
2009-07-13 20:21 ` Pavel Machek
2009-07-14 6:57 ` Michael Tokarev
2009-07-14 9:55 ` 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=49FEC98E.4050906@msgid.tls.msk.ru \
--to=mjt@tls.msk.ru \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
/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