X-Git-Url: http://git.monstr.eu/?a=blobdiff_plain;f=lib%2Fscatterlist.c;h=3675452b23ca175b612489e362aa7274b75d96a5;hb=f76ddd98075de950cbb13f47b8356262d9f44c6d;hp=e76d85cf31755c6de5b9ca5898756254e0525845;hpb=50e0d10232db05c6776afcf6098459bff47e8b15;p=linux-2.6-microblaze.git diff --git a/lib/scatterlist.c b/lib/scatterlist.c index e76d85cf3175..3675452b23ca 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -38,6 +38,25 @@ struct scatterlist *sg_next(struct scatterlist *sg) } EXPORT_SYMBOL(sg_next); +/** + * sg_nents - return total count of entries in scatterlist + * @sg: The scatterlist + * + * Description: + * Allows to know how many entries are in sg, taking into acount + * chaining as well + * + **/ +int sg_nents(struct scatterlist *sg) +{ + int nents; + for (nents = 0; sg; sg = sg_next(sg)) + nents++; + return nents; +} +EXPORT_SYMBOL(sg_nents); + + /** * sg_last - return the last scatterlist entry in a list * @sgl: First entry in the scatterlist