Lines Matching defs:rq

23 static int z_erofs_decompress_deflate(struct z_erofs_decompress_req *rq)
25 u8 *dest = (u8 *)rq->out;
26 u8 *src = (u8 *)rq->in;
36 if (inputmargin >= rq->inputsize)
39 if (rq->decodedskip) {
40 buff = malloc(rq->decodedlength);
59 strm.avail_in = rq->inputsize - inputmargin;
61 strm.avail_out = rq->decodedlength;
63 ret = inflate(&strm, rq->partial_decoding ? Z_SYNC_FLUSH : Z_FINISH);
64 if (ret != Z_STREAM_END || strm.total_out != rq->decodedlength) {
65 if (ret != Z_OK || !rq->partial_decoding) {
71 if (rq->decodedskip)
72 memcpy(rq->out, dest + rq->decodedskip,
73 rq->decodedlength - rq->decodedskip);
85 static int z_erofs_decompress_lz4(struct z_erofs_decompress_req *rq)
88 char *dest = rq->out;
89 char *src = rq->in;
101 if (inputmargin >= rq->inputsize)
105 if (rq->decodedskip) {
106 buff = malloc(rq->decodedlength);
112 if (rq->partial_decoding || !support_0padding)
114 rq->inputsize - inputmargin,
115 rq->decodedlength, rq->decodedlength);
118 rq->inputsize - inputmargin,
119 rq->decodedlength);
121 if (ret != (int)rq->decodedlength) {
123 rq->partial_decoding ? "partial" : "full",
124 ret, rq->inputsize, inputmargin, rq->decodedlength);
129 if (rq->decodedskip)
130 memcpy(rq->out, dest + rq->decodedskip,
131 rq->decodedlength - rq->decodedskip);
141 int z_erofs_decompress(struct z_erofs_decompress_req *rq)
143 if (rq->alg == Z_EROFS_COMPRESSION_INTERLACED) {
147 if (rq->inputsize > erofs_blksiz())
150 if (rq->decodedlength > erofs_blksiz())
153 if (rq->decodedlength < rq->decodedskip)
156 count = rq->decodedlength - rq->decodedskip;
157 skip = erofs_blkoff(rq->interlaced_offset + rq->decodedskip);
159 memcpy(rq->out, rq->in + skip, rightpart);
160 memcpy(rq->out + rightpart, rq->in, count - rightpart);
162 } else if (rq->alg == Z_EROFS_COMPRESSION_SHIFTED) {
163 if (rq->decodedlength > rq->inputsize)
166 DBG_BUGON(rq->decodedlength < rq->decodedskip);
167 memcpy(rq->out, rq->in + rq->decodedskip,
168 rq->decodedlength - rq->decodedskip);
173 if (rq->alg == Z_EROFS_COMPRESSION_LZ4)
174 return z_erofs_decompress_lz4(rq);
177 if (rq->alg == Z_EROFS_COMPRESSION_DEFLATE)
178 return z_erofs_decompress_deflate(rq);