diff options
author | Richard Weinberger <richard@nod.at> | 2016-12-12 18:27:59 -0500 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-12-13 13:54:52 -0500 |
commit | ec9160dacdb08eaeb40a878db97dfed6c2212d91 (patch) | |
tree | 87efd23a1d2afdc6c97f8c4ececce55c87ea2e9e /fs/ubifs | |
parent | 385886686609dbdcd2e8f55c358647faa8d4f89e (diff) |
ubifs: Use fscrypt ioctl() helpers
Commit db717d8e26c2 ("fscrypto: move ioctl processing more fully into
common code") moved ioctl() related functions into fscrypt and offers
us now a set of helper functions.
Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: David Gstir <david@sigma-star.at>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/ioctl.c | 24 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 4 |
2 files changed, 4 insertions, 24 deletions
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c index 3d10f5525274..78d713644df3 100644 --- a/fs/ubifs/ioctl.c +++ b/fs/ubifs/ioctl.c | |||
@@ -184,39 +184,19 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
184 | case FS_IOC_SET_ENCRYPTION_POLICY: { | 184 | case FS_IOC_SET_ENCRYPTION_POLICY: { |
185 | #ifdef CONFIG_UBIFS_FS_ENCRYPTION | 185 | #ifdef CONFIG_UBIFS_FS_ENCRYPTION |
186 | struct ubifs_info *c = inode->i_sb->s_fs_info; | 186 | struct ubifs_info *c = inode->i_sb->s_fs_info; |
187 | struct fscrypt_policy policy; | ||
188 | |||
189 | if (copy_from_user(&policy, | ||
190 | (struct fscrypt_policy __user *)arg, | ||
191 | sizeof(policy))) | ||
192 | return -EFAULT; | ||
193 | 187 | ||
194 | err = ubifs_enable_encryption(c); | 188 | err = ubifs_enable_encryption(c); |
195 | if (err) | 189 | if (err) |
196 | return err; | 190 | return err; |
197 | 191 | ||
198 | err = fscrypt_process_policy(file, &policy); | 192 | return fscrypt_ioctl_set_policy(file, (const void __user *)arg); |
199 | |||
200 | return err; | ||
201 | #else | 193 | #else |
202 | return -EOPNOTSUPP; | 194 | return -EOPNOTSUPP; |
203 | #endif | 195 | #endif |
204 | } | 196 | } |
205 | case FS_IOC_GET_ENCRYPTION_POLICY: { | 197 | case FS_IOC_GET_ENCRYPTION_POLICY: { |
206 | #ifdef CONFIG_UBIFS_FS_ENCRYPTION | 198 | #ifdef CONFIG_UBIFS_FS_ENCRYPTION |
207 | struct fscrypt_policy policy; | 199 | return fscrypt_ioctl_get_policy(file, (void __user *)arg); |
208 | |||
209 | if (!ubifs_crypt_is_encrypted(inode)) | ||
210 | return -ENOENT; | ||
211 | |||
212 | err = fscrypt_get_policy(inode, &policy); | ||
213 | if (err) | ||
214 | return err; | ||
215 | |||
216 | if (copy_to_user((void __user *)arg, &policy, sizeof(policy))) | ||
217 | return -EFAULT; | ||
218 | |||
219 | return 0; | ||
220 | #else | 200 | #else |
221 | return -EOPNOTSUPP; | 201 | return -EOPNOTSUPP; |
222 | #endif | 202 | #endif |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 8d0e4818e3ea..ca72382ce6cc 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -1806,8 +1806,8 @@ int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len, | |||
1806 | #define fscrypt_pullback_bio_page fscrypt_notsupp_pullback_bio_page | 1806 | #define fscrypt_pullback_bio_page fscrypt_notsupp_pullback_bio_page |
1807 | #define fscrypt_restore_control_page fscrypt_notsupp_restore_control_page | 1807 | #define fscrypt_restore_control_page fscrypt_notsupp_restore_control_page |
1808 | #define fscrypt_zeroout_range fscrypt_notsupp_zeroout_range | 1808 | #define fscrypt_zeroout_range fscrypt_notsupp_zeroout_range |
1809 | #define fscrypt_process_policy fscrypt_notsupp_process_policy | 1809 | #define fscrypt_ioctl_set_policy fscrypt_notsupp_ioctl_set_policy |
1810 | #define fscrypt_get_policy fscrypt_notsupp_get_policy | 1810 | #define fscrypt_ioctl_get_policy fscrypt_notsupp_ioctl_get_policy |
1811 | #define fscrypt_has_permitted_context fscrypt_notsupp_has_permitted_context | 1811 | #define fscrypt_has_permitted_context fscrypt_notsupp_has_permitted_context |
1812 | #define fscrypt_inherit_context fscrypt_notsupp_inherit_context | 1812 | #define fscrypt_inherit_context fscrypt_notsupp_inherit_context |
1813 | #define fscrypt_get_encryption_info fscrypt_notsupp_get_encryption_info | 1813 | #define fscrypt_get_encryption_info fscrypt_notsupp_get_encryption_info |