[PATCH 03/10] [SG] Update crypto/ to sg helpers

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jens Axboe
Date: Monday, October 22, 2007 - 11:10 am

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
---
 crypto/digest.c      |    2 +-
 crypto/hmac.c        |    3 ++-
 crypto/scatterwalk.c |    2 +-
 crypto/scatterwalk.h |    6 +++---
 crypto/tcrypt.c      |    4 ++--
 crypto/xcbc.c        |    2 +-
 6 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/crypto/digest.c b/crypto/digest.c
index e56de67..8871dec 100644
--- a/crypto/digest.c
+++ b/crypto/digest.c
@@ -41,7 +41,7 @@ static int update2(struct hash_desc *desc,
 		return 0;
 
 	for (;;) {
-		struct page *pg = sg->page;
+		struct page *pg = sg_page(sg);
 		unsigned int offset = sg->offset;
 		unsigned int l = sg->length;
 
diff --git a/crypto/hmac.c b/crypto/hmac.c
index 8802fb6..e4eb6ac 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -159,7 +159,8 @@ static int hmac_digest(struct hash_desc *pdesc, struct scatterlist *sg,
 	desc.flags = pdesc->flags & CRYPTO_TFM_REQ_MAY_SLEEP;
 
 	sg_set_buf(sg1, ipad, bs);
-	sg1[1].page = (void *)sg;
+
+	sg_set_page(&sg[1], (void *) sg);
 	sg1[1].length = 0;
 	sg_set_buf(sg2, opad, bs + ds);
 
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index d6852c3..b9bbda0 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -54,7 +54,7 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
 	if (out) {
 		struct page *page;
 
-		page = walk->sg->page + ((walk->offset - 1) >> PAGE_SHIFT);
+		page = sg_page(walk->sg) + ((walk->offset - 1) >> PAGE_SHIFT);
 		flush_dcache_page(page);
 	}
 
diff --git a/crypto/scatterwalk.h b/crypto/scatterwalk.h
index 9c73e37..87ed681 100644
--- a/crypto/scatterwalk.h
+++ b/crypto/scatterwalk.h
@@ -22,13 +22,13 @@
 
 static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)
 {
-	return (++sg)->length ? sg : (void *)sg->page;
+	return (++sg)->length ? sg : (void *) sg_page(sg);
 }
 
 static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in,
 						struct scatter_walk *walk_out)
 {
-	return !(((walk_in->sg->page - walk_out->sg->page) << PAGE_SHIFT) +
+	return !(((sg_page(walk_in->sg) - sg_page(walk_out->sg)) << PAGE_SHIFT) +
 		 (int)(walk_in->offset - walk_out->offset));
 }
 
@@ -60,7 +60,7 @@ static inline unsigned int scatterwalk_aligned(struct scatter_walk *walk,
 
 static inline struct page *scatterwalk_page(struct scatter_walk *walk)
 {
-	return walk->sg->page + (walk->offset >> PAGE_SHIFT);
+	return sg_page(walk->sg) + (walk->offset >> PAGE_SHIFT);
 }
 
 static inline void scatterwalk_unmap(void *vaddr, int out)
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
index 18d489c..d741c63 100644
--- a/crypto/tcrypt.c
+++ b/crypto/tcrypt.c
@@ -317,7 +317,7 @@ static void test_cipher(char *algo, int enc,
 				goto out;
 			}
 
-			q = kmap(sg[0].page) + sg[0].offset;
+			q = kmap(sg_page(&sg[0])) + sg[0].offset;
 			hexdump(q, cipher_tv[i].rlen);
 
 			printk("%s\n",
@@ -390,7 +390,7 @@ static void test_cipher(char *algo, int enc,
 			temp = 0;
 			for (k = 0; k < cipher_tv[i].np; k++) {
 				printk("page %u\n", k);
-				q = kmap(sg[k].page) + sg[k].offset;
+				q = kmap(sg_page(&sg[k])) + sg[k].offset;
 				hexdump(q, cipher_tv[i].tap[k]);
 				printk("%s\n",
 					memcmp(q, cipher_tv[i].result + temp,
diff --git a/crypto/xcbc.c b/crypto/xcbc.c
index 9f502b8..ac68f3b 100644
--- a/crypto/xcbc.c
+++ b/crypto/xcbc.c
@@ -120,7 +120,7 @@ static int crypto_xcbc_digest_update2(struct hash_desc *pdesc,
 
 	do {
 
-		struct page *pg = sg[i].page;
+		struct page *pg = sg_page(&sg[i]);
 		unsigned int offset = sg[i].offset;
 		unsigned int slen = sg[i].length;
 
-- 
1.5.3.GIT

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/10] SG updates, Jens Axboe, (Mon Oct 22, 11:10 am)
[PATCH 03/10] [SG] Update crypto/ to sg helpers, Jens Axboe, (Mon Oct 22, 11:10 am)
[PATCH 04/10] [SG] Update drivers to use sg helpers, Jens Axboe, (Mon Oct 22, 11:10 am)
[PATCH 05/10] [SG] Update fs/ to use sg helpers, Jens Axboe, (Mon Oct 22, 11:10 am)
[PATCH 06/10] [SG] Update net/ to use sg helpers, Jens Axboe, (Mon Oct 22, 11:11 am)
[PATCH 07/10] [SG] Update swiotlb to use sg helpers, Jens Axboe, (Mon Oct 22, 11:11 am)
[PATCH 08/10] [SG] Update arch/ to use sg helpers, Jens Axboe, (Mon Oct 22, 11:11 am)
[PATCH 09/10] Change table chaining layout, Jens Axboe, (Mon Oct 22, 11:11 am)
[PATCH 10/10] Add CONFIG_DEBUG_SG sg validation, Jens Axboe, (Mon Oct 22, 11:11 am)
Re: [PATCH 09/10] Change table chaining layout, Geert Uytterhoeven, (Mon Oct 22, 12:39 pm)
Re: [PATCH 09/10] Change table chaining layout, Linus Torvalds, (Mon Oct 22, 12:49 pm)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Mon Oct 22, 12:52 pm)
Re: [PATCH 09/10] Change table chaining layout, Alan Cox, (Mon Oct 22, 1:16 pm)
Re: [PATCH 09/10] Change table chaining layout, Matt Mackall, (Mon Oct 22, 1:38 pm)
Re: [PATCH 09/10] Change table chaining layout, Linus Torvalds, (Mon Oct 22, 1:44 pm)
Re: [PATCH 08/10] [SG] Update arch/ to use sg helpers, Benny Halevy, (Mon Oct 22, 2:10 pm)
Re: [PATCH 09/10] Change table chaining layout, Benny Halevy, (Mon Oct 22, 2:16 pm)
Re: [PATCH 09/10] Change table chaining layout, Jeff Garzik, (Mon Oct 22, 2:21 pm)
Re: [PATCH 09/10] Change table chaining layout, Alan Cox, (Mon Oct 22, 2:43 pm)
Re: [PATCH 09/10] Change table chaining layout, Matt Mackall, (Mon Oct 22, 2:47 pm)
Re: [PATCH 09/10] Change table chaining layout, Linus Torvalds, (Mon Oct 22, 2:47 pm)
Re: [PATCH 09/10] Change table chaining layout, Alan Cox, (Mon Oct 22, 3:52 pm)
Re: [PATCH 09/10] Change table chaining layout, Matt Mackall, (Mon Oct 22, 4:46 pm)
Re: [PATCH 09/10] Change table chaining layout, David Miller, (Mon Oct 22, 5:07 pm)
Re: [PATCH 09/10] Change table chaining layout, Jeff Garzik, (Mon Oct 22, 5:11 pm)
powerpc: Fix fallout from sg_page() changes, Olof Johansson, (Mon Oct 22, 9:09 pm)
IB/ehca: Fix sg_page() fallout, Olof Johansson, (Mon Oct 22, 9:31 pm)
Re: IB/ehca: Fix sg_page() fallout, Jens Axboe, (Mon Oct 22, 10:05 pm)
Re: [PATCH 02/10] [SG] Update block layer to use sg helpers, Heiko Carstens, (Mon Oct 22, 10:13 pm)
[PATCH] fix ll_rw_blk.c build on s390, Heiko Carstens, (Mon Oct 22, 10:42 pm)
[PATCH] net: fix xfrm build - missing scatterlist.h include, Heiko Carstens, (Mon Oct 22, 10:44 pm)
Re: IB/ehca: Fix sg_page() fallout, Olof Johansson, (Mon Oct 22, 10:54 pm)
Re: [PATCH 04/10] [SG] Update drivers to use sg helpers, Heiko Carstens, (Mon Oct 22, 11:28 pm)
Re: IB/ehca: Fix sg_page() fallout, Jens Axboe, (Tue Oct 23, 12:12 am)
Re: powerpc: Fix fallout from sg_page() changes, Jens Axboe, (Tue Oct 23, 12:13 am)
Re: [PATCH 04/10] [SG] Update drivers to use sg helpers, Heiko Carstens, (Tue Oct 23, 12:16 am)
Re: [PATCH 09/10] Change table chaining layout, Geert Uytterhoeven, (Tue Oct 23, 12:18 am)
Re: [PATCH 08/10] [SG] Update arch/ to use sg helpers, Jens Axboe, (Tue Oct 23, 12:26 am)
Re: [PATCH 09/10] Change table chaining layout, Boaz Harrosh, (Tue Oct 23, 2:29 am)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Tue Oct 23, 2:41 am)
Re: [PATCH 09/10] Change table chaining layout, Boaz Harrosh, (Tue Oct 23, 2:50 am)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Tue Oct 23, 2:55 am)
Re: [PATCH 09/10] Change table chaining layout, Boaz Harrosh, (Tue Oct 23, 3:23 am)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Tue Oct 23, 3:29 am)
Re: [PATCH 09/10] Change table chaining layout, Ingo Molnar, (Tue Oct 23, 3:33 am)
Re: [PATCH 06/10] [SG] Update net/ to use sg helpers, Christian Borntraeger, (Tue Oct 23, 3:44 am)
Re: [PATCH 06/10] [SG] Update net/ to use sg helpers, Jens Axboe, (Tue Oct 23, 3:45 am)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Tue Oct 23, 3:56 am)
Re: [PATCH 09/10] Change table chaining layout, Ingo Molnar, (Tue Oct 23, 4:27 am)
[PATCH][SG] fix typo in ps3rom.c, Arnd Bergmann, (Tue Oct 23, 7:48 am)
Re: [PATCH 09/10] Change table chaining layout, Linus Torvalds, (Tue Oct 23, 8:22 am)
Re: [PATCH 09/10] Change table chaining layout, Boaz Harrosh, (Tue Oct 23, 10:08 am)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Tue Oct 23, 11:33 am)
Re: [PATCH 09/10] Change table chaining layout, Geert Uytterhoeven, (Tue Oct 23, 12:23 pm)
Re: [PATCH 09/10] Change table chaining layout, Andi Kleen, (Tue Oct 23, 12:56 pm)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Tue Oct 23, 1:20 pm)
Re: [PATCH 09/10] Change table chaining layout, Andi Kleen, (Tue Oct 23, 1:57 pm)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Tue Oct 23, 2:44 pm)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Tue Oct 23, 2:46 pm)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Tue Oct 23, 11:56 pm)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Wed Oct 24, 1:05 am)
Re: [PATCH 09/10] Change table chaining layout, Geert Uytterhoeven, (Wed Oct 24, 2:03 am)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Wed Oct 24, 2:12 am)
Re: [PATCH 09/10] Change table chaining layout, Olivier Galibert, (Wed Oct 24, 6:35 am)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Wed Oct 24, 6:38 am)
Re: [PATCH 09/10] Change table chaining layout, Olivier Galibert, (Wed Oct 24, 6:45 am)
Re: [PATCH 09/10] Change table chaining layout, Linus Torvalds, (Wed Oct 24, 8:16 am)
Re: [PATCH 09/10] Change table chaining layout, Rusty Russell, (Thu Oct 25, 1:40 am)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Thu Oct 25, 2:11 am)
Re: [PATCH 09/10] Change table chaining layout, Rusty Russell, (Thu Oct 25, 4:54 am)
Re: [PATCH 09/10] Change table chaining layout, Linus Torvalds, (Thu Oct 25, 8:40 am)
Re: [PATCH 09/10] Change table chaining layout, Benny Halevy, (Thu Oct 25, 9:03 am)
Re: [PATCH 09/10] Change table chaining layout, Rusty Russell, (Thu Oct 25, 5:03 pm)
Re: [PATCH 09/10] Change table chaining layout, Paul Mackerras, (Thu Oct 25, 10:01 pm)
Re: [PATCH 09/10] Change table chaining layout, Linus Torvalds, (Fri Oct 26, 7:52 am)
Re: [PATCH 09/10] Change table chaining layout, Jens Axboe, (Fri Oct 26, 10:28 am)
[RFC PATCH 1/2] sg_ring instead of scatterlist chaining, Rusty Russell, (Sun Nov 4, 11:11 pm)