diff options
Diffstat (limited to 'crypto/scatterwalk.h')
-rw-r--r-- | crypto/scatterwalk.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crypto/scatterwalk.h b/crypto/scatterwalk.h index 02aa56c649b4..e79925c474a3 100644 --- a/crypto/scatterwalk.h +++ b/crypto/scatterwalk.h | |||
@@ -40,10 +40,10 @@ static inline int scatterwalk_samebuf(struct scatter_walk *walk_in, | |||
40 | walk_in->offset == walk_out->offset; | 40 | walk_in->offset == walk_out->offset; |
41 | } | 41 | } |
42 | 42 | ||
43 | static inline int scatterwalk_across_pages(struct scatter_walk *walk, | 43 | static inline unsigned int scatterwalk_clamp(struct scatter_walk *walk, |
44 | unsigned int nbytes) | 44 | unsigned int nbytes) |
45 | { | 45 | { |
46 | return nbytes > walk->len_this_page; | 46 | return nbytes > walk->len_this_page ? walk->len_this_page : nbytes; |
47 | } | 47 | } |
48 | 48 | ||
49 | static inline void scatterwalk_advance(struct scatter_walk *walk, | 49 | static inline void scatterwalk_advance(struct scatter_walk *walk, |
@@ -55,6 +55,12 @@ static inline void scatterwalk_advance(struct scatter_walk *walk, | |||
55 | walk->len_this_segment -= nbytes; | 55 | walk->len_this_segment -= nbytes; |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline unsigned int scatterwalk_aligned(struct scatter_walk *walk, | ||
59 | unsigned int alignmask) | ||
60 | { | ||
61 | return !(walk->offset & alignmask); | ||
62 | } | ||
63 | |||
58 | void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); | 64 | void scatterwalk_start(struct scatter_walk *walk, struct scatterlist *sg); |
59 | int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, size_t nbytes, int out); | 65 | int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, size_t nbytes, int out); |
60 | void scatterwalk_map(struct scatter_walk *walk, int out); | 66 | void scatterwalk_map(struct scatter_walk *walk, int out); |