]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - include/crypto/scatterwalk.h
Merge branch 'for-2.6.38/drivers' of git://git.kernel.dk/linux-2.6-block
[mv-sheeva.git] / include / crypto / scatterwalk.h
index 224658b8d80689560e6ebf7c7bd94c41a2ea76bf..4fd95a323beb295ddf9efbe1dfb8a63db15c3a09 100644 (file)
@@ -57,13 +57,32 @@ static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num,
                                        struct scatterlist *sg2)
 {
        sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0);
+       sg1[num - 1].page_link &= ~0x02;
 }
 
 static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)
 {
+       if (sg_is_last(sg))
+               return NULL;
+
        return (++sg)->length ? sg : (void *)sg_page(sg);
 }
 
+static inline void scatterwalk_crypto_chain(struct scatterlist *head,
+                                           struct scatterlist *sg,
+                                           int chain, int num)
+{
+       if (chain) {
+               head->length += sg->length;
+               sg = scatterwalk_sg_next(sg);
+       }
+
+       if (sg)
+               scatterwalk_sg_chain(head, num, sg);
+       else
+               sg_mark_end(head);
+}
+
 static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in,
                                                struct scatter_walk *walk_out)
 {