16 #ifndef _CRYPTO_SCATTERWALK_H
17 #define _CRYPTO_SCATTERWALK_H
19 #include <asm/kmap_types.h>
23 #include <linux/kernel.h>
26 #include <linux/sched.h>
28 static inline void crypto_yield(
u32 flags)
34 static inline void scatterwalk_sg_chain(
struct scatterlist *sg1,
int num,
37 sg_set_page(&sg1[num - 1], (
void *)sg2, 0, 0);
46 return (++sg)->length ? sg : (
void *)sg_page(sg);
55 sg = scatterwalk_sg_next(sg);
59 scatterwalk_sg_chain(head, num, sg);
64 static inline unsigned long scatterwalk_samebuf(
struct scatter_walk *walk_in,
67 return !(((sg_page(walk_in->
sg) - sg_page(walk_out->
sg)) <<
PAGE_SHIFT) +
71 static inline unsigned int scatterwalk_pagelen(
struct scatter_walk *walk)
73 unsigned int len = walk->
sg->offset + walk->
sg->length - walk->
offset;
75 return len_this_page > len ? len : len_this_page;
78 static inline unsigned int scatterwalk_clamp(
struct scatter_walk *walk,
81 unsigned int len_this_page = scatterwalk_pagelen(walk);
82 return nbytes > len_this_page ? len_this_page :
nbytes;
85 static inline void scatterwalk_advance(
struct scatter_walk *walk,
91 static inline unsigned int scatterwalk_aligned(
struct scatter_walk *walk,
92 unsigned int alignmask)
94 return !(walk->
offset & alignmask);
102 static inline void scatterwalk_unmap(
void *
vaddr)