fscrypt: Enable partial page encryption

Not all filesystems work on full pages, thus we should allow them to
hand partial pages to fscrypt for en/decryption.

Signed-off-by: David Gstir <david@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
David Gstir
2016-11-13 22:20:46 +01:00
committed by Theodore Ts'o
parent b50f7b268b
commit 7821d4dd45
5 changed files with 44 additions and 24 deletions

View File

@@ -248,8 +248,11 @@ int fscrypt_initialize(void);
extern struct fscrypt_ctx *fscrypt_get_ctx(struct inode *, gfp_t);
extern void fscrypt_release_ctx(struct fscrypt_ctx *);
extern struct page *fscrypt_encrypt_page(struct inode *, struct page *, gfp_t);
extern int fscrypt_decrypt_page(struct inode *, struct page *);
extern struct page *fscrypt_encrypt_page(struct inode *, struct page *,
unsigned int, unsigned int,
gfp_t);
extern int fscrypt_decrypt_page(struct inode *, struct page *, unsigned int,
unsigned int);
extern void fscrypt_decrypt_bio_pages(struct fscrypt_ctx *, struct bio *);
extern void fscrypt_pullback_bio_page(struct page **, bool);
extern void fscrypt_restore_control_page(struct page *);
@@ -293,13 +296,16 @@ static inline void fscrypt_notsupp_release_ctx(struct fscrypt_ctx *c)
}
static inline struct page *fscrypt_notsupp_encrypt_page(struct inode *i,
struct page *p, gfp_t f)
struct page *p,
unsigned int len,
unsigned int offs,
gfp_t f)
{
return ERR_PTR(-EOPNOTSUPP);
}
static inline int fscrypt_notsupp_decrypt_page(struct inode *i,
struct page *p)
static inline int fscrypt_notsupp_decrypt_page(struct inode *i, struct page *p,
unsigned int len, unsigned int offs)
{
return -EOPNOTSUPP;
}