Lines Matching refs:bufs
60 rb_entry_t *bufs; // Array of buffer pointers member
111 rbc->bufs = (rb_entry_t *)malloc(num_bufs * sizeof(rb_entry_t)); in ring_buffer_init()
112 if (rbc->bufs == NULL) { in ring_buffer_init()
117 memset(rbc->bufs, 0, (num_bufs * sizeof(rb_entry_t))); in ring_buffer_init()
143 free(rbc->bufs[buf_no].data); in ring_buffer_deinit()
145 free(rbc->bufs); in ring_buffer_deinit()
170 if (rbc->bufs[rbc->wr_buf_no].full == 1) in rb_write()
192 if (rbc->bufs[next_buf_no].full == 1) { in rb_write()
206 if (rbc->bufs[next_buf_no].full == 1) { in rb_write()
216 rbc->bufs[rbc->wr_buf_no].full = 1; in rb_write()
217 rbc->bufs[rbc->wr_buf_no].last_wr_index = rbc->cur_wr_buf_idx; in rb_write()
232 if (rbc->bufs[rbc->wr_buf_no].data == NULL) { in rb_write()
233 rbc->bufs[rbc->wr_buf_no].data = (u8 *)malloc(rbc->each_buf_size); in rb_write()
234 if (rbc->bufs[rbc->wr_buf_no].data == NULL) { in rb_write()
265 rbc->bufs[rbc->rd_buf_no].last_wr_index) { in rb_write()
275 rbc->bufs[rbc->wr_buf_no].full = 0; in rb_write()
285 memcpy((rbc->bufs[rbc->wr_buf_no].data + rbc->cur_wr_buf_idx), in rb_write()
294 rbc->bufs[rbc->wr_buf_no].full = 1; in rb_write()
295 rbc->bufs[rbc->wr_buf_no].last_wr_index = rbc->cur_wr_buf_idx; in rb_write()
352 if (rbc->bufs[rbc->rd_buf_no].data == NULL) { in rb_read()
392 (rbc->bufs[rbc->rd_buf_no].data + rbc->cur_rd_buf_idx), in rb_read()
400 free(rbc->bufs[rbc->rd_buf_no].data); in rb_read()
401 rbc->bufs[rbc->rd_buf_no].data = NULL; in rb_read()
444 if (rbc->bufs[rbc->rd_buf_no].data == NULL) { in rb_get_read_buf()
450 if ((rbc->bufs[rbc->rd_buf_no].full == 1) && in rb_get_read_buf()
451 (rbc->cur_rd_buf_idx == rbc->bufs[rbc->rd_buf_no].last_wr_index)) { in rb_get_read_buf()
453 free(rbc->bufs[rbc->rd_buf_no].data); in rb_get_read_buf()
454 rbc->bufs[rbc->rd_buf_no].data = NULL; in rb_get_read_buf()
456 rbc->bufs[rbc->rd_buf_no].full = 0; in rb_get_read_buf()
478 cur_read_len = rbc->bufs[rbc->rd_buf_no].last_wr_index - rbc->cur_rd_buf_idx; in rb_get_read_buf()
483 cur_read_len = rbc->bufs[rbc->rd_buf_no].last_wr_index; in rb_get_read_buf()
486 cur_read_len = rbc->bufs[rbc->rd_buf_no].last_wr_index - rbc->cur_rd_buf_idx; in rb_get_read_buf()
490 if ((rbc->bufs[rbc->rd_buf_no].full == 1) && in rb_get_read_buf()
493 buf = rbc->bufs[rbc->rd_buf_no].data; in rb_get_read_buf()
494 rbc->bufs[rbc->rd_buf_no].data = NULL; in rb_get_read_buf()
497 rbc->bufs[rbc->rd_buf_no].full = 0; in rb_get_read_buf()
515 (rbc->bufs[rbc->rd_buf_no].data + rbc->cur_rd_buf_idx), in rb_get_read_buf()
519 if (rbc->bufs[rbc->rd_buf_no].full == 1) { in rb_get_read_buf()
521 free(rbc->bufs[rbc->rd_buf_no].data); in rb_get_read_buf()
522 rbc->bufs[rbc->rd_buf_no].data = NULL; in rb_get_read_buf()
524 rbc->bufs[rbc->rd_buf_no].full = 0; in rb_get_read_buf()