/* Do not call this unless the total length of all of the fragments has been verified as multiple of the block size.  */
int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, size_t nbytes, int out)
/* Do not call this unless the total length of all of the fragments has been verified as multiple of the block size.  */
int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, size_t nbytes, int out)
{
	if (buf != walk->data) {
		while (nbytes > walk->len_this_page) {
			memcpy_dir(buf, walk->data, walk->len_this_page, out);
			buf += walk->len_this_page;
			nbytes -= walk->len_this_page;
			crypto_kunmap(walk->data, out);
			scatterwalk_pagedone(walk, out, 1);
			scatterwalk_map(walk, out);
		}
		memcpy_dir(buf, walk->data, nbytes, out);
	}
	walk->offset += nbytes;
	walk->len_this_page -= nbytes;
	walk->len_this_segment -= nbytes;
	return 0;
}