Lines Matching refs:bufs
153 tlm_buffer_advance_in_idx(tlm_buffers_t *bufs) in tlm_buffer_advance_in_idx() argument
155 if (bufs == NULL) in tlm_buffer_advance_in_idx()
158 (void) mutex_lock(&bufs->tbs_mtx); in tlm_buffer_advance_in_idx()
159 if (++bufs->tbs_buffer_in >= TLM_TAPE_BUFFERS) in tlm_buffer_advance_in_idx()
160 bufs->tbs_buffer_in = 0; in tlm_buffer_advance_in_idx()
162 (void) mutex_unlock(&bufs->tbs_mtx); in tlm_buffer_advance_in_idx()
163 return (&bufs->tbs_buffer[bufs->tbs_buffer_in]); in tlm_buffer_advance_in_idx()
174 tlm_buffer_advance_out_idx(tlm_buffers_t *bufs) in tlm_buffer_advance_out_idx() argument
176 if (bufs == NULL) in tlm_buffer_advance_out_idx()
179 (void) mutex_lock(&bufs->tbs_mtx); in tlm_buffer_advance_out_idx()
180 if (++bufs->tbs_buffer_out >= TLM_TAPE_BUFFERS) in tlm_buffer_advance_out_idx()
181 bufs->tbs_buffer_out = 0; in tlm_buffer_advance_out_idx()
183 (void) mutex_unlock(&bufs->tbs_mtx); in tlm_buffer_advance_out_idx()
184 return (&bufs->tbs_buffer[bufs->tbs_buffer_out]); in tlm_buffer_advance_out_idx()
194 tlm_buffer_in_buf(tlm_buffers_t *bufs, int *idx) in tlm_buffer_in_buf() argument
198 if (bufs == NULL) in tlm_buffer_in_buf()
201 (void) mutex_lock(&bufs->tbs_mtx); in tlm_buffer_in_buf()
202 ret = &bufs->tbs_buffer[bufs->tbs_buffer_in]; in tlm_buffer_in_buf()
204 *idx = bufs->tbs_buffer_in; in tlm_buffer_in_buf()
205 (void) mutex_unlock(&bufs->tbs_mtx); in tlm_buffer_in_buf()
216 tlm_buffer_out_buf(tlm_buffers_t *bufs, int *idx) in tlm_buffer_out_buf() argument
220 if (bufs == NULL) in tlm_buffer_out_buf()
223 (void) mutex_lock(&bufs->tbs_mtx); in tlm_buffer_out_buf()
224 ret = &bufs->tbs_buffer[bufs->tbs_buffer_out]; in tlm_buffer_out_buf()
226 *idx = bufs->tbs_buffer_out; in tlm_buffer_out_buf()
227 (void) mutex_unlock(&bufs->tbs_mtx); in tlm_buffer_out_buf()
238 tlm_buffer_release_in_buf(tlm_buffers_t *bufs) in tlm_buffer_release_in_buf() argument
240 (void) mutex_lock(&bufs->tbs_mtx); in tlm_buffer_release_in_buf()
241 bufs->tbs_flags |= TLM_BUF_IN_READY; in tlm_buffer_release_in_buf()
242 (void) cond_signal(&bufs->tbs_in_cv); in tlm_buffer_release_in_buf()
243 (void) mutex_unlock(&bufs->tbs_mtx); in tlm_buffer_release_in_buf()
254 tlm_buffer_release_out_buf(tlm_buffers_t *bufs) in tlm_buffer_release_out_buf() argument
256 (void) mutex_lock(&bufs->tbs_mtx); in tlm_buffer_release_out_buf()
257 bufs->tbs_flags |= TLM_BUF_OUT_READY; in tlm_buffer_release_out_buf()
258 (void) cond_signal(&bufs->tbs_out_cv); in tlm_buffer_release_out_buf()
259 (void) mutex_unlock(&bufs->tbs_mtx); in tlm_buffer_release_out_buf()
268 tlm_buffer_in_buf_wait(tlm_buffers_t *bufs) in tlm_buffer_in_buf_wait() argument
271 (void) mutex_lock(&bufs->tbs_mtx); in tlm_buffer_in_buf_wait()
273 while ((bufs->tbs_flags & TLM_BUF_IN_READY) == 0) in tlm_buffer_in_buf_wait()
274 (void) cond_wait(&bufs->tbs_in_cv, &bufs->tbs_mtx); in tlm_buffer_in_buf_wait()
276 bufs->tbs_flags &= ~TLM_BUF_IN_READY; in tlm_buffer_in_buf_wait()
278 (void) mutex_unlock(&bufs->tbs_mtx); in tlm_buffer_in_buf_wait()
306 tlm_buffer_in_buf_timed_wait(tlm_buffers_t *bufs, unsigned int milli_timo) in tlm_buffer_in_buf_timed_wait() argument
313 (void) mutex_lock(&bufs->tbs_mtx); in tlm_buffer_in_buf_timed_wait()
315 (void) cond_reltimedwait(&bufs->tbs_in_cv, &bufs->tbs_mtx, &timo); in tlm_buffer_in_buf_timed_wait()
321 bufs->tbs_flags &= ~TLM_BUF_IN_READY; in tlm_buffer_in_buf_timed_wait()
323 (void) mutex_unlock(&bufs->tbs_mtx); in tlm_buffer_in_buf_timed_wait()
333 tlm_buffer_out_buf_timed_wait(tlm_buffers_t *bufs, unsigned int milli_timo) in tlm_buffer_out_buf_timed_wait() argument
339 (void) mutex_lock(&bufs->tbs_mtx); in tlm_buffer_out_buf_timed_wait()
341 (void) cond_reltimedwait(&bufs->tbs_out_cv, &bufs->tbs_mtx, &timo); in tlm_buffer_out_buf_timed_wait()
347 bufs->tbs_flags &= ~TLM_BUF_OUT_READY; in tlm_buffer_out_buf_timed_wait()
349 (void) mutex_unlock(&bufs->tbs_mtx); in tlm_buffer_out_buf_timed_wait()