From 60c74f81933635bb4ccb4ee6f31909c51f5cd230 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 22 Oct 2007 19:43:30 +0200 Subject: Update fs/ to use sg helpers Signed-off-by: Jens Axboe --- fs/ecryptfs/crypto.c | 16 +++++++++++----- fs/ecryptfs/keystore.c | 3 +++ 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'fs/ecryptfs') diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 1ae90ef2c74d..0a9882edf562 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c @@ -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); diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index 89d9710dd63d..263fed88c0ca 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c @@ -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", -- cgit v1.2.3