diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-10-22 13:43:30 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-10-22 15:19:55 -0400 |
commit | 60c74f81933635bb4ccb4ee6f31909c51f5cd230 (patch) | |
tree | 1c8370b66d34d86598070e571f8935f5ff98fadb /fs | |
parent | 45711f1af6eff1a6d010703b4862e0d2b9afd056 (diff) |
Update fs/ to use sg helpers
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ecryptfs/crypto.c | 16 | ||||
-rw-r--r-- | fs/ecryptfs/keystore.c | 3 | ||||
-rw-r--r-- | fs/nfsd/nfs4recover.c | 8 |
3 files changed, 17 insertions, 10 deletions
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, | |||
283 | pg = virt_to_page(addr); | 283 | pg = virt_to_page(addr); |
284 | offset = offset_in_page(addr); | 284 | offset = offset_in_page(addr); |
285 | if (sg) { | 285 | if (sg) { |
286 | sg[i].page = pg; | 286 | sg_set_page(&sg[i], pg); |
287 | sg[i].offset = offset; | 287 | sg[i].offset = offset; |
288 | } | 288 | } |
289 | remainder_of_page = PAGE_CACHE_SIZE - offset; | 289 | remainder_of_page = PAGE_CACHE_SIZE - offset; |
@@ -713,10 +713,13 @@ ecryptfs_encrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat, | |||
713 | { | 713 | { |
714 | struct scatterlist src_sg, dst_sg; | 714 | struct scatterlist src_sg, dst_sg; |
715 | 715 | ||
716 | src_sg.page = src_page; | 716 | sg_init_table(&src_sg, 1); |
717 | sg_init_table(&dst_sg, 1); | ||
718 | |||
719 | sg_set_page(&src_sg, src_page); | ||
717 | src_sg.offset = src_offset; | 720 | src_sg.offset = src_offset; |
718 | src_sg.length = size; | 721 | src_sg.length = size; |
719 | dst_sg.page = dst_page; | 722 | sg_set_page(&dst_sg, dst_page); |
720 | dst_sg.offset = dst_offset; | 723 | dst_sg.offset = dst_offset; |
721 | dst_sg.length = size; | 724 | dst_sg.length = size; |
722 | return encrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv); | 725 | 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, | |||
742 | { | 745 | { |
743 | struct scatterlist src_sg, dst_sg; | 746 | struct scatterlist src_sg, dst_sg; |
744 | 747 | ||
745 | src_sg.page = src_page; | 748 | sg_init_table(&src_sg, 1); |
749 | sg_init_table(&dst_sg, 1); | ||
750 | |||
751 | sg_set_page(&src_sg, src_page); | ||
746 | src_sg.offset = src_offset; | 752 | src_sg.offset = src_offset; |
747 | src_sg.length = size; | 753 | src_sg.length = size; |
748 | dst_sg.page = dst_page; | 754 | sg_set_page(&dst_sg, dst_page); |
749 | dst_sg.offset = dst_offset; | 755 | dst_sg.offset = dst_offset; |
750 | dst_sg.length = size; | 756 | dst_sg.length = size; |
751 | return decrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv); | 757 | 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, | |||
1040 | }; | 1040 | }; |
1041 | int rc = 0; | 1041 | int rc = 0; |
1042 | 1042 | ||
1043 | sg_init_table(&dst_sg, 1); | ||
1044 | sg_init_table(&src_sg, 1); | ||
1045 | |||
1043 | if (unlikely(ecryptfs_verbosity > 0)) { | 1046 | if (unlikely(ecryptfs_verbosity > 0)) { |
1044 | ecryptfs_printk( | 1047 | ecryptfs_printk( |
1045 | KERN_DEBUG, "Session key encryption key (size [%d]):\n", | 1048 | KERN_DEBUG, "Session key encryption key (size [%d]):\n", |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index ebd03cc07479..6f03918018a3 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
@@ -88,7 +88,7 @@ nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname) | |||
88 | { | 88 | { |
89 | struct xdr_netobj cksum; | 89 | struct xdr_netobj cksum; |
90 | struct hash_desc desc; | 90 | struct hash_desc desc; |
91 | struct scatterlist sg[1]; | 91 | struct scatterlist sg; |
92 | __be32 status = nfserr_resource; | 92 | __be32 status = nfserr_resource; |
93 | 93 | ||
94 | dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n", | 94 | dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n", |
@@ -102,11 +102,9 @@ nfs4_make_rec_clidname(char *dname, struct xdr_netobj *clname) | |||
102 | if (cksum.data == NULL) | 102 | if (cksum.data == NULL) |
103 | goto out; | 103 | goto out; |
104 | 104 | ||
105 | sg[0].page = virt_to_page(clname->data); | 105 | sg_init_one(&sg, clname->data, clname->len); |
106 | sg[0].offset = offset_in_page(clname->data); | ||
107 | sg[0].length = clname->len; | ||
108 | 106 | ||
109 | if (crypto_hash_digest(&desc, sg, sg->length, cksum.data)) | 107 | if (crypto_hash_digest(&desc, &sg, sg.length, cksum.data)) |
110 | goto out; | 108 | goto out; |
111 | 109 | ||
112 | md5_to_hex(dname, cksum.data); | 110 | md5_to_hex(dname, cksum.data); |