diff options
author | David Hardeman <david@2gen.com> | 2005-09-17 03:55:31 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2005-10-29 20:19:43 -0400 |
commit | 378f058cc49bcda7fa63d3cd86d2f9a0a5188b1c (patch) | |
tree | ed99548aa459054c7b046f0ac96af2cc50683e6e /drivers/md | |
parent | d32311fed70d12f14e585feb4653571b1e2b0e6d (diff) |
[PATCH] Use sg_set_buf/sg_init_one where applicable
This patch uses sg_set_buf/sg_init_one in some places where it was
duplicated.
Signed-off-by: David Hardeman <david@2gen.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Greg KH <greg@kroah.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-crypt.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 28c1a628621f..cf6631056683 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/crypto.h> | 15 | #include <linux/crypto.h> |
16 | #include <linux/workqueue.h> | 16 | #include <linux/workqueue.h> |
17 | #include <asm/atomic.h> | 17 | #include <asm/atomic.h> |
18 | #include <asm/scatterlist.h> | 18 | #include <linux/scatterlist.h> |
19 | #include <asm/page.h> | 19 | #include <asm/page.h> |
20 | 20 | ||
21 | #include "dm.h" | 21 | #include "dm.h" |
@@ -164,9 +164,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti, | |||
164 | return -ENOMEM; | 164 | return -ENOMEM; |
165 | } | 165 | } |
166 | 166 | ||
167 | sg.page = virt_to_page(cc->key); | 167 | sg_set_buf(&sg, cc->key, cc->key_size); |
168 | sg.offset = offset_in_page(cc->key); | ||
169 | sg.length = cc->key_size; | ||
170 | crypto_digest_digest(hash_tfm, &sg, 1, salt); | 168 | crypto_digest_digest(hash_tfm, &sg, 1, salt); |
171 | crypto_free_tfm(hash_tfm); | 169 | crypto_free_tfm(hash_tfm); |
172 | 170 | ||
@@ -207,14 +205,12 @@ static void crypt_iv_essiv_dtr(struct crypt_config *cc) | |||
207 | 205 | ||
208 | static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv, sector_t sector) | 206 | static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv, sector_t sector) |
209 | { | 207 | { |
210 | struct scatterlist sg = { NULL, }; | 208 | struct scatterlist sg; |
211 | 209 | ||
212 | memset(iv, 0, cc->iv_size); | 210 | memset(iv, 0, cc->iv_size); |
213 | *(u64 *)iv = cpu_to_le64(sector); | 211 | *(u64 *)iv = cpu_to_le64(sector); |
214 | 212 | ||
215 | sg.page = virt_to_page(iv); | 213 | sg_set_buf(&sg, iv, cc->iv_size); |
216 | sg.offset = offset_in_page(iv); | ||
217 | sg.length = cc->iv_size; | ||
218 | crypto_cipher_encrypt((struct crypto_tfm *)cc->iv_gen_private, | 214 | crypto_cipher_encrypt((struct crypto_tfm *)cc->iv_gen_private, |
219 | &sg, &sg, cc->iv_size); | 215 | &sg, &sg, cc->iv_size); |
220 | 216 | ||