};
struct xenbus_event_queue {
MINIOS_STAILQ_HEAD(, xenbus_event) events;
+ void (*wakeup)(struct xenbus_event_queue*); /* can be safely ignored */
struct wait_queue_head waitq;
};
* ----- asynchronous low-level interface -----
*/
+/*
+ * Use of queue->wakeup:
+ *
+ * If queue->wakeup is set, it will be called instead of
+ * wake_up(&queue->waitq);
+ *
+ * queue->wakeup is initialised (to a function which just calls
+ * wake_up) by xenbus_event_queue_init. The user who wants something
+ * different should set ->wakeup after the init, but before the queue
+ * is used for xenbus_id_allocate or xenbus_watch_prepare.
+ *
+ * queue->wakeup() is called with the req_lock held.
+ */
+
/* Allocate an identifier for a xenbus request. Blocks if none are
* available. Cannot fail. On return, we may use the returned value
* as the id in a xenbus request.
* watches
*/
+static void queue_wakeup(struct xenbus_event_queue *queue)
+{
+ wake_up(&queue->waitq);
+}
+
void xenbus_event_queue_init(struct xenbus_event_queue *queue)
{
MINIOS_STAILQ_INIT(&queue->events);
+ queue->wakeup = queue_wakeup;
init_waitqueue_head(&queue->waitq);
}
{
/* Called with lock held */
MINIOS_STAILQ_INSERT_TAIL(&queue->events, event, entry);
- wake_up(&queue->waitq);
+ queue->wakeup(queue);
}
static struct xenbus_event *await_event(struct xenbus_event_queue *queue)