lkml.org 
[lkml]   [2007]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2/13] Add sg helpers for iterating over a scatterlist table
    Date
    First step to being able to change the scatterlist setup without
    having to modify drivers (a lot :-)

    Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
    ---
    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]))
    +
    +/*
    + * 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))
    +
    #endif /* _LINUX_SCATTERLIST_H */
    --
    1.5.2.rc1
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-05-10 12:25    [W:0.020 / U:29.736 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site