ubifs: Use fscrypt ioctl() helpers
Commit db717d8e26
("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>
This commit is contained in:
parent
3858866866
commit
ec9160dacd
|
@ -184,39 +184,19 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
case FS_IOC_SET_ENCRYPTION_POLICY: {
|
case FS_IOC_SET_ENCRYPTION_POLICY: {
|
||||||
#ifdef CONFIG_UBIFS_FS_ENCRYPTION
|
#ifdef CONFIG_UBIFS_FS_ENCRYPTION
|
||||||
struct ubifs_info *c = inode->i_sb->s_fs_info;
|
struct ubifs_info *c = inode->i_sb->s_fs_info;
|
||||||
struct fscrypt_policy policy;
|
|
||||||
|
|
||||||
if (copy_from_user(&policy,
|
|
||||||
(struct fscrypt_policy __user *)arg,
|
|
||||||
sizeof(policy)))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
err = ubifs_enable_encryption(c);
|
err = ubifs_enable_encryption(c);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = fscrypt_process_policy(file, &policy);
|
return fscrypt_ioctl_set_policy(file, (const void __user *)arg);
|
||||||
|
|
||||||
return err;
|
|
||||||
#else
|
#else
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
case FS_IOC_GET_ENCRYPTION_POLICY: {
|
case FS_IOC_GET_ENCRYPTION_POLICY: {
|
||||||
#ifdef CONFIG_UBIFS_FS_ENCRYPTION
|
#ifdef CONFIG_UBIFS_FS_ENCRYPTION
|
||||||
struct fscrypt_policy policy;
|
return fscrypt_ioctl_get_policy(file, (void __user *)arg);
|
||||||
|
|
||||||
if (!ubifs_crypt_is_encrypted(inode))
|
|
||||||
return -ENOENT;
|
|
||||||
|
|
||||||
err = fscrypt_get_policy(inode, &policy);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
if (copy_to_user((void __user *)arg, &policy, sizeof(policy)))
|
|
||||||
return -EFAULT;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
#else
|
#else
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1806,8 +1806,8 @@ int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len,
|
||||||
#define fscrypt_pullback_bio_page fscrypt_notsupp_pullback_bio_page
|
#define fscrypt_pullback_bio_page fscrypt_notsupp_pullback_bio_page
|
||||||
#define fscrypt_restore_control_page fscrypt_notsupp_restore_control_page
|
#define fscrypt_restore_control_page fscrypt_notsupp_restore_control_page
|
||||||
#define fscrypt_zeroout_range fscrypt_notsupp_zeroout_range
|
#define fscrypt_zeroout_range fscrypt_notsupp_zeroout_range
|
||||||
#define fscrypt_process_policy fscrypt_notsupp_process_policy
|
#define fscrypt_ioctl_set_policy fscrypt_notsupp_ioctl_set_policy
|
||||||
#define fscrypt_get_policy fscrypt_notsupp_get_policy
|
#define fscrypt_ioctl_get_policy fscrypt_notsupp_ioctl_get_policy
|
||||||
#define fscrypt_has_permitted_context fscrypt_notsupp_has_permitted_context
|
#define fscrypt_has_permitted_context fscrypt_notsupp_has_permitted_context
|
||||||
#define fscrypt_inherit_context fscrypt_notsupp_inherit_context
|
#define fscrypt_inherit_context fscrypt_notsupp_inherit_context
|
||||||
#define fscrypt_get_encryption_info fscrypt_notsupp_get_encryption_info
|
#define fscrypt_get_encryption_info fscrypt_notsupp_get_encryption_info
|
||||||
|
|
Loading…
Reference in New Issue