summaryrefslogtreecommitdiff
path: root/fs/ceph/crypto.h
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2020-09-08 16:47:40 +0300
committerIlya Dryomov <idryomov@gmail.com>2023-08-22 10:01:48 +0300
commit6b5717bd30ab7f35792d20b71211055bdb43e6de (patch)
treec6463f5f7545dbe23fcd03b0ab497d5d5e27308b /fs/ceph/crypto.h
parent2d332d5bc424404911540006a8bb450fbb96b178 (diff)
downloadlinux-6b5717bd30ab7f35792d20b71211055bdb43e6de.tar.xz
ceph: implement -o test_dummy_encryption mount option
Add support for the test_dummy_encryption mount option. This allows us to test the encrypted codepaths in ceph without having to manually set keys, etc. [ lhenriques: fix potential fsc->fsc_dummy_enc_policy memory leak in ceph_real_mount() ] Signed-off-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Xiubo Li <xiubli@redhat.com> Reviewed-and-tested-by: Luís Henriques <lhenriques@suse.de> Reviewed-by: Milind Changire <mchangir@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/crypto.h')
-rw-r--r--fs/ceph/crypto.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/fs/ceph/crypto.h b/fs/ceph/crypto.h
index 6dca674f79b8..642963f5442e 100644
--- a/fs/ceph/crypto.h
+++ b/fs/ceph/crypto.h
@@ -8,6 +8,10 @@
#include <linux/fscrypt.h>
+struct ceph_fs_client;
+struct ceph_acl_sec_ctx;
+struct ceph_mds_request;
+
struct ceph_fscrypt_auth {
__le32 cfa_version;
__le32 cfa_blob_len;
@@ -25,12 +29,36 @@ static inline u32 ceph_fscrypt_auth_len(struct ceph_fscrypt_auth *fa)
#ifdef CONFIG_FS_ENCRYPTION
void ceph_fscrypt_set_ops(struct super_block *sb);
+void ceph_fscrypt_free_dummy_policy(struct ceph_fs_client *fsc);
+
+int ceph_fscrypt_prepare_context(struct inode *dir, struct inode *inode,
+ struct ceph_acl_sec_ctx *as);
+void ceph_fscrypt_as_ctx_to_req(struct ceph_mds_request *req,
+ struct ceph_acl_sec_ctx *as);
+
#else /* CONFIG_FS_ENCRYPTION */
static inline void ceph_fscrypt_set_ops(struct super_block *sb)
{
}
+static inline void ceph_fscrypt_free_dummy_policy(struct ceph_fs_client *fsc)
+{
+}
+
+static inline int ceph_fscrypt_prepare_context(struct inode *dir,
+ struct inode *inode,
+ struct ceph_acl_sec_ctx *as)
+{
+ if (IS_ENCRYPTED(dir))
+ return -EOPNOTSUPP;
+ return 0;
+}
+
+static inline void ceph_fscrypt_as_ctx_to_req(struct ceph_mds_request *req,
+ struct ceph_acl_sec_ctx *as_ctx)
+{
+}
#endif /* CONFIG_FS_ENCRYPTION */
#endif