Skip to content

Commit ee446e1

Browse files
committed
f2fs: wire up FS_IOC_GET_ENCRYPTION_NONCE
This new ioctl retrieves a file's encryption nonce, which is useful for testing. See the corresponding fs/crypto/ patch for more details. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent 7ec9f3b commit ee446e1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

fs/f2fs/file.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2423,6 +2423,14 @@ static int f2fs_ioc_get_encryption_key_status(struct file *filp,
24232423
return fscrypt_ioctl_get_key_status(filp, (void __user *)arg);
24242424
}
24252425

2426+
static int f2fs_ioc_get_encryption_nonce(struct file *filp, unsigned long arg)
2427+
{
2428+
if (!f2fs_sb_has_encrypt(F2FS_I_SB(file_inode(filp))))
2429+
return -EOPNOTSUPP;
2430+
2431+
return fscrypt_ioctl_get_nonce(filp, (void __user *)arg);
2432+
}
2433+
24262434
static int f2fs_ioc_gc(struct file *filp, unsigned long arg)
24272435
{
24282436
struct inode *inode = file_inode(filp);
@@ -3437,6 +3445,8 @@ long f2fs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
34373445
return f2fs_ioc_remove_encryption_key_all_users(filp, arg);
34383446
case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
34393447
return f2fs_ioc_get_encryption_key_status(filp, arg);
3448+
case FS_IOC_GET_ENCRYPTION_NONCE:
3449+
return f2fs_ioc_get_encryption_nonce(filp, arg);
34403450
case F2FS_IOC_GARBAGE_COLLECT:
34413451
return f2fs_ioc_gc(filp, arg);
34423452
case F2FS_IOC_GARBAGE_COLLECT_RANGE:
@@ -3611,6 +3621,7 @@ long f2fs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
36113621
case FS_IOC_REMOVE_ENCRYPTION_KEY:
36123622
case FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS:
36133623
case FS_IOC_GET_ENCRYPTION_KEY_STATUS:
3624+
case FS_IOC_GET_ENCRYPTION_NONCE:
36143625
case F2FS_IOC_GARBAGE_COLLECT:
36153626
case F2FS_IOC_GARBAGE_COLLECT_RANGE:
36163627
case F2FS_IOC_WRITE_CHECKPOINT:

0 commit comments

Comments
 (0)