Re: [PATCH 2/13] Add sg helpers for iterating over a scatterlist table
- From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 10 May 2007 03:39:56 -0700
On Thu, 10 May 2007 12:21:44 +0200 Jens Axboe <jens.axboe@xxxxxxxxxx> wrote:
First step to being able to change the scatterlist setup without
having to modify drivers (a lot :-)
Signed-off-by: Jens Axboe <jens.axboe@xxxxxxxxxx>
---
include/linux/scatterlist.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 4efbd9c..c5bffde 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -20,4 +20,13 @@ static inline void sg_init_one(struct scatterlist *sg, const void *buf,
sg_set_buf(sg, buf, buflen);
}
+#define sg_next(sg) ((sg) + 1)
+#define sg_last(sg, nents) (&(sg[nents - 1]))
Looks a bit underparenthesised.
+/*
+ * Loop over each sg element, following the pointer to a new list if necessary
+ */
+#define for_each_sg(sglist, sg, nr, __i) \
+ for (__i = 0, sg = (sglist); __i < nr; __i++, sg = sg_next(sg))
+
So does this.
I don't see how it "follows the pointer to a new list". All it's doing is
iterating across an array?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- References:
- [PATCH 0/13] Chaining sg lists for bio IO commands v3
- From: Jens Axboe
- [PATCH 2/13] Add sg helpers for iterating over a scatterlist table
- From: Jens Axboe
- [PATCH 0/13] Chaining sg lists for bio IO commands v3
- Prev by Date: Re: [PATCH] i2c: adds support for i2c bus on 8xx
- Next by Date: Re: [PATCH 2/13] Add sg helpers for iterating over a scatterlist table
- Previous by thread: [PATCH 2/13] Add sg helpers for iterating over a scatterlist table
- Next by thread: Re: [PATCH 2/13] Add sg helpers for iterating over a scatterlist table
- Index(es):
Relevant Pages
|