diff options
Diffstat (limited to 'kernel/power/user.c')
-rw-r--r-- | kernel/power/user.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c index 5bd321bcbb75..88aac26e598a 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -133,7 +133,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
133 | { | 133 | { |
134 | int error = 0; | 134 | int error = 0; |
135 | struct snapshot_data *data; | 135 | struct snapshot_data *data; |
136 | loff_t avail; | 136 | loff_t size; |
137 | sector_t offset; | 137 | sector_t offset; |
138 | 138 | ||
139 | if (_IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC) | 139 | if (_IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC) |
@@ -210,10 +210,20 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, | |||
210 | image_size = arg; | 210 | image_size = arg; |
211 | break; | 211 | break; |
212 | 212 | ||
213 | case SNAPSHOT_GET_IMAGE_SIZE: | ||
214 | if (!data->ready) { | ||
215 | error = -ENODATA; | ||
216 | break; | ||
217 | } | ||
218 | size = snapshot_get_image_size(); | ||
219 | size <<= PAGE_SHIFT; | ||
220 | error = put_user(size, (loff_t __user *)arg); | ||
221 | break; | ||
222 | |||
213 | case SNAPSHOT_AVAIL_SWAP: | 223 | case SNAPSHOT_AVAIL_SWAP: |
214 | avail = count_swap_pages(data->swap, 1); | 224 | size = count_swap_pages(data->swap, 1); |
215 | avail <<= PAGE_SHIFT; | 225 | size <<= PAGE_SHIFT; |
216 | error = put_user(avail, (loff_t __user *)arg); | 226 | error = put_user(size, (loff_t __user *)arg); |
217 | break; | 227 | break; |
218 | 228 | ||
219 | case SNAPSHOT_GET_SWAP_PAGE: | 229 | case SNAPSHOT_GET_SWAP_PAGE: |