diff options
Diffstat (limited to 'crypto/scatterwalk.c')
-rw-r--r-- | crypto/scatterwalk.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c index 81afd1790a1..e93a8f6f35d 100644 --- a/crypto/scatterwalk.c +++ b/crypto/scatterwalk.c | |||
@@ -107,3 +107,25 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk, | |||
107 | } | 107 | } |
108 | } | 108 | } |
109 | EXPORT_SYMBOL_GPL(scatterwalk_copychunks); | 109 | EXPORT_SYMBOL_GPL(scatterwalk_copychunks); |
110 | |||
111 | void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg, | ||
112 | unsigned int start, unsigned int nbytes, int out) | ||
113 | { | ||
114 | struct scatter_walk walk; | ||
115 | unsigned int offset = 0; | ||
116 | |||
117 | for (;;) { | ||
118 | scatterwalk_start(&walk, sg); | ||
119 | |||
120 | if (start < offset + sg->length) | ||
121 | break; | ||
122 | |||
123 | offset += sg->length; | ||
124 | sg = sg_next(sg); | ||
125 | } | ||
126 | |||
127 | scatterwalk_advance(&walk, start - offset); | ||
128 | scatterwalk_copychunks(buf, &walk, nbytes, out); | ||
129 | scatterwalk_done(&walk, out, 0); | ||
130 | } | ||
131 | EXPORT_SYMBOL_GPL(scatterwalk_map_and_copy); | ||