Lines Matching +full:data +full:- +full:out

1 // SPDX-License-Identifier: GPL-2.0
4 * Important notes about in-place decompression
6 * At least on x86, the kernel is decompressed in place: the compressed data
8 * most of the compressed data. There must be enough safety margin to
14 * The worst case for in-place decompression is that the beginning of
16 * uncompressible. Thus, we must look for worst-case expansion when the
17 * compressor is encoding uncompressible data.
28 * ZSTD stores the data in blocks. Each block has a header whose size is
43 * - 22 bytes for the .zst file format headers;
44 * - 3 bytes per every 128 KiB of uncompressed size (one block header per
46 * - 128 KiB (biggest possible zstd block size) to make sure that the
85 * Size of the input and output buffers in multi-call mode.
101 error("ZSTD decompressor ran out of memory"); in handle_zstd_error()
109 error("ZSTD-compressed data is corrupt"); in handle_zstd_error()
112 error("ZSTD-compressed data is probably corrupt"); in handle_zstd_error()
115 return -1; in handle_zstd_error()
134 error("Out of memory while allocating ZSTD_DCtx"); in decompress_single()
135 err = -1; in decompress_single()
136 goto out; in decompress_single()
139 * Find out how large the frame actually is, there may be junk at in decompress_single()
145 goto out; in decompress_single()
151 goto out; in decompress_single()
157 out: in decompress_single()
171 ZSTD_outBuffer out; in __unzstd() local
187 out_len = UINTPTR_MAX - (uintptr_t)out_buf; in __unzstd()
205 error("Out of memory while allocating input buffer"); in __unzstd()
206 err = -1; in __unzstd()
207 goto out; in __unzstd()
216 error("ZSTD-compressed data is truncated"); in __unzstd()
217 err = -1; in __unzstd()
218 goto out; in __unzstd()
220 /* Set the first non-empty input buffer. */ in __unzstd()
228 error("Out of memory while allocating output buffer"); in __unzstd()
229 err = -1; in __unzstd()
230 goto out; in __unzstd()
236 out.dst = out_buf; in __unzstd()
237 out.pos = 0; in __unzstd()
238 out.size = out_len; in __unzstd()
250 goto out; in __unzstd()
252 error("ZSTD-compressed data has an incomplete frame header"); in __unzstd()
253 err = -1; in __unzstd()
254 goto out; in __unzstd()
257 error("ZSTD-compressed data has too large a window size"); in __unzstd()
258 err = -1; in __unzstd()
259 goto out; in __unzstd()
270 error("Out of memory while allocating ZSTD_DStream"); in __unzstd()
271 err = -1; in __unzstd()
272 goto out; in __unzstd()
277 * Read more data if necessary (error if no more data can be read). in __unzstd()
279 * Flush any data produced if using flush(). in __unzstd()
285 * If we need to reload data, either we have fill() and can in __unzstd()
286 * try to get more data, or we don't and the input is truncated. in __unzstd()
291 in_len = fill ? fill(in_buf, ZSTD_IOBUF_SIZE) : -1; in __unzstd()
293 error("ZSTD-compressed data is truncated"); in __unzstd()
294 err = -1; in __unzstd()
295 goto out; in __unzstd()
301 ret = ZSTD_decompressStream(dstream, &out, &in); in __unzstd()
304 goto out; in __unzstd()
305 /* Flush all of the data produced if using flush(). */ in __unzstd()
306 if (flush != NULL && out.pos > 0) { in __unzstd()
307 if (out.pos != flush(out.dst, out.pos)) { in __unzstd()
309 err = -1; in __unzstd()
310 goto out; in __unzstd()
312 out.pos = 0; in __unzstd()
320 out: in __unzstd()