Lines Matching defs:rb_head
1735 sghsc_rb_setup(sghsc_rb_head_t *rb_head)
1737 if (rb_head->buf == NULL) {
1738 rb_head->put_idx = 0;
1739 rb_head->get_idx = 0;
1740 rb_head->size = SGHSC_RING_BUFFER_SZ;
1741 rb_head->state = SGHSC_RB_EMPTY;
1746 rb_head->buf = (sghsc_event_t *)kmem_zalloc(
1747 sizeof (sghsc_event_t) * rb_head->size, KM_SLEEP);
1756 sghsc_rb_teardown(sghsc_rb_head_t *rb_head)
1758 if (rb_head->buf != NULL) {
1762 kmem_free(rb_head->buf,
1763 (size_t)(sizeof (sghsc_event_t) * rb_head->size));
1765 rb_head->buf = NULL;
1766 rb_head->put_idx = 0;
1767 rb_head->get_idx = 0;
1768 rb_head->size = 0;
1769 rb_head->state = SGHSC_RB_EMPTY;
1779 sghsc_rb_put(sghsc_rb_head_t *rb_head, sghsc_event_t *event)
1781 if (rb_head->state == SGHSC_RB_FULL)
1784 rb_head->buf[rb_head->put_idx] = *event;
1786 rb_head->put_idx = ++rb_head->put_idx & (rb_head->size - 1);
1788 if (rb_head->put_idx == rb_head->get_idx)
1789 rb_head->state = SGHSC_RB_FULL;
1791 rb_head->state = SGHSC_RB_FLOAT;
1801 sghsc_rb_get(sghsc_rb_head_t *rb_head, sghsc_event_t *event)
1804 if (rb_head->state == SGHSC_RB_EMPTY)
1807 *event = rb_head->buf[rb_head->get_idx];
1809 rb_head->get_idx = ++rb_head->get_idx & (rb_head->size - 1);
1811 if (rb_head->get_idx == rb_head->put_idx)
1812 rb_head->state = SGHSC_RB_EMPTY;
1814 rb_head->state = SGHSC_RB_FLOAT;