diff options
author | Juergen Gross <jgross@suse.com> | 2017-02-09 14:39:57 +0100 |
---|---|---|
committer | Boris Ostrovsky <boris.ostrovsky@oracle.com> | 2017-02-09 11:26:49 -0500 |
commit | 5584ea250ae44f929feb4c7bd3877d1c5edbf813 (patch) | |
tree | d84dca574c46ec785098d13211d92ef74e3a74f2 /drivers/xen/xenbus/xenbus_xs.c | |
parent | 332f791dc98d98116f4473b726f67c9321b0f31e (diff) | |
download | linux-5584ea250ae44f929feb4c7bd3877d1c5edbf813.tar.gz linux-5584ea250ae44f929feb4c7bd3877d1c5edbf813.tar.xz |
xen: modify xenstore watch event interface
Today a Xenstore watch event is delivered via a callback function
declared as:
void (*callback)(struct xenbus_watch *,
const char **vec, unsigned int len);
As all watch events only ever come with two parameters (path and token)
changing the prototype to:
void (*callback)(struct xenbus_watch *,
const char *path, const char *token);
is the natural thing to do.
Apply this change and adapt all users.
Cc: konrad.wilk@oracle.com
Cc: roger.pau@citrix.com
Cc: wei.liu2@citrix.com
Cc: paul.durrant@citrix.com
Cc: netdev@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Diffstat (limited to 'drivers/xen/xenbus/xenbus_xs.c')
-rw-r--r-- | drivers/xen/xenbus/xenbus_xs.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c index 4c49d8709765..ebc768f44abe 100644 --- a/drivers/xen/xenbus/xenbus_xs.c +++ b/drivers/xen/xenbus/xenbus_xs.c @@ -64,8 +64,8 @@ struct xs_stored_msg { /* Queued watch events. */ struct { struct xenbus_watch *handle; - char **vec; - unsigned int vec_size; + const char *path; + const char *token; } watch; } u; }; @@ -765,7 +765,7 @@ void unregister_xenbus_watch(struct xenbus_watch *watch) if (msg->u.watch.handle != watch) continue; list_del(&msg->list); - kfree(msg->u.watch.vec); + kfree(msg->u.watch.path); kfree(msg); } spin_unlock(&watch_events_lock); @@ -833,11 +833,10 @@ static int xenwatch_thread(void *unused) if (ent != &watch_events) { msg = list_entry(ent, struct xs_stored_msg, list); - msg->u.watch.handle->callback( - msg->u.watch.handle, - (const char **)msg->u.watch.vec, - msg->u.watch.vec_size); - kfree(msg->u.watch.vec); + msg->u.watch.handle->callback(msg->u.watch.handle, + msg->u.watch.path, + msg->u.watch.token); + kfree(msg->u.watch.path); kfree(msg); } @@ -903,24 +902,24 @@ static int process_msg(void) body[msg->hdr.len] = '\0'; if (msg->hdr.type == XS_WATCH_EVENT) { - msg->u.watch.vec = split(body, msg->hdr.len, - &msg->u.watch.vec_size); - if (IS_ERR(msg->u.watch.vec)) { - err = PTR_ERR(msg->u.watch.vec); + if (count_strings(body, msg->hdr.len) != 2) { + err = -EINVAL; kfree(msg); + kfree(body); goto out; } + msg->u.watch.path = (const char *)body; + msg->u.watch.token = (const char *)strchr(body, '\0') + 1; spin_lock(&watches_lock); - msg->u.watch.handle = find_watch( - msg->u.watch.vec[XS_WATCH_TOKEN]); + msg->u.watch.handle = find_watch(msg->u.watch.token); if (msg->u.watch.handle != NULL) { spin_lock(&watch_events_lock); list_add_tail(&msg->list, &watch_events); wake_up(&watch_events_waitq); spin_unlock(&watch_events_lock); } else { - kfree(msg->u.watch.vec); + kfree(body); kfree(msg); } spin_unlock(&watches_lock); |