Lines Matching full:fr
59 struct fifolog_reader *fr; in fifolog_reader_open() local
62 fr = calloc(1, sizeof(*fr)); in fifolog_reader_open()
63 if (fr == NULL) in fifolog_reader_open()
66 retval = fifolog_int_open(&fr->ff, fname, 0); in fifolog_reader_open()
70 fr->obuf = calloc(16, fr->ff->recsize); in fifolog_reader_open()
71 if (fr->obuf == NULL) in fifolog_reader_open()
73 fr->olen = fr->ff->recsize * 16; in fifolog_reader_open()
75 i = inflateInit(fr->ff->zs); in fifolog_reader_open()
78 fr->magic = FIFOLOG_READER_MAGIC; in fifolog_reader_open()
79 return (fr); in fifolog_reader_open()
130 fifolog_reader_seek(const struct fifolog_reader *fr, time_t t0) in fifolog_reader_seek() argument
138 CHECK_OBJ_NOTNULL(fr, FIFOLOG_READER_MAGIC); in fifolog_reader_seek()
144 e = fifolog_reader_findsync(fr->ff, &o); in fifolog_reader_seek()
149 assert(fr->ff->recbuf[4] & FIFOLOG_FLG_SYNC); in fifolog_reader_seek()
150 seq = be32dec(fr->ff->recbuf); in fifolog_reader_seek()
151 t = be32dec(fr->ff->recbuf + 5); in fifolog_reader_seek()
155 retval = fifolog_int_findend(fr->ff, &s); in fifolog_reader_seek()
159 e = fifolog_reader_findsync(fr->ff, &s); in fifolog_reader_seek()
164 seq = be32dec(fr->ff->recbuf); in fifolog_reader_seek()
165 t = be32dec(fr->ff->recbuf + 5); in fifolog_reader_seek()
170 s = st = (fr->ff->logsize - o) / 2; in fifolog_reader_seek()
173 if (o + st > fr->ff->logsize + 1) { in fifolog_reader_seek()
177 e = fifolog_int_read(fr->ff, o + st); in fifolog_reader_seek()
183 seqs = be32dec(fr->ff->recbuf); in fifolog_reader_seek()
189 if (!(fr->ff->recbuf[4] & FIFOLOG_FLG_SYNC)) { in fifolog_reader_seek()
194 tt = be32dec(fr->ff->recbuf + 5); in fifolog_reader_seek()
202 fprintf(stderr, "Read from %jx\n", o * fr->ff->recsize); in fifolog_reader_seek()
207 fifolog_reader_chop(struct fifolog_reader *fr, fifolog_reader_render_t *func, void *priv) in fifolog_reader_chop() argument
212 p = fr->obuf; in fifolog_reader_chop()
213 q = fr->obuf + (fr->olen - fr->ff->zs->avail_out); in fifolog_reader_chop()
222 fr->now = be32dec(p + 4); in fifolog_reader_chop()
237 func(priv, fr->now, u, p + w, v); in fifolog_reader_chop()
247 fifolog_reader_process(struct fifolog_reader *fr, off_t from, fifolog_reader_render_t *func, void *… in fifolog_reader_process() argument
256 CHECK_OBJ_NOTNULL(fr, FIFOLOG_READER_MAGIC); in fifolog_reader_process()
257 zs = fr->ff->zs; in fifolog_reader_process()
260 e = fifolog_int_read(fr->ff, o); in fifolog_reader_process()
263 if (++o >= fr->ff->logsize) in fifolog_reader_process()
265 seq = be32dec(fr->ff->recbuf); in fifolog_reader_process()
269 zs->avail_in = fr->ff->recsize - 5; in fifolog_reader_process()
270 zs->next_in = fr->ff->recbuf + 5; in fifolog_reader_process()
271 if (fr->ff->recbuf[4] & FIFOLOG_FLG_1BYTE) in fifolog_reader_process()
272 zs->avail_in -= fr->ff->recbuf[fr->ff->recsize - 1]; in fifolog_reader_process()
273 if (fr->ff->recbuf[4] & FIFOLOG_FLG_4BYTE) in fifolog_reader_process()
275 be32dec(fr->ff->recbuf + fr->ff->recsize - 4); in fifolog_reader_process()
276 if (fr->ff->recbuf[4] & FIFOLOG_FLG_SYNC) { in fifolog_reader_process()
279 zs->next_out = fr->obuf; in fifolog_reader_process()
280 zs->avail_out = fr->olen; in fifolog_reader_process()
281 t = be32dec(fr->ff->recbuf + 5); in fifolog_reader_process()
294 (int)(zs->next_in - fr->ff->recbuf), in fifolog_reader_process()
296 (int)(zs->next_out - fr->obuf), in fifolog_reader_process()
297 zs->avail_out, fr->olen); in fifolog_reader_process()
312 if (zs->avail_out != fr->olen) { in fifolog_reader_process()
313 q = fr->obuf + (fr->olen - zs->avail_out); in fifolog_reader_process()
314 p = fifolog_reader_chop(fr, func, priv); in fifolog_reader_process()
316 (void)memmove(fr->obuf, p, q - p); in fifolog_reader_process()
317 zs->avail_out = fr->olen - (q - p); in fifolog_reader_process()
318 zs->next_out = fr->obuf + (q - p); in fifolog_reader_process()