lz4_wrapper.c (e5451c8f8330e03ad3cfa16048b4daf961af434f) lz4_wrapper.c (09cbfeaf1a5a67bfb3201e0c83c810cecb2efa5a)
1/*
2 * Copyright (c) 2013, 2014
3 * Phillip Lougher <phillip@squashfs.org.uk>
4 *
5 * This work is licensed under the terms of the GNU GPL, version 2. See
6 * the COPYING file in the top-level directory.
7 */
8

--- 103 unchanged lines hidden (view full) ---

112 stream->output, &dest_len);
113 if (res)
114 return -EIO;
115
116 bytes = dest_len;
117 data = squashfs_first_page(output);
118 buff = stream->output;
119 while (data) {
1/*
2 * Copyright (c) 2013, 2014
3 * Phillip Lougher <phillip@squashfs.org.uk>
4 *
5 * This work is licensed under the terms of the GNU GPL, version 2. See
6 * the COPYING file in the top-level directory.
7 */
8

--- 103 unchanged lines hidden (view full) ---

112 stream->output, &dest_len);
113 if (res)
114 return -EIO;
115
116 bytes = dest_len;
117 data = squashfs_first_page(output);
118 buff = stream->output;
119 while (data) {
120 if (bytes <= PAGE_CACHE_SIZE) {
120 if (bytes <= PAGE_SIZE) {
121 memcpy(data, buff, bytes);
122 break;
123 }
121 memcpy(data, buff, bytes);
122 break;
123 }
124 memcpy(data, buff, PAGE_CACHE_SIZE);
125 buff += PAGE_CACHE_SIZE;
126 bytes -= PAGE_CACHE_SIZE;
124 memcpy(data, buff, PAGE_SIZE);
125 buff += PAGE_SIZE;
126 bytes -= PAGE_SIZE;
127 data = squashfs_next_page(output);
128 }
129 squashfs_finish_page(output);
130
131 return dest_len;
132}
133
134const struct squashfs_decompressor squashfs_lz4_comp_ops = {
135 .init = lz4_init,
136 .comp_opts = lz4_comp_opts,
137 .free = lz4_free,
138 .decompress = lz4_uncompress,
139 .id = LZ4_COMPRESSION,
140 .name = "lz4",
141 .supported = 1
142};
127 data = squashfs_next_page(output);
128 }
129 squashfs_finish_page(output);
130
131 return dest_len;
132}
133
134const struct squashfs_decompressor squashfs_lz4_comp_ops = {
135 .init = lz4_init,
136 .comp_opts = lz4_comp_opts,
137 .free = lz4_free,
138 .decompress = lz4_uncompress,
139 .id = LZ4_COMPRESSION,
140 .name = "lz4",
141 .supported = 1
142};