[PATCH 4/6] xenbus: process otherend_watch event at 'state' entry in xenwatch multithreading

From: Dongli Zhang
Date: Fri Sep 14 2018 - 03:34:07 EST


This is the 4th patch of a (6-patch) patch set.

With this patch, watch event in absolute path pattern
'/local/domain/<domid>/device/<pvdev>/<handle>/state' can be processed in
per-domU xenwatch thread.

Signed-off-by: Dongli Zhang <dongli.zhang@xxxxxxxxxx>
---
drivers/xen/xenbus/xenbus_probe.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 5755596..ba0644c 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -129,11 +129,27 @@ static int talk_to_otherend(struct xenbus_device *dev)
}


+static domid_t otherend_get_domid(struct xenbus_watch *watch,
+ const char *path,
+ const char *token)
+{
+ struct xenbus_device *xendev =
+ container_of(watch, struct xenbus_device, otherend_watch);
+
+ return xendev->otherend_id;
+}
+

static int watch_otherend(struct xenbus_device *dev)
{
struct xen_bus_type *bus =
container_of(dev->dev.bus, struct xen_bus_type, bus);
+ struct xenbus_driver *drv = to_xenbus_driver(dev->dev.driver);
+
+ if (xen_mtwatch && drv->use_mtwatch) {
+ dev->otherend_watch.get_domid = otherend_get_domid;
+ dev->otherend_watch.owner_id = dev->otherend_id;
+ }

return xenbus_watch_pathfmt(dev, &dev->otherend_watch,
bus->otherend_changed,
--
2.7.4