Skip to content

Commit b694e52

Browse files
Jiri Slabyrjwysocki
authored andcommitted
PM / Hibernate: Really deprecate deprecated user ioctls
They were deprecated and removed from exported headers more than 2 years ago. Inform users about their removal in the future now. (Switch cases needed to be reorderded for an easy fall through.) And add an entry to feature-removal-schedule. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
1 parent f8824ce commit b694e52

2 files changed

Lines changed: 30 additions & 4 deletions

File tree

‎Documentation/feature-removal-schedule.txt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,17 @@ Who: Robin Getz <rgetz@blackfin.uclinux.org> & Matt Mackall <mpm@selenic.com>
6464

6565
---------------------------
6666

67+
What: Deprecated snapshot ioctls
68+
When: 2.6.36
69+
70+
Why: The ioctls in kernel/power/user.c were marked as deprecated long time
71+
ago. Now they notify users about that so that they need to replace
72+
their userspace. After some more time, remove them completely.
73+
74+
Who: Jiri Slaby <jirislaby@gmail.com>
75+
76+
---------------------------
77+
6778
What: The ieee80211_regdom module parameter
6879
When: March 2010 / desktop catchup
6980

‎kernel/power/user.c‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,15 @@ static ssize_t snapshot_write(struct file *filp, const char __user *buf,
195195
return res;
196196
}
197197

198+
static void snapshot_deprecated_ioctl(unsigned int cmd)
199+
{
200+
if (printk_ratelimit())
201+
printk(KERN_NOTICE "%pf: ioctl '%.8x' is deprecated and will "
202+
"be removed soon, update your suspend-to-disk "
203+
"utilities\n",
204+
__builtin_return_address(0), cmd);
205+
}
206+
198207
static long snapshot_ioctl(struct file *filp, unsigned int cmd,
199208
unsigned long arg)
200209
{
@@ -246,8 +255,9 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
246255
data->frozen = 0;
247256
break;
248257

249-
case SNAPSHOT_CREATE_IMAGE:
250258
case SNAPSHOT_ATOMIC_SNAPSHOT:
259+
snapshot_deprecated_ioctl(cmd);
260+
case SNAPSHOT_CREATE_IMAGE:
251261
if (data->mode != O_RDONLY || !data->frozen || data->ready) {
252262
error = -EPERM;
253263
break;
@@ -275,8 +285,9 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
275285
data->ready = 0;
276286
break;
277287

278-
case SNAPSHOT_PREF_IMAGE_SIZE:
279288
case SNAPSHOT_SET_IMAGE_SIZE:
289+
snapshot_deprecated_ioctl(cmd);
290+
case SNAPSHOT_PREF_IMAGE_SIZE:
280291
image_size = arg;
281292
break;
282293

@@ -290,15 +301,17 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
290301
error = put_user(size, (loff_t __user *)arg);
291302
break;
292303

293-
case SNAPSHOT_AVAIL_SWAP_SIZE:
294304
case SNAPSHOT_AVAIL_SWAP:
305+
snapshot_deprecated_ioctl(cmd);
306+
case SNAPSHOT_AVAIL_SWAP_SIZE:
295307
size = count_swap_pages(data->swap, 1);
296308
size <<= PAGE_SHIFT;
297309
error = put_user(size, (loff_t __user *)arg);
298310
break;
299311

300-
case SNAPSHOT_ALLOC_SWAP_PAGE:
301312
case SNAPSHOT_GET_SWAP_PAGE:
313+
snapshot_deprecated_ioctl(cmd);
314+
case SNAPSHOT_ALLOC_SWAP_PAGE:
302315
if (data->swap < 0 || data->swap >= MAX_SWAPFILES) {
303316
error = -ENODEV;
304317
break;
@@ -321,6 +334,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
321334
break;
322335

323336
case SNAPSHOT_SET_SWAP_FILE: /* This ioctl is deprecated */
337+
snapshot_deprecated_ioctl(cmd);
324338
if (!swsusp_swap_in_use()) {
325339
/*
326340
* User space encodes device types as two-byte values,
@@ -362,6 +376,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
362376
break;
363377

364378
case SNAPSHOT_PMOPS: /* This ioctl is deprecated */
379+
snapshot_deprecated_ioctl(cmd);
365380
error = -EINVAL;
366381

367382
switch (arg) {

0 commit comments

Comments
 (0)