Lines Matching defs:bufs

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