Lines Matching refs:state

38 static void	z_comp_free(void *state);
39 static void z_decomp_free(void *state);
40 static int z_comp_init(void *state, unsigned char *options,
43 static int z_decomp_init(void *state, unsigned char *options,
46 static int z_compress(void *state, unsigned char *rptr,
49 static void z_incomp(void *state, unsigned char *ibuf, int icnt);
50 static int z_decompress(void *state, unsigned char *ibuf,
52 static void z_comp_reset(void *state);
53 static void z_decomp_reset(void *state);
54 static void z_comp_stats(void *state, struct compstat *stats);
58 * @arg: pointer to the private state for the compressor.
62 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
64 if (state) {
65 zlib_deflateEnd(&state->strm);
66 vfree(state->strm.workspace);
67 kfree(state);
82 * Returns the pointer to the private state for the compressor,
87 struct ppp_deflate_state *state;
100 state = kzalloc(sizeof(*state),
102 if (state == NULL)
105 state->strm.next_in = NULL;
106 state->w_size = w_size;
107 state->strm.workspace = vmalloc(zlib_deflate_workspacesize(-w_size, 8));
108 if (state->strm.workspace == NULL)
111 if (zlib_deflateInit2(&state->strm, Z_DEFAULT_COMPRESSION,
115 return (void *) state;
118 z_comp_free(state);
124 * @arg: pointer to the private state for the compressor
140 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
146 DEFLATE_SIZE(options[2]) != state->w_size ||
150 state->seqno = 0;
151 state->unit = unit;
152 state->debug = debug;
154 zlib_deflateReset(&state->strm);
161 * @arg: pointer to private state for the compressor.
168 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
170 state->seqno = 0;
171 zlib_deflateReset(&state->strm);
176 * @arg: pointer to private state for the compressor
188 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
213 put_unaligned_be16(state->seqno, wptr);
216 state->strm.next_out = wptr;
217 state->strm.avail_out = oavail = osize - olen;
218 ++state->seqno;
222 state->strm.next_in = rptr;
223 state->strm.avail_in = (isize - off);
226 r = zlib_deflate(&state->strm, Z_PACKET_FLUSH);
228 if (state->debug)
233 if (state->strm.avail_out == 0) {
235 state->strm.next_out = NULL;
236 state->strm.avail_out = oavail = 1000000;
241 olen += oavail - state->strm.avail_out;
247 state->stats.comp_bytes += olen;
248 state->stats.comp_packets++;
250 state->stats.inc_bytes += isize;
251 state->stats.inc_packets++;
254 state->stats.unc_bytes += isize;
255 state->stats.unc_packets++;
268 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
270 *stats = state->stats;
279 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
281 if (state) {
282 vfree(state->strm.workspace);
283 kfree(state);
298 * Returns the pointer to the private state for the decompressor,
303 struct ppp_deflate_state *state;
316 state = kzalloc(sizeof(*state), GFP_KERNEL);
317 if (state == NULL)
320 state->w_size = w_size;
321 state->strm.next_out = NULL;
322 state->strm.workspace = vmalloc(zlib_inflate_workspacesize());
323 if (state->strm.workspace == NULL)
326 if (zlib_inflateInit2(&state->strm, -w_size) != Z_OK)
328 return (void *) state;
331 z_decomp_free(state);
337 * @arg: pointer to the private state for the decompressor
354 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
360 DEFLATE_SIZE(options[2]) != state->w_size ||
364 state->seqno = 0;
365 state->unit = unit;
366 state->debug = debug;
367 state->mru = mru;
369 zlib_inflateReset(&state->strm);
376 * @arg: pointer to private state for the decompressor.
383 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
385 state->seqno = 0;
386 zlib_inflateReset(&state->strm);
391 * @arg: pointer to private state for the decompressor
413 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
419 if (state->debug)
421 state->unit, isize);
427 if (seq != (state->seqno & 0xffff)) {
428 if (state->debug)
430 state->unit, seq, state->seqno & 0xffff);
433 ++state->seqno;
448 state->strm.next_in = ibuf + PPP_HDRLEN + DEFLATE_OVHD;
449 state->strm.avail_in = isize - (PPP_HDRLEN + DEFLATE_OVHD);
450 state->strm.next_out = obuf + 3;
451 state->strm.avail_out = 1;
459 r = zlib_inflate(&state->strm, Z_PACKET_FLUSH);
461 if (state->debug)
463 state->unit, r, (state->strm.msg? state->strm.msg: ""));
466 if (state->strm.avail_out != 0)
469 state->strm.avail_out = osize - PPP_HDRLEN;
473 --state->strm.next_out;
474 ++state->strm.avail_out;
483 state->strm.next_out = overflow_buf;
484 state->strm.avail_out = 1;
487 if (state->debug)
489 state->unit);
495 if (state->debug)
497 state->unit);
501 olen = osize + overflow - state->strm.avail_out;
502 state->stats.unc_bytes += olen;
503 state->stats.unc_packets++;
504 state->stats.comp_bytes += isize;
505 state->stats.comp_packets++;
512 * @arg: pointer to private state for the decompressor
518 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
528 ++state->seqno;
534 state->strm.next_in = ibuf + 3;
535 state->strm.avail_in = icnt - 3;
537 --state->strm.next_in;
538 ++state->strm.avail_in;
541 r = zlib_inflateIncomp(&state->strm);
544 if (state->debug) {
546 state->unit, r, (state->strm.msg? state->strm.msg: ""));
554 state->stats.inc_bytes += icnt;
555 state->stats.inc_packets++;
556 state->stats.unc_bytes += icnt;
557 state->stats.unc_packets++;