Lines Matching refs:maxlen

15 cirbuf_init(struct cirbuf *cbuf, char *buf, unsigned int start, unsigned int maxlen)  in cirbuf_init()  argument
19 cbuf->maxlen = maxlen; in cirbuf_init()
46 dprintf("s[%d] -> d[%d] (%d)\n", cbuf->maxlen - n + in cirbuf_add_buf_head()
49 memcpy(cbuf->buf + cbuf->maxlen - n + (cbuf->start + e), c, in cirbuf_add_buf_head()
53 cbuf->start += (cbuf->maxlen - n + e); in cirbuf_add_buf_head()
54 cbuf->start %= cbuf->maxlen; in cirbuf_add_buf_head()
70 if (n < cbuf->maxlen - cbuf->end - 1 + e) { in cirbuf_add_buf_tail()
76 cbuf->maxlen - cbuf->end - 1 + e); in cirbuf_add_buf_tail()
77 dprintf("s[%d] -> d[%d] (%d)\n", cbuf->maxlen - cbuf->end - 1 + in cirbuf_add_buf_tail()
78 e, 0, n - cbuf->maxlen + cbuf->end + 1 - e); in cirbuf_add_buf_tail()
79 memcpy(cbuf->buf + cbuf->end + !e, c, cbuf->maxlen - in cirbuf_add_buf_tail()
81 memcpy(cbuf->buf, c + cbuf->maxlen - cbuf->end - 1 + e, in cirbuf_add_buf_tail()
82 n - cbuf->maxlen + cbuf->end + 1 - e); in cirbuf_add_buf_tail()
86 cbuf->end %= cbuf->maxlen; in cirbuf_add_buf_tail()
96 cbuf->start += (cbuf->maxlen - 1); in __cirbuf_add_head()
97 cbuf->start %= cbuf->maxlen; in __cirbuf_add_head()
126 cbuf->end %= cbuf->maxlen; in __cirbuf_add_tail()
156 cbuf->buf[(cbuf->start+i)%cbuf->maxlen] = in __cirbuf_shift_left()
157 cbuf->buf[(cbuf->start+i+1)%cbuf->maxlen]; in __cirbuf_shift_left()
159 cbuf->buf[(cbuf->start-1+cbuf->maxlen)%cbuf->maxlen] = tmp; in __cirbuf_shift_left()
160 cbuf->start += (cbuf->maxlen - 1); in __cirbuf_shift_left()
161 cbuf->start %= cbuf->maxlen; in __cirbuf_shift_left()
162 cbuf->end += (cbuf->maxlen - 1); in __cirbuf_shift_left()
163 cbuf->end %= cbuf->maxlen; in __cirbuf_shift_left()
173 cbuf->buf[(cbuf->end+cbuf->maxlen-i)%cbuf->maxlen] = in __cirbuf_shift_right()
174 cbuf->buf[(cbuf->end+cbuf->maxlen-i-1)%cbuf->maxlen]; in __cirbuf_shift_right()
176 cbuf->buf[(cbuf->end+1)%cbuf->maxlen] = tmp; in __cirbuf_shift_right()
178 cbuf->start %= cbuf->maxlen; in __cirbuf_shift_right()
180 cbuf->end %= cbuf->maxlen; in __cirbuf_shift_right()
190 if (cbuf->start < cbuf->maxlen/2) { in cirbuf_align_left()
211 if (cbuf->start >= cbuf->maxlen/2) { in cirbuf_align_right()
212 while (cbuf->end != cbuf->maxlen-1) { in cirbuf_align_right()
217 while (cbuf->start != cbuf->maxlen-1) { in cirbuf_align_right()
236 cbuf->start %= cbuf->maxlen; in cirbuf_del_buf_head()
240 cbuf->start %= cbuf->maxlen; in cirbuf_del_buf_head()
255 cbuf->end += (cbuf->maxlen - size + 1); in cirbuf_del_buf_tail()
256 cbuf->end %= cbuf->maxlen; in cirbuf_del_buf_tail()
259 cbuf->end += (cbuf->maxlen - size); in cirbuf_del_buf_tail()
260 cbuf->end %= cbuf->maxlen; in cirbuf_del_buf_tail()
273 cbuf->start %= cbuf->maxlen; in __cirbuf_del_head()
300 cbuf->end += (cbuf->maxlen - 1); in __cirbuf_del_tail()
301 cbuf->end %= cbuf->maxlen; in __cirbuf_del_tail()
342 if (n <= cbuf->maxlen - cbuf->start) { in cirbuf_get_buf_head()
348 cbuf->maxlen - cbuf->start); in cirbuf_get_buf_head()
349 dprintf("s[%d] -> d[%d] (%d)\n", 0, cbuf->maxlen - cbuf->start, in cirbuf_get_buf_head()
350 n - cbuf->maxlen + cbuf->start); in cirbuf_get_buf_head()
351 memcpy(c, cbuf->buf + cbuf->start , cbuf->maxlen - cbuf->start); in cirbuf_get_buf_head()
352 memcpy(c + cbuf->maxlen - cbuf->start, cbuf->buf, in cirbuf_get_buf_head()
353 n - cbuf->maxlen + cbuf->start); in cirbuf_get_buf_head()
386 cbuf->maxlen - cbuf->start, cbuf->end + 1); in cirbuf_get_buf_tail()
388 cbuf->maxlen - n + cbuf->end + 1, 0, n - cbuf->end - 1); in cirbuf_get_buf_tail()
389 memcpy(c + cbuf->maxlen - cbuf->start, in cirbuf_get_buf_tail()
391 memcpy(c, cbuf->buf + cbuf->maxlen - n + cbuf->end +1, in cirbuf_get_buf_tail()