Lines Matching full:watch
131 /* Queued watch events. */
136 } watch; member
192 * List of pending watch callback events.
196 /** Lock protecting the watch calback list. */
206 * watch event callbacks.
211 * callbacks of the just unregistered watch are pending
648 msg->u.watch.vec = split(body, msg->hdr.len, in xs_process_msg()
649 &msg->u.watch.vec_size); in xs_process_msg()
652 msg->u.watch.handle = find_watch( in xs_process_msg()
653 msg->u.watch.vec[XS_WATCH_TOKEN]); in xs_process_msg()
655 if (msg->u.watch.handle != NULL && in xs_process_msg()
656 (!msg->u.watch.handle->max_pending || in xs_process_msg()
657 msg->u.watch.handle->pending < in xs_process_msg()
658 msg->u.watch.handle->max_pending)) { in xs_process_msg()
659 msg->u.watch.handle->pending++; in xs_process_msg()
665 free(msg->u.watch.vec, M_XENSTORE); in xs_process_msg()
895 /*------------------------- XenStore Watch Support ---------------------------*/
897 * Transmit a watch request to the XenStore service.
899 * \param path The path in the XenStore to watch.
900 * \param tocken A unique identifier for this watch.
921 * \param path The path in the XenStore to watch.
922 * \param tocken A unique identifier for this watch.
941 * Convert from watch token (unique identifier) to the associated
942 * internal tracking structure for this watch.
944 * \param tocken The unique identifier for the watch to find.
946 * \return A pointer to the found watch structure or NULL.
963 * Thread body of the XenStore watch event dispatch thread.
984 msg->u.watch.handle->pending--; in xenwatch_thread()
995 if (msg->u.watch.handle->callback != NULL) in xenwatch_thread()
996 msg->u.watch.handle->callback( in xenwatch_thread()
997 msg->u.watch.handle, in xenwatch_thread()
998 (const char **)msg->u.watch.vec, in xenwatch_thread()
999 msg->u.watch.vec_size); in xenwatch_thread()
1000 free(msg->u.watch.vec, M_XENSTORE); in xenwatch_thread()
1138 mtx_init(&xs.watch_events_lock, "watch events", NULL, MTX_DEF); in xs_attach()
1190 struct xs_watch *watch; in xs_resume() local
1191 char token[sizeof(watch) * 2 + 1]; in xs_resume()
1199 * no need to hold any watch mutex. Having clients try to add or in xs_resume()
1203 LIST_FOREACH(watch, &xs.registered_watches, list) { in xs_resume()
1204 sprintf(token, "%lX", (long)watch); in xs_resume()
1205 xs_watch(watch->node, token); in xs_resume()
1573 xs_register_watch(struct xs_watch *watch) in xs_register_watch() argument
1576 char token[sizeof(watch) * 2 + 1]; in xs_register_watch()
1579 watch->pending = 0; in xs_register_watch()
1580 sprintf(token, "%lX", (long)watch); in xs_register_watch()
1583 KASSERT(find_watch(token) == NULL, ("watch already registered")); in xs_register_watch()
1584 LIST_INSERT_HEAD(&xs.registered_watches, watch, list); in xs_register_watch()
1587 error = xs_watch(watch->node, token); in xs_register_watch()
1595 LIST_REMOVE(watch, list); in xs_register_watch()
1603 xs_unregister_watch(struct xs_watch *watch) in xs_unregister_watch() argument
1606 char token[sizeof(watch) * 2 + 1]; in xs_unregister_watch()
1609 sprintf(token, "%lX", (long)watch); in xs_unregister_watch()
1616 LIST_REMOVE(watch, list); in xs_unregister_watch()
1619 error = xs_unwatch(watch->node, token); in xs_unregister_watch()
1621 log(LOG_WARNING, "XENSTORE Failed to release watch %s: %i\n", in xs_unregister_watch()
1622 watch->node, error); in xs_unregister_watch()
1624 /* Cancel pending watch events. */ in xs_unregister_watch()
1627 if (msg->u.watch.handle != watch) in xs_unregister_watch()
1630 free(msg->u.watch.vec, M_XENSTORE); in xs_unregister_watch()