diff options
Diffstat (limited to 'kernel/power/user.c')
-rw-r--r-- | kernel/power/user.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c index f0b7ef8bdd74..05c58a2c0dd4 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -343,6 +343,37 @@ OutS3: | |||
343 | } | 343 | } |
344 | break; | 344 | break; |
345 | 345 | ||
346 | case SNAPSHOT_SET_SWAP_AREA: | ||
347 | if (data->bitmap) { | ||
348 | error = -EPERM; | ||
349 | } else { | ||
350 | struct resume_swap_area swap_area; | ||
351 | dev_t swdev; | ||
352 | |||
353 | error = copy_from_user(&swap_area, (void __user *)arg, | ||
354 | sizeof(struct resume_swap_area)); | ||
355 | if (error) { | ||
356 | error = -EFAULT; | ||
357 | break; | ||
358 | } | ||
359 | |||
360 | /* | ||
361 | * User space encodes device types as two-byte values, | ||
362 | * so we need to recode them | ||
363 | */ | ||
364 | swdev = old_decode_dev(swap_area.dev); | ||
365 | if (swdev) { | ||
366 | offset = swap_area.offset; | ||
367 | data->swap = swap_type_of(swdev, offset); | ||
368 | if (data->swap < 0) | ||
369 | error = -ENODEV; | ||
370 | } else { | ||
371 | data->swap = -1; | ||
372 | error = -EINVAL; | ||
373 | } | ||
374 | } | ||
375 | break; | ||
376 | |||
346 | default: | 377 | default: |
347 | error = -ENOTTY; | 378 | error = -ENOTTY; |
348 | 379 | ||