diff options
author | Jens Axboe <jens.axboe@oracle.com> | 2007-10-24 05:20:47 -0400 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2007-10-24 05:20:47 -0400 |
commit | 642f149031d70415d9318b919d50b71e4724adbd (patch) | |
tree | e792ad29dedffc6756d55e9d63e18ada35515b4b /net/sunrpc | |
parent | bd6dee6f30a0f6943df190b387b5f8fe98a848f3 (diff) |
SG: Change sg_set_page() to take length and offset argument
Most drivers need to set length and offset as well, so may as well fold
those three lines into one.
Add sg_assign_page() for those two locations that only needed to set
the page, where the offset/length is set outside of the function context.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_crypto.c | 14 | ||||
-rw-r--r-- | net/sunrpc/xdr.c | 4 |
2 files changed, 7 insertions, 11 deletions
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index 32be431affcf..24711be4b2dc 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c | |||
@@ -199,7 +199,7 @@ encryptor(struct scatterlist *sg, void *data) | |||
199 | } else { | 199 | } else { |
200 | in_page = sg_page(sg); | 200 | in_page = sg_page(sg); |
201 | } | 201 | } |
202 | sg_set_page(&desc->infrags[desc->fragno], in_page); | 202 | sg_assign_page(&desc->infrags[desc->fragno], in_page); |
203 | desc->fragno++; | 203 | desc->fragno++; |
204 | desc->fraglen += sg->length; | 204 | desc->fraglen += sg->length; |
205 | desc->pos += sg->length; | 205 | desc->pos += sg->length; |
@@ -215,11 +215,10 @@ encryptor(struct scatterlist *sg, void *data) | |||
215 | if (ret) | 215 | if (ret) |
216 | return ret; | 216 | return ret; |
217 | if (fraglen) { | 217 | if (fraglen) { |
218 | sg_set_page(&desc->outfrags[0], sg_page(sg)); | 218 | sg_set_page(&desc->outfrags[0], sg_page(sg), fraglen, |
219 | desc->outfrags[0].offset = sg->offset + sg->length - fraglen; | 219 | sg->offset + sg->length - fraglen); |
220 | desc->outfrags[0].length = fraglen; | ||
221 | desc->infrags[0] = desc->outfrags[0]; | 220 | desc->infrags[0] = desc->outfrags[0]; |
222 | sg_set_page(&desc->infrags[0], in_page); | 221 | sg_assign_page(&desc->infrags[0], in_page); |
223 | desc->fragno = 1; | 222 | desc->fragno = 1; |
224 | desc->fraglen = fraglen; | 223 | desc->fraglen = fraglen; |
225 | } else { | 224 | } else { |
@@ -287,9 +286,8 @@ decryptor(struct scatterlist *sg, void *data) | |||
287 | if (ret) | 286 | if (ret) |
288 | return ret; | 287 | return ret; |
289 | if (fraglen) { | 288 | if (fraglen) { |
290 | sg_set_page(&desc->frags[0], sg_page(sg)); | 289 | sg_set_page(&desc->frags[0], sg_page(sg), fraglen, |
291 | desc->frags[0].offset = sg->offset + sg->length - fraglen; | 290 | sg->offset + sg->length - fraglen); |
292 | desc->frags[0].length = fraglen; | ||
293 | desc->fragno = 1; | 291 | desc->fragno = 1; |
294 | desc->fraglen = fraglen; | 292 | desc->fraglen = fraglen; |
295 | } else { | 293 | } else { |
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 3d1f7cdf9dd0..f38dac30481b 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c | |||
@@ -1059,9 +1059,7 @@ xdr_process_buf(struct xdr_buf *buf, unsigned int offset, unsigned int len, | |||
1059 | do { | 1059 | do { |
1060 | if (thislen > page_len) | 1060 | if (thislen > page_len) |
1061 | thislen = page_len; | 1061 | thislen = page_len; |
1062 | sg_set_page(sg, buf->pages[i]); | 1062 | sg_set_page(sg, buf->pages[i], thislen, page_offset); |
1063 | sg->offset = page_offset; | ||
1064 | sg->length = thislen; | ||
1065 | ret = actor(sg, data); | 1063 | ret = actor(sg, data); |
1066 | if (ret) | 1064 | if (ret) |
1067 | goto out; | 1065 | goto out; |