[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20060928230339.GF26653@elf.ucw.cz>
Date: Fri, 29 Sep 2006 01:03:39 +0200
From: Pavel Machek <pavel@....cz>
To: Andrew Morton <akpm@...l.org>
Cc: "Rafael J. Wysocki" <rjw@...k.pl>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -mm 1/3] swsusp: Add ioctl for swap files support
Hi!
> On Fri, 29 Sep 2006 00:13:38 +0200
> "Rafael J. Wysocki" <rjw@...k.pl> wrote:
>
> > To be able to use swap files as suspend storage from the userland suspend
> > tools we need an additional ioctl() that will allow us to provide the kernel
> > with both the swap header's offset and the identification of the resume
> > partition.
> >
> > The new ioctl() should be regarded as a replacement for the
> > SNAPSHOT_SET_SWAP_FILE ioctl() that from now on will be considered as
> > obsolete, but has to stay for backwards compatibility of the interface.
> >
> > +
> > +/*
> > + * 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 {
> > + u_int16_t dev;
> > + loff_t offset;
> > +} __attribute__((packed));
>
> hmm. Asking the compiler to pack 16-bit and 64-bit quantities in this
> manner is a bit risky. I guess it'll do the right thing, consistently,
> across all compiler versions and vendors and 32-bit-on-64-bit-kernel, etc.
>
> But from a defensiveness/paranoia POV it'd be better to use a u32 here, I
> suspect. (Will access to that loff_t cause an alignment trap on ia64? Any
> other CPUs? Dunno).
Perhaps just loff_t offset; u32 dev; ? If 64-bit variable is first, we
should avoid most problems, no?
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists