OSDN Git Service

enic: remove __dev* attributes
[uclinux-h8/linux.git] / lib / scatterlist.c
index e76d85c..3675452 100644 (file)
@@ -39,6 +39,25 @@ struct scatterlist *sg_next(struct scatterlist *sg)
 EXPORT_SYMBOL(sg_next);
 
 /**
 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
  * @nents:     Number of entries in the scatterlist
  * sg_last - return the last scatterlist entry in a list
  * @sgl:       First entry in the scatterlist
  * @nents:     Number of entries in the scatterlist