add patch create-function-to-read-journal-inode
[ext4-patch-queue.git] / fscrypto-rename-completion-callbacks-to-reflect-usage
blob10c967f2a8935bd3118ff1ce571334227898b1e7
1 fscrypto: rename completion callbacks to reflect usage
3 From: Eric Biggers <ebiggers@google.com>
5 fscrypt_complete() was used only for data pages, not for all
6 encryption/decryption.  Rename it to page_crypt_complete().
8 dir_crypt_complete() was used for filename encryption/decryption for
9 both directory entries and symbolic links.  Rename it to
10 fname_crypt_complete().
12 Signed-off-by: Eric Biggers <ebiggers@google.com>
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 ---
15  fs/crypto/crypto.c | 10 +++++-----
16  fs/crypto/fname.c  | 10 ++++++----
17  2 files changed, 11 insertions(+), 9 deletions(-)
19 diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
20 index 7c39eab..61057b7d 100644
21 --- a/fs/crypto/crypto.c
22 +++ b/fs/crypto/crypto.c
23 @@ -127,11 +127,11 @@ struct fscrypt_ctx *fscrypt_get_ctx(struct inode *inode, gfp_t gfp_flags)
24  EXPORT_SYMBOL(fscrypt_get_ctx);
26  /**
27 - * fscrypt_complete() - The completion callback for page encryption
28 - * @req: The asynchronous encryption request context
29 - * @res: The result of the encryption operation
30 + * page_crypt_complete() - completion callback for page crypto
31 + * @req: The asynchronous cipher request context
32 + * @res: The result of the cipher operation
33   */
34 -static void fscrypt_complete(struct crypto_async_request *req, int res)
35 +static void page_crypt_complete(struct crypto_async_request *req, int res)
36  {
37         struct fscrypt_completion_result *ecr = req->data;
39 @@ -169,7 +169,7 @@ static int do_page_crypto(struct inode *inode,
41         skcipher_request_set_callback(
42                 req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
43 -               fscrypt_complete, &ecr);
44 +               page_crypt_complete, &ecr);
46         BUILD_BUG_ON(FS_XTS_TWEAK_SIZE < sizeof(index));
47         memcpy(xts_tweak, &index, sizeof(index));
48 diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c
49 index 7f3239c..db8f798 100644
50 --- a/fs/crypto/fname.c
51 +++ b/fs/crypto/fname.c
52 @@ -20,9 +20,11 @@ static u32 size_round_up(size_t size, size_t blksize)
53  }
55  /**
56 - * dir_crypt_complete() -
57 + * fname_crypt_complete() - completion callback for filename crypto
58 + * @req: The asynchronous cipher request context
59 + * @res: The result of the cipher operation
60   */
61 -static void dir_crypt_complete(struct crypto_async_request *req, int res)
62 +static void fname_crypt_complete(struct crypto_async_request *req, int res)
63  {
64         struct fscrypt_completion_result *ecr = req->data;
66 @@ -82,7 +84,7 @@ static int fname_encrypt(struct inode *inode,
67         }
68         skcipher_request_set_callback(req,
69                         CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
70 -                       dir_crypt_complete, &ecr);
71 +                       fname_crypt_complete, &ecr);
73         /* Copy the input */
74         memcpy(workbuf, iname->name, iname->len);
75 @@ -145,7 +147,7 @@ static int fname_decrypt(struct inode *inode,
76         }
77         skcipher_request_set_callback(req,
78                 CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
79 -               dir_crypt_complete, &ecr);
80 +               fname_crypt_complete, &ecr);
82         /* Initialize IV */
83         memset(iv, 0, FS_CRYPTO_BLOCK_SIZE);