Update fs/ to use sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
parent
45711f1af6
commit
60c74f8193
|
@ -283,7 +283,7 @@ int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg,
|
|||
pg = virt_to_page(addr);
|
||||
offset = offset_in_page(addr);
|
||||
if (sg) {
|
||||
sg[i].page = pg;
|
||||
sg_set_page(&sg[i], pg);
|
||||
sg[i].offset = offset;
|
||||
}
|
||||
remainder_of_page = PAGE_CACHE_SIZE - offset;
|
||||
|
@ -713,10 +713,13 @@ ecryptfs_encrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat,
|
|||
{
|
||||
struct scatterlist src_sg, dst_sg;
|
||||
|
||||
src_sg.page = src_page;
|
||||
sg_init_table(&src_sg, 1);
|
||||
sg_init_table(&dst_sg, 1);
|
||||
|
||||
sg_set_page(&src_sg, src_page);
|
||||
src_sg.offset = src_offset;
|
||||
src_sg.length = size;
|
||||
dst_sg.page = dst_page;
|
||||
sg_set_page(&dst_sg, dst_page);
|
||||
dst_sg.offset = dst_offset;
|
||||
dst_sg.length = size;
|
||||
return encrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv);
|
||||
|
@ -742,10 +745,13 @@ ecryptfs_decrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat,
|
|||
{
|
||||
struct scatterlist src_sg, dst_sg;
|
||||
|
||||
src_sg.page = src_page;
|
||||
sg_init_table(&src_sg, 1);
|
||||
sg_init_table(&dst_sg, 1);
|
||||
|
||||
sg_set_page(&src_sg, src_page);
|
||||
src_sg.offset = src_offset;
|
||||
src_sg.length = size;
|
||||
dst_sg.page = dst_page;
|
||||
sg_set_page(&dst_sg, dst_page);
|
||||
dst_sg.offset = dst_offset;
|
||||
dst_sg.length = size;
|
||||
return decrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv);
|
||||
|
|
|
@ -1040,6 +1040,9 @@ decrypt_passphrase_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
|
|||
};
|
||||
int rc = 0;
|
||||
|
||||
sg_init_table(&dst_sg, 1);
|
||||
sg_init_table(&src_sg, 1);
|
||||
|
||||
if (unlikely(ecryptfs_verbosity > 0)) {
|
||||
ecryptfs_printk(
|
||||
KERN_DEBUG, "Session key encryption key (size [%d]):\n",
|
||||
|
|
|
@ -88,7 +88,7 @@ nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname)
|
|||
{
|
||||
struct xdr_netobj cksum;
|
||||
struct hash_desc desc;
|
||||
struct scatterlist sg[1];
|
||||
struct scatterlist sg;
|
||||
__be32 status = nfserr_resource;
|
||||
|
||||
dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n",
|
||||
|
@ -102,11 +102,9 @@ nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname)
|
|||
if (cksum.data == NULL)
|
||||
goto out;
|
||||
|
||||
sg[0].page = virt_to_page(clname->data);
|
||||
sg[0].offset = offset_in_page(clname->data);
|
||||
sg[0].length = clname->len;
|
||||
sg_init_one(&sg, clname->data, clname->len);
|
||||
|
||||
if (crypto_hash_digest(&desc, sg, sg->length, cksum.data))
|
||||
if (crypto_hash_digest(&desc, &sg, sg.length, cksum.data))
|
||||
goto out;
|
||||
|
||||
md5_to_hex(dname, cksum.data);
|
||||
|
|
Loading…
Reference in a new issue