Whamcloud - gitweb
LU-17402 kernel: update dotdot patch path for RHEL 8.10
[fs/lustre-release.git] / libcfs / include / libcfs / crypto / llcrypt.h
index 5df68c4..246954e 100644 (file)
@@ -53,6 +53,8 @@ struct llcrypt_name {
 
 /* Maximum value for the third parameter of llcrypt_operations.set_context(). */
 #define LLCRYPT_SET_CONTEXT_MAX_SIZE   40
+#define LLCRYPT_DIGESTED_CHAR_OLD      '_'
+#define LLCRYPT_DIGESTED_CHAR          '+'
 
 #ifdef CONFIG_LL_ENCRYPTION
 /*
@@ -121,16 +123,26 @@ extern struct page *llcrypt_encrypt_pagecache_blocks(struct page *page,
                                                     unsigned int len,
                                                     unsigned int offs,
                                                     gfp_t gfp_flags);
-extern int llcrypt_encrypt_block_inplace(const struct inode *inode,
-                                        struct page *page, unsigned int len,
-                                        unsigned int offs, u64 lblk_num,
-                                        gfp_t gfp_flags);
+extern int llcrypt_encrypt_block(const struct inode *inode, struct page *src,
+                        struct page *dst, unsigned int len,
+                        unsigned int offs, u64 lblk_num, gfp_t gfp_flags);
 
 extern int llcrypt_decrypt_pagecache_blocks(struct page *page, unsigned int len,
                                            unsigned int offs);
-extern int llcrypt_decrypt_block_inplace(const struct inode *inode,
-                                        struct page *page, unsigned int len,
-                                        unsigned int offs, u64 lblk_num);
+
+extern int llcrypt_decrypt_block(const struct inode *inode, struct page *src,
+                        struct page *dst, unsigned int len,
+                        unsigned int offs, u64 lblk_num, gfp_t gfp_flags);
+
+static inline int llcrypt_decrypt_block_inplace(const struct inode *inode,
+                                               struct page *page,
+                                               unsigned int len,
+                                               unsigned int offs,
+                                               u64 lblk_num)
+{
+       return llcrypt_decrypt_block(inode, page, page, len, offs, lblk_num,
+                                    GFP_NOFS);
+}
 
 static inline bool llcrypt_is_bounce_page(struct page *page)
 {
@@ -153,7 +165,7 @@ extern int llcrypt_inherit_context(struct inode *, struct inode *,
                                        void *, bool);
 extern bool llcrypt_policy_has_filename_enc(struct inode *inode);
 /* keyring.c */
-extern void llcrypt_sb_free(struct super_block *sb);
+extern void llcrypt_sb_free(struct lustre_sb_info *lsi);
 extern int llcrypt_ioctl_add_key(struct file *filp, void __user *arg);
 extern int llcrypt_ioctl_remove_key(struct file *filp, void __user *arg);
 extern int llcrypt_ioctl_remove_key_all_users(struct file *filp,
@@ -255,13 +267,6 @@ static inline bool llcrypt_match_name(const struct llcrypt_name *fname,
        return !memcmp(de_name, fname->disk_name.name, fname->disk_name.len);
 }
 
-/* bio.c */
-extern void llcrypt_decrypt_bio(struct bio *);
-extern void llcrypt_enqueue_decrypt_bio(struct llcrypt_ctx *ctx,
-                                       struct bio *bio);
-extern int llcrypt_zeroout_range(const struct inode *, pgoff_t, sector_t,
-                                unsigned int);
-
 /* hooks.c */
 extern int llcrypt_file_open(struct inode *inode, struct file *filp);
 extern int __llcrypt_prepare_link(struct inode *inode, struct inode *dir,
@@ -336,11 +341,10 @@ static inline struct page *llcrypt_encrypt_pagecache_blocks(struct page *page,
        return ERR_PTR(-EOPNOTSUPP);
 }
 
-static inline int llcrypt_encrypt_block_inplace(const struct inode *inode,
-                                               struct page *page,
-                                               unsigned int len,
-                                               unsigned int offs, u64 lblk_num,
-                                               gfp_t gfp_flags)
+static inline int llcrypt_encrypt_block(const struct inode *inode,
+                                       struct page *src, struct page *dst,
+                                       unsigned int len, unsigned int offs,
+                                       u64 lblk_num, gfp_t gfp_flags)
 {
        return -EOPNOTSUPP;
 }
@@ -352,6 +356,14 @@ static inline int llcrypt_decrypt_pagecache_blocks(struct page *page,
        return -EOPNOTSUPP;
 }
 
+static inline int llcrypt_decrypt_block(const struct inode *inode,
+                                       struct page *src, struct page *dst,
+                                       unsigned int len, unsigned int offs,
+                                       u64 lblk_num, gfp_t gfp_flags)
+{
+       return -EOPNOTSUPP;
+}
+
 static inline int llcrypt_decrypt_block_inplace(const struct inode *inode,
                                                struct page *page,
                                                unsigned int len,
@@ -411,7 +423,7 @@ static inline bool llcrypt_policy_has_filename_enc(struct inode *inode)
 }
 
 /* keyring.c */
-static inline void llcrypt_sb_free(struct super_block *sb)
+static inline void llcrypt_sb_free(struct lustre_sb_info *lsi)
 {
 }
 
@@ -506,22 +518,6 @@ static inline bool llcrypt_match_name(const struct llcrypt_name *fname,
        return !memcmp(de_name, fname->disk_name.name, fname->disk_name.len);
 }
 
-/* bio.c */
-static inline void llcrypt_decrypt_bio(struct bio *bio)
-{
-}
-
-static inline void llcrypt_enqueue_decrypt_bio(struct llcrypt_ctx *ctx,
-                                              struct bio *bio)
-{
-}
-
-static inline int llcrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
-                                       sector_t pblk, unsigned int len)
-{
-       return -EOPNOTSUPP;
-}
-
 /* hooks.c */
 
 static inline int llcrypt_file_open(struct inode *inode, struct file *filp)