[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <fd5bd9c46ebe41de0f4923d94aa7a412aa113dc5.1650517532.git.ritesh.list@gmail.com>
Date: Thu, 21 Apr 2022 10:53:19 +0530
From: Ritesh Harjani <ritesh.list@...il.com>
To: linux-fscrypt@...r.kernel.org, linux-ext4@...r.kernel.org
Cc: Eric Biggers <ebiggers@...nel.org>, Theodore Ts'o <tytso@....edu>,
Jan Kara <jack@...e.cz>, Ritesh Harjani <ritesh.list@...il.com>
Subject: [RFC 3/6] ext4: Directly opencode ext4_set_test_dummy_encryption
Simplify the code by opencoding ext4_set_test_dummy_encryption(), since
there is only one caller of it and ext4_** variant in itself does nothing
special other than calling fscrypt_set_test_dummy_encryption(). This can
be done directly by opencoding it in the caller.
Signed-off-by: Ritesh Harjani <ritesh.list@...il.com>
---
fs/ext4/super.c | 34 ++++++++++++++--------------------
1 file changed, 14 insertions(+), 20 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 8bb5fa15a013..e7e5c9c057d7 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1863,24 +1863,6 @@ ext4_sb_read_encoding(const struct ext4_super_block *es)
}
#endif
-static int ext4_set_test_dummy_encryption(struct super_block *sb, char *arg)
-{
-#ifdef CONFIG_FS_ENCRYPTION
- struct ext4_sb_info *sbi = EXT4_SB(sb);
- int err;
-
- err = fscrypt_set_test_dummy_encryption(sb, arg,
- &sbi->s_dummy_enc_policy);
- if (err) {
- ext4_msg(sb, KERN_WARNING,
- "Error while setting test dummy encryption [%d]", err);
- return err;
- }
- ext4_msg(sb, KERN_WARNING, "Test dummy encryption mode enabled");
-#endif
- return 0;
-}
-
#define EXT4_SPEC_JQUOTA (1 << 0)
#define EXT4_SPEC_JQFMT (1 << 1)
#define EXT4_SPEC_DATAJ (1 << 2)
@@ -2795,8 +2777,20 @@ static int ext4_apply_options(struct fs_context *fc, struct super_block *sb)
ext4_apply_quota_options(fc, sb);
- if (ctx->spec & EXT4_SPEC_DUMMY_ENCRYPTION)
- ret = ext4_set_test_dummy_encryption(sb, ctx->test_dummy_enc_arg);
+ if (IS_ENABLED(CONFIG_FS_ENCRYPTION) &&
+ (ctx->spec & EXT4_SPEC_DUMMY_ENCRYPTION)) {
+
+ ret = fscrypt_set_test_dummy_encryption(sb,
+ ctx->test_dummy_enc_arg,
+ &sbi->s_dummy_enc_policy);
+ if (ret) {
+ ext4_msg(sb, KERN_WARNING, "Error while setting test dummy encryption [%d]",
+ ret);
+ return ret;
+ }
+
+ ext4_msg(sb, KERN_WARNING, "Test dummy encryption mode enabled");
+ }
return ret;
}
--
2.31.1
Powered by blists - more mailing lists