Lines Matching defs:ivars

80  * \param ivars  The instance variable block to free.
83 xenbusb_free_child_ivars(struct xenbus_device_ivars *ivars)
85 if (ivars->xd_otherend_watch.node != NULL) {
86 xs_unregister_watch(&ivars->xd_otherend_watch);
87 free(ivars->xd_otherend_watch.node, M_XENBUS);
88 ivars->xd_otherend_watch.node = NULL;
91 if (ivars->xd_local_watch.node != NULL) {
92 xs_unregister_watch(&ivars->xd_local_watch);
93 ivars->xd_local_watch.node = NULL;
96 if (ivars->xd_node != NULL) {
97 free(ivars->xd_node, M_XENBUS);
98 ivars->xd_node = NULL;
100 ivars->xd_node_len = 0;
102 if (ivars->xd_type != NULL) {
103 free(ivars->xd_type, M_XENBUS);
104 ivars->xd_type = NULL;
107 if (ivars->xd_otherend_path != NULL) {
108 free(ivars->xd_otherend_path, M_XENBUS);
109 ivars->xd_otherend_path = NULL;
111 ivars->xd_otherend_path_len = 0;
113 free(ivars, M_XENBUS);
134 struct xenbus_device_ivars *ivars;
140 ivars = (struct xenbus_device_ivars *)watch->callback_data;
141 child = ivars->xd_dev;
145 if (ivars->xd_otherend_path == NULL
146 || strncmp(ivars->xd_otherend_path, path, ivars->xd_otherend_path_len))
149 newstate = xenbus_read_driver_state(ivars->xd_otherend_path);
172 struct xenbus_device_ivars *ivars;
177 ivars = (struct xenbus_device_ivars *)watch->callback_data;
178 child = ivars->xd_dev;
182 if (ivars->xd_node == NULL
183 || strncmp(ivars->xd_node, path, ivars->xd_node_len))
186 XENBUSB_LOCALEND_CHANGED(bus, child, &path[ivars->xd_node_len]);
207 struct xenbus_device_ivars *ivars;
215 ivars = device_get_ivars(kids[i]);
216 if (!strcmp(ivars->xd_node, node)) {
229 struct xenbus_device_ivars *ivars;
231 ivars = device_get_ivars(child);
239 if (ivars->xd_otherend_watch.node != NULL)
240 xs_unregister_watch(&ivars->xd_otherend_watch);
241 if (ivars->xd_local_watch.node != NULL)
242 xs_unregister_watch(&ivars->xd_local_watch);
245 xenbusb_free_child_ivars(ivars);
441 struct xenbus_device_ivars *ivars;
510 ivars = device_get_ivars(kids[i]);
511 xs_register_watch(&ivars->xd_otherend_watch);
512 xs_register_watch(&ivars->xd_local_watch);
640 struct xenbus_device_ivars *ivars;
649 ivars = malloc(sizeof(*ivars), M_XENBUS, M_ZERO|M_WAITOK);
679 sx_init(&ivars->xd_lock, "xdlock");
680 ivars->xd_flags = XDF_CONNECTING;
681 ivars->xd_node = strdup(devpath, M_XENBUS);
682 ivars->xd_node_len = strlen(devpath);
683 ivars->xd_type = strdup(type, M_XENBUS);
684 ivars->xd_state = XenbusStateInitialising;
686 error = XENBUSB_GET_OTHEREND_NODE(dev, ivars);
693 statepath = malloc(ivars->xd_otherend_path_len
695 sprintf(statepath, "%s/state", ivars->xd_otherend_path);
696 ivars->xd_otherend_watch.node = statepath;
697 ivars->xd_otherend_watch.callback = xenbusb_otherend_watch_cb;
698 ivars->xd_otherend_watch.callback_data = (uintptr_t)ivars;
704 ivars->xd_otherend_watch.max_pending = 1;
706 ivars->xd_local_watch.node = ivars->xd_node;
707 ivars->xd_local_watch.callback = xenbusb_local_watch_cb;
708 ivars->xd_local_watch.callback_data = (uintptr_t)ivars;
713 ivars->xd_local_watch.max_pending = 0;
720 ivars->xd_dev = child;
721 device_set_ivars(child, ivars);
727 xenbusb_free_child_ivars(ivars);
792 struct xenbus_device_ivars *ivars;
810 ivars = device_get_ivars(kids[i]);
812 xs_unregister_watch(&ivars->xd_otherend_watch);
819 error = XENBUSB_GET_OTHEREND_NODE(dev, ivars);
823 statepath = malloc(ivars->xd_otherend_path_len
825 sprintf(statepath, "%s/state", ivars->xd_otherend_path);
827 free(ivars->xd_otherend_watch.node, M_XENBUS);
828 ivars->xd_otherend_watch.node = statepath;
832 xs_register_watch(&ivars->xd_otherend_watch);
840 sx_xlock(&ivars->xd_lock);
841 while (ivars->xd_state != XenbusStateClosed
842 && ivars->xd_state != XenbusStateConnected)
843 sx_sleep(&ivars->xd_state, &ivars->xd_lock,
845 sx_xunlock(&ivars->xd_lock);
857 struct xenbus_device_ivars *ivars = device_get_ivars(child);
861 retval += printf(" at %s", ivars->xd_node);
870 struct xenbus_device_ivars *ivars = device_get_ivars(child);
874 *result = (uintptr_t) ivars->xd_node;
878 *result = (uintptr_t) ivars->xd_type;
882 *result = (uintptr_t) ivars->xd_state;
886 *result = (uintptr_t) ivars->xd_otherend_id;
890 *result = (uintptr_t) ivars->xd_otherend_path;
900 struct xenbus_device_ivars *ivars = device_get_ivars(child);
911 sx_xlock(&ivars->xd_lock);
912 if (ivars->xd_state == newstate) {
923 error = xs_scanf(xst, ivars->xd_node, "state",
930 error = xs_printf(xst, ivars->xd_node, "state",
945 ivars->xd_state = newstate;
947 if ((ivars->xd_flags & XDF_CONNECTING) != 0 &&
952 ivars->xd_flags &= ~XDF_CONNECTING;
957 wakeup(&ivars->xd_state);
961 sx_xunlock(&ivars->xd_lock);
997 struct xenbus_device_ivars *ivars;
999 ivars = device_get_ivars(child);
1000 sx_xlock(&ivars->xd_lock);
1001 ivars->xd_state = xenbus_read_driver_state(ivars->xd_node);
1002 sx_xunlock(&ivars->xd_lock);