Lines Matching refs:ct

120 	struct ct_data *ct = NULL;	/* client handle */
130 ct = (struct ct_data *)mem_alloc(sizeof (*ct));
132 mtx_init(&ct->ct_lock, "ct->ct_lock", NULL, MTX_DEF);
133 ct->ct_threads = 0;
134 ct->ct_closing = FALSE;
135 ct->ct_closed = FALSE;
136 ct->ct_upcallrefs = 0;
137 ct->ct_closeit = FALSE;
142 ct->ct_wait.tv_sec = -1;
143 ct->ct_wait.tv_usec = -1;
149 ct->ct_xid = ((uint32_t)++disrupt) ^ __RPC_GETXID(&now);
150 call_msg.rm_xid = ct->ct_xid;
159 xdrmem_create(&xdrs, ct->ct_mcallc, MCALL_MSG_SIZE,
163 ct->ct_mpos = XDR_GETPOS(&xdrs);
165 ct->ct_waitchan = "rpcbck";
166 ct->ct_waitflag = 0;
169 cl->cl_private = ct;
171 TAILQ_INIT(&ct->ct_pending);
175 mtx_destroy(&ct->ct_lock);
176 mem_free(ct, sizeof (struct ct_data));
191 struct ct_data *ct = (struct ct_data *) cl->cl_private;
210 mtx_lock(&ct->ct_lock);
212 if (ct->ct_closing || ct->ct_closed) {
213 mtx_unlock(&ct->ct_lock);
217 ct->ct_threads++;
224 errp = &ct->ct_error;
230 if (ct->ct_wait.tv_usec == -1)
233 timeout = ct->ct_wait; /* use default timeout */
236 mtx_assert(&ct->ct_lock, MA_OWNED);
238 ct->ct_xid++;
239 xid = ct->ct_xid;
241 mtx_unlock(&ct->ct_lock);
248 KASSERT(ct->ct_mpos + sizeof(uint32_t) <= MHLEN,
250 bcopy(ct->ct_mcallc, mreq->m_data, ct->ct_mpos);
251 mreq->m_len = ct->ct_mpos;
266 mtx_lock(&ct->ct_lock);
279 mtx_lock(&ct->ct_lock);
288 if (ct->ct_error.re_status == RPC_CANTRECV) {
289 if (errp != &ct->ct_error) {
290 errp->re_errno = ct->ct_error.re_errno;
296 TAILQ_INSERT_TAIL(&ct->ct_pending, cr, cr_link);
297 mtx_unlock(&ct->ct_lock);
326 mtx_lock(&ct->ct_lock);
327 TAILQ_REMOVE(&ct->ct_pending, cr, cr_link);
338 mtx_lock(&ct->ct_lock);
340 TAILQ_REMOVE(&ct->ct_pending, cr, cr_link);
349 * from ct->ct_pending.
352 TAILQ_REMOVE(&ct->ct_pending, cr, cr_link);
358 TAILQ_REMOVE(&ct->ct_pending, cr, cr_link);
366 TAILQ_REMOVE(&ct->ct_pending, cr, cr_link);
371 error = msleep(cr, &ct->ct_lock, ct->ct_waitflag, ct->ct_waitchan,
374 TAILQ_REMOVE(&ct->ct_pending, cr, cr_link);
413 mtx_unlock(&ct->ct_lock);
450 mtx_lock(&ct->ct_lock);
458 mtx_lock(&ct->ct_lock);
460 mtx_assert(&ct->ct_lock, MA_OWNED);
470 ct->ct_threads--;
471 if (ct->ct_closing)
472 wakeup(ct);
474 mtx_unlock(&ct->ct_lock);
487 struct ct_data *ct = (struct ct_data *) cl->cl_private;
489 *errp = ct->ct_error;
520 struct ct_data *ct = (struct ct_data *) cl->cl_private;
522 mtx_lock(&ct->ct_lock);
524 if (ct->ct_closed) {
525 mtx_unlock(&ct->ct_lock);
529 if (ct->ct_closing) {
530 while (ct->ct_closing)
531 msleep(ct, &ct->ct_lock, 0, "rpcclose", 0);
532 KASSERT(ct->ct_closed, ("client should be closed"));
533 mtx_unlock(&ct->ct_lock);
537 ct->ct_closing = FALSE;
538 ct->ct_closed = TRUE;
539 mtx_unlock(&ct->ct_lock);
540 wakeup(ct);
546 struct ct_data *ct = (struct ct_data *) cl->cl_private;
550 mtx_destroy(&ct->ct_lock);
551 mem_free(ct, sizeof(struct ct_data));
570 struct ct_data *ct;
574 ct = (struct ct_data *)cl->cl_private;
575 mtx_lock(&ct->ct_lock);
576 if (ct->ct_closing || ct->ct_closed) {
577 mtx_unlock(&ct->ct_lock);
582 ct->ct_upcallrefs++;
587 TAILQ_FOREACH(cr, &ct->ct_pending, cr_link) {
603 ct->ct_upcallrefs--;
604 if (ct->ct_upcallrefs < 0)
606 if (ct->ct_upcallrefs == 0)
607 wakeup(&ct->ct_upcallrefs);
608 mtx_unlock(&ct->ct_lock);