Lines Matching refs:xbs
338 xenbus_dev_t *xbs;
372 xbs = XENBUSDRV_INST2SOFTS(XENBUSDRV_MINOR2INST(minor));
375 xbs->dip = xenbusdrv_dip;
376 mutex_init(&xbs->read_mutex, NULL, MUTEX_DRIVER, NULL);
377 cv_init(&xbs->read_cv, NULL, CV_DEFAULT, NULL);
378 list_create(&xbs->transactions, sizeof (struct xenbus_dev_transaction),
393 xenbus_dev_t *xbs;
397 xbs = XENBUSDRV_INST2SOFTS(XENBUSDRV_MINOR2INST(minor));
398 if (xbs == NULL)
408 if (xbs->xenstore_inst)
413 list_head(&xbs->transactions)) {
415 list_remove(&xbs->transactions, (void *)trans);
419 mutex_destroy(&xbs->read_mutex);
420 cv_destroy(&xbs->read_cv);
440 xenbus_dev_t *xbs;
450 xbs = XENBUSDRV_INST2SOFTS(XENBUSDRV_MINOR2INST(getminor(dev)));
452 mutex_enter(&xbs->read_mutex);
455 while (xbs->read_prod == xbs->read_cons) {
456 if (cv_wait_sig(&xbs->read_cv, &xbs->read_mutex) == 0) {
457 mutex_exit(&xbs->read_mutex);
462 idx = XENBUSDRV_MASK_READ_IDX(xbs->read_cons);
465 len = xbs->read_prod - xbs->read_cons;
467 if (len > (sizeof (xbs->read_buffer) - idx))
468 len = sizeof (xbs->read_buffer) - idx;
472 ret = uiomove(xbs->read_buffer + idx, len, UIO_READ, uiop);
473 xbs->read_cons += res - uiop->uio_resid;
474 mutex_exit(&xbs->read_mutex);
483 xenbusdrv_queue_reply(xenbus_dev_t *xbs, const struct xsd_sockmsg *msg,
491 mutex_enter(&xbs->read_mutex);
493 remaining = sizeof (xbs->read_buffer) -
494 (xbs->read_prod - xbs->read_cons);
497 mutex_exit(&xbs->read_mutex);
501 for (i = 0; i < sizeof (*msg); i++, xbs->read_prod++) {
502 xbs->read_buffer[XENBUSDRV_MASK_READ_IDX(xbs->read_prod)] =
506 for (i = 0; i < msg->len; i++, xbs->read_prod++) {
507 xbs->read_buffer[XENBUSDRV_MASK_READ_IDX(xbs->read_prod)] =
511 cv_broadcast(&xbs->read_cv);
513 mutex_exit(&xbs->read_mutex);
524 xenbus_dev_t *xbs;
535 xbs = XENBUSDRV_INST2SOFTS(XENBUSDRV_MINOR2INST(getminor(dev)));
538 if ((len + xbs->len) > sizeof (xbs->u.buffer)) {
544 if (uiomove(xbs->u.buffer + xbs->len, len, UIO_WRITE, uiop) != 0) {
550 xbs->len += len;
552 if (xbs->len < (sizeof (xbs->u.msg)) ||
553 xbs->len < (sizeof (xbs->u.msg) + xbs->u.msg.len)) {
558 switch (xbs->u.msg.type) {
571 rc = xenbus_dev_request_and_reply(&xbs->u.msg, &reply);
579 if (xbs->u.msg.type == XS_TRANSACTION_START) {
583 list_insert_tail(&xbs->transactions, (void *)trans);
584 } else if (xbs->u.msg.type == XS_TRANSACTION_END) {
587 list_head(&xbs->transactions); trans;
589 list_next(&xbs->transactions, (void *)trans))
592 xbs->u.msg.tx_id)
596 list_remove(&xbs->transactions, (void *)trans);
601 rc = xenbusdrv_queue_reply(xbs, &xbs->u.msg, reply);
603 kmem_free(reply, xbs->u.msg.len + 1);
610 xbs->len = 0;
619 xenbus_dev_t *xbs;
622 xbs = XENBUSDRV_INST2SOFTS(XENBUSDRV_MINOR2INST(getminor(dev)));
630 err = devmap_umem_setup(dhp, xbs->dip, NULL, xb_xenstore_cookie(),
658 xenbus_dev_t *xbs;
663 xbs = XENBUSDRV_INST2SOFTS(XENBUSDRV_MINOR2INST(getminor(dev)));
670 xbs->xenstore_inst = 1;