Lines Matching full:watch
132 /* Queued watch events. */
137 } watch;
193 * List of pending watch callback events.
197 /** Lock protecting the watch calback list. */
207 * watch event callbacks.
212 * callbacks of the just unregistered watch are pending
649 msg->u.watch.vec = split(body, msg->hdr.len,
650 &msg->u.watch.vec_size);
653 msg->u.watch.handle = find_watch(
654 msg->u.watch.vec[XS_WATCH_TOKEN]);
656 if (msg->u.watch.handle != NULL &&
657 (!msg->u.watch.handle->max_pending ||
658 msg->u.watch.handle->pending <
659 msg->u.watch.handle->max_pending)) {
660 msg->u.watch.handle->pending++;
666 free(msg->u.watch.vec, M_XENSTORE);
896 /*------------------------- XenStore Watch Support ---------------------------*/
898 * Transmit a watch request to the XenStore service.
900 * \param path The path in the XenStore to watch.
901 * \param tocken A unique identifier for this watch.
922 * \param path The path in the XenStore to watch.
923 * \param tocken A unique identifier for this watch.
942 * Convert from watch token (unique identifier) to the associated
943 * internal tracking structure for this watch.
945 * \param tocken The unique identifier for the watch to find.
947 * \return A pointer to the found watch structure or NULL.
964 * Thread body of the XenStore watch event dispatch thread.
985 msg->u.watch.handle->pending--;
996 if (msg->u.watch.handle->callback != NULL)
997 msg->u.watch.handle->callback(
998 msg->u.watch.handle,
999 (const char **)msg->u.watch.vec,
1000 msg->u.watch.vec_size);
1001 free(msg->u.watch.vec, M_XENSTORE);
1139 mtx_init(&xs.watch_events_lock, "watch events", NULL, MTX_DEF);
1191 struct xs_watch *watch;
1192 char token[sizeof(watch) * 2 + 1];
1200 * no need to hold any watch mutex. Having clients try to add or
1204 LIST_FOREACH(watch, &xs.registered_watches, list) {
1205 sprintf(token, "%lX", (long)watch);
1206 xs_watch(watch->node, token);
1574 xs_register_watch(struct xs_watch *watch)
1577 char token[sizeof(watch) * 2 + 1];
1580 watch->pending = 0;
1581 sprintf(token, "%lX", (long)watch);
1584 KASSERT(find_watch(token) == NULL, ("watch already registered"));
1585 LIST_INSERT_HEAD(&xs.registered_watches, watch, list);
1588 error = xs_watch(watch->node, token);
1596 LIST_REMOVE(watch, list);
1604 xs_unregister_watch(struct xs_watch *watch)
1607 char token[sizeof(watch) * 2 + 1];
1610 sprintf(token, "%lX", (long)watch);
1617 LIST_REMOVE(watch, list);
1620 error = xs_unwatch(watch->node, token);
1622 log(LOG_WARNING, "XENSTORE Failed to release watch %s: %i\n",
1623 watch->node, error);
1625 /* Cancel pending watch events. */
1628 if (msg->u.watch.handle != watch)
1631 free(msg->u.watch.vec, M_XENSTORE);