Skip to content

Commit

Permalink
fscrypto: rename completion callbacks to reflect usage
Browse files Browse the repository at this point in the history
fscrypt_complete() was used only for data pages, not for all
encryption/decryption.  Rename it to page_crypt_complete().

dir_crypt_complete() was used for filename encryption/decryption for
both directory entries and symbolic links.  Rename it to
fname_crypt_complete().

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Eric Biggers authored and Theodore Ts'o committed Sep 15, 2016
1 parent d83ae73 commit 53fd755
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions fs/crypto/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ struct fscrypt_ctx *fscrypt_get_ctx(struct inode *inode, gfp_t gfp_flags)
EXPORT_SYMBOL(fscrypt_get_ctx);

/**
* fscrypt_complete() - The completion callback for page encryption
* @req: The asynchronous encryption request context
* @res: The result of the encryption operation
* page_crypt_complete() - completion callback for page crypto
* @req: The asynchronous cipher request context
* @res: The result of the cipher operation
*/
static void fscrypt_complete(struct crypto_async_request *req, int res)
static void page_crypt_complete(struct crypto_async_request *req, int res)
{
struct fscrypt_completion_result *ecr = req->data;

Expand Down Expand Up @@ -169,7 +169,7 @@ static int do_page_crypto(struct inode *inode,

skcipher_request_set_callback(
req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
fscrypt_complete, &ecr);
page_crypt_complete, &ecr);

BUILD_BUG_ON(FS_XTS_TWEAK_SIZE < sizeof(index));
memcpy(xts_tweak, &index, sizeof(index));
Expand Down
10 changes: 6 additions & 4 deletions fs/crypto/fname.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ static u32 size_round_up(size_t size, size_t blksize)
}

/**
* dir_crypt_complete() -
* fname_crypt_complete() - completion callback for filename crypto
* @req: The asynchronous cipher request context
* @res: The result of the cipher operation
*/
static void dir_crypt_complete(struct crypto_async_request *req, int res)
static void fname_crypt_complete(struct crypto_async_request *req, int res)
{
struct fscrypt_completion_result *ecr = req->data;

Expand Down Expand Up @@ -82,7 +84,7 @@ static int fname_encrypt(struct inode *inode,
}
skcipher_request_set_callback(req,
CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
dir_crypt_complete, &ecr);
fname_crypt_complete, &ecr);

/* Copy the input */
memcpy(workbuf, iname->name, iname->len);
Expand Down Expand Up @@ -144,7 +146,7 @@ static int fname_decrypt(struct inode *inode,
}
skcipher_request_set_callback(req,
CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP,
dir_crypt_complete, &ecr);
fname_crypt_complete, &ecr);

/* Initialize IV */
memset(iv, 0, FS_CRYPTO_BLOCK_SIZE);
Expand Down

0 comments on commit 53fd755

Please sign in to comment.