public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: pm list <linux-pm@lists.linux-foundation.org>
Subject: Re: [PATCH -mm 3/5] Hibernation: Correct definitions of some ioctls
Date: Mon, 3 Sep 2007 03:25:23 +0000	[thread overview]
Message-ID: <20070903032523.GH21721@ucw.cz> (raw)
In-Reply-To: <200709022321.04183.rjw@sisk.pl>

Hi!

> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Three ioctl numbers belonging to the hibernation userland interface,
> SNAPSHOT_ATOMIC_SNAPSHOT, SNAPSHOT_AVAIL_SWAP, SNAPSHOT_GET_SWAP_PAGE,
> are defined in a wrong way (eg. not portable).  Provide new ioctl numbers for
> these ioctls and mark the existing ones as deprecated.

It looks to me like

> @@ -149,12 +149,9 @@ struct resume_swap_area {
>  #define SNAPSHOT_IOC_MAGIC	'3'
>  #define SNAPSHOT_FREEZE			_IO(SNAPSHOT_IOC_MAGIC, 1)
>  #define SNAPSHOT_UNFREEZE		_IO(SNAPSHOT_IOC_MAGIC, 2)
> -#define SNAPSHOT_ATOMIC_SNAPSHOT	_IOW(SNAPSHOT_IOC_MAGIC, 3, void *)
>  #define SNAPSHOT_ATOMIC_RESTORE		_IO(SNAPSHOT_IOC_MAGIC, 4)
>  #define SNAPSHOT_FREE			_IO(SNAPSHOT_IOC_MAGIC, 5)
>  #define SNAPSHOT_SET_IMAGE_SIZE  _IOW(SNAPSHOT_IOC_MAGIC, 6, unsigned long)

at least set_image_size is wrong - too: we do not use argument as
unsigned long *, and we certainly don't write to it.

> -#define SNAPSHOT_AVAIL_SWAP		_IOR(SNAPSHOT_IOC_MAGIC, 7, void *)
> -#define SNAPSHOT_GET_SWAP_PAGE		_IOR(SNAPSHOT_IOC_MAGIC, 8, void *)
>  #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)
> @@ -163,7 +160,10 @@ struct resume_swap_area {
>  #define SNAPSHOT_GET_IMAGE_SIZE		_IOR(SNAPSHOT_IOC_MAGIC, 14, loff_t)
>  #define SNAPSHOT_PLATFORM_SUPPORT	_IOR(SNAPSHOT_IOC_MAGIC, 15, int)
>  #define SNAPSHOT_POWER_OFF		_IO(SNAPSHOT_IOC_MAGIC, 16)
> -#define SNAPSHOT_IOC_MAXNR	16
> +#define SNAPSHOT_CREATE_IMAGE		_IOW(SNAPSHOT_IOC_MAGIC, 17, int)
> +#define SNAPSHOT_AVAIL_SWAP_SIZE	_IOR(SNAPSHOT_IOC_MAGIC, 18, -#loff_t)

Should this be _IOW, because we return that value to userspace?

> +#define SNAPSHOT_ALLOC_SWAP_PAGE	_IOR(SNAPSHOT_IOC_MAGIC, 19, loff_t)

Hmm, this looks like _IOW to me, too, plus it does put_user with u64
(at least in my copy, may have been hacked too much).

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2007-09-03  3:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-02 21:15 [PATCH -mm 0/5] Hibernation: Clean up userland interface Rafael J. Wysocki
2007-09-02 21:17 ` [PATCH -mm 1/5] Hibernation: Introduce SNAPSHOT_GET_IMAGE_SIZE ioctl Rafael J. Wysocki
2007-09-03  3:17   ` Pavel Machek
2007-09-02 21:19 ` [PATCH -mm 2/5] Hibernation: Rework platform support ioctls Rafael J. Wysocki
2007-09-06  1:57   ` Pavel Machek
2007-09-02 21:21 ` [PATCH -mm 3/5] Hibernation: Correct definitions of some ioctls Rafael J. Wysocki
2007-09-03  3:25   ` Pavel Machek [this message]
2007-09-03 21:14     ` Rafael J. Wysocki
2007-09-02 21:22 ` [PATCH -mm 4/5] Hibernation: Mark SNAPSHOT_SET_SWAP_FILE ioctl as deprecated Rafael J. Wysocki
2007-09-06  2:08   ` Pavel Machek
2007-09-02 21:28 ` [PATCH -mm 5/5] Hibernation: Introduce exportable suspend ioctls header Rafael J. Wysocki
2007-09-03  3:29   ` Pavel Machek
2007-09-03 21:15     ` Rafael J. Wysocki
2007-09-03  9:43   ` Johannes Berg
2007-09-03 21:15     ` Rafael J. Wysocki

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=20070903032523.GH21721@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=rjw@sisk.pl \
    /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