• Home
  • Raw
  • Download

Lines Matching refs:state

41 static void	z_comp_free(void *state);
42 static void z_decomp_free(void *state);
43 static int z_comp_init(void *state, unsigned char *options,
46 static int z_decomp_init(void *state, unsigned char *options,
49 static int z_compress(void *state, unsigned char *rptr,
52 static void z_incomp(void *state, unsigned char *ibuf, int icnt);
53 static int z_decompress(void *state, unsigned char *ibuf,
55 static void z_comp_reset(void *state);
56 static void z_decomp_reset(void *state);
57 static void z_comp_stats(void *state, struct compstat *stats);
65 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_comp_free() local
67 if (state) { in z_comp_free()
68 zlib_deflateEnd(&state->strm); in z_comp_free()
69 vfree(state->strm.workspace); in z_comp_free()
70 kfree(state); in z_comp_free()
90 struct ppp_deflate_state *state; in z_comp_alloc() local
103 state = kzalloc(sizeof(*state), in z_comp_alloc()
105 if (state == NULL) in z_comp_alloc()
108 state->strm.next_in = NULL; in z_comp_alloc()
109 state->w_size = w_size; in z_comp_alloc()
110 state->strm.workspace = vmalloc(zlib_deflate_workspacesize(-w_size, 8)); in z_comp_alloc()
111 if (state->strm.workspace == NULL) in z_comp_alloc()
114 if (zlib_deflateInit2(&state->strm, Z_DEFAULT_COMPRESSION, in z_comp_alloc()
118 return (void *) state; in z_comp_alloc()
121 z_comp_free(state); in z_comp_alloc()
143 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_comp_init() local
149 DEFLATE_SIZE(options[2]) != state->w_size || in z_comp_init()
153 state->seqno = 0; in z_comp_init()
154 state->unit = unit; in z_comp_init()
155 state->debug = debug; in z_comp_init()
157 zlib_deflateReset(&state->strm); in z_comp_init()
171 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_comp_reset() local
173 state->seqno = 0; in z_comp_reset()
174 zlib_deflateReset(&state->strm); in z_comp_reset()
191 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_compress() local
216 put_unaligned_be16(state->seqno, wptr); in z_compress()
219 state->strm.next_out = wptr; in z_compress()
220 state->strm.avail_out = oavail = osize - olen; in z_compress()
221 ++state->seqno; in z_compress()
225 state->strm.next_in = rptr; in z_compress()
226 state->strm.avail_in = (isize - off); in z_compress()
229 r = zlib_deflate(&state->strm, Z_PACKET_FLUSH); in z_compress()
231 if (state->debug) in z_compress()
236 if (state->strm.avail_out == 0) { in z_compress()
238 state->strm.next_out = NULL; in z_compress()
239 state->strm.avail_out = oavail = 1000000; in z_compress()
244 olen += oavail - state->strm.avail_out; in z_compress()
250 state->stats.comp_bytes += olen; in z_compress()
251 state->stats.comp_packets++; in z_compress()
253 state->stats.inc_bytes += isize; in z_compress()
254 state->stats.inc_packets++; in z_compress()
257 state->stats.unc_bytes += isize; in z_compress()
258 state->stats.unc_packets++; in z_compress()
271 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_comp_stats() local
273 *stats = state->stats; in z_comp_stats()
282 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_decomp_free() local
284 if (state) { in z_decomp_free()
285 zlib_inflateEnd(&state->strm); in z_decomp_free()
286 vfree(state->strm.workspace); in z_decomp_free()
287 kfree(state); in z_decomp_free()
307 struct ppp_deflate_state *state; in z_decomp_alloc() local
320 state = kzalloc(sizeof(*state), GFP_KERNEL); in z_decomp_alloc()
321 if (state == NULL) in z_decomp_alloc()
324 state->w_size = w_size; in z_decomp_alloc()
325 state->strm.next_out = NULL; in z_decomp_alloc()
326 state->strm.workspace = vmalloc(zlib_inflate_workspacesize()); in z_decomp_alloc()
327 if (state->strm.workspace == NULL) in z_decomp_alloc()
330 if (zlib_inflateInit2(&state->strm, -w_size) != Z_OK) in z_decomp_alloc()
332 return (void *) state; in z_decomp_alloc()
335 z_decomp_free(state); in z_decomp_alloc()
358 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_decomp_init() local
364 DEFLATE_SIZE(options[2]) != state->w_size || in z_decomp_init()
368 state->seqno = 0; in z_decomp_init()
369 state->unit = unit; in z_decomp_init()
370 state->debug = debug; in z_decomp_init()
371 state->mru = mru; in z_decomp_init()
373 zlib_inflateReset(&state->strm); in z_decomp_init()
387 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_decomp_reset() local
389 state->seqno = 0; in z_decomp_reset()
390 zlib_inflateReset(&state->strm); in z_decomp_reset()
417 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_decompress() local
423 if (state->debug) in z_decompress()
425 state->unit, isize); in z_decompress()
431 if (seq != (state->seqno & 0xffff)) { in z_decompress()
432 if (state->debug) in z_decompress()
434 state->unit, seq, state->seqno & 0xffff); in z_decompress()
437 ++state->seqno; in z_decompress()
452 state->strm.next_in = ibuf + PPP_HDRLEN + DEFLATE_OVHD; in z_decompress()
453 state->strm.avail_in = isize - (PPP_HDRLEN + DEFLATE_OVHD); in z_decompress()
454 state->strm.next_out = obuf + 3; in z_decompress()
455 state->strm.avail_out = 1; in z_decompress()
463 r = zlib_inflate(&state->strm, Z_PACKET_FLUSH); in z_decompress()
465 if (state->debug) in z_decompress()
467 state->unit, r, (state->strm.msg? state->strm.msg: "")); in z_decompress()
470 if (state->strm.avail_out != 0) in z_decompress()
473 state->strm.avail_out = osize - PPP_HDRLEN; in z_decompress()
477 --state->strm.next_out; in z_decompress()
478 ++state->strm.avail_out; in z_decompress()
487 state->strm.next_out = overflow_buf; in z_decompress()
488 state->strm.avail_out = 1; in z_decompress()
491 if (state->debug) in z_decompress()
493 state->unit); in z_decompress()
499 if (state->debug) in z_decompress()
501 state->unit); in z_decompress()
505 olen = osize + overflow - state->strm.avail_out; in z_decompress()
506 state->stats.unc_bytes += olen; in z_decompress()
507 state->stats.unc_packets++; in z_decompress()
508 state->stats.comp_bytes += isize; in z_decompress()
509 state->stats.comp_packets++; in z_decompress()
522 struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg; in z_incomp() local
532 ++state->seqno; in z_incomp()
538 state->strm.next_in = ibuf + 3; in z_incomp()
539 state->strm.avail_in = icnt - 3; in z_incomp()
541 --state->strm.next_in; in z_incomp()
542 ++state->strm.avail_in; in z_incomp()
545 r = zlib_inflateIncomp(&state->strm); in z_incomp()
548 if (state->debug) { in z_incomp()
550 state->unit, r, (state->strm.msg? state->strm.msg: "")); in z_incomp()
558 state->stats.inc_bytes += icnt; in z_incomp()
559 state->stats.inc_packets++; in z_incomp()
560 state->stats.unc_bytes += icnt; in z_incomp()
561 state->stats.unc_packets++; in z_incomp()