revert the watch.node change, xenbus_watch_path() and xenbus_watch_path2()

need to use non-constant path
This commit is contained in:
jdolecek 2020-04-07 13:36:22 +00:00
parent 22ba269296
commit 08090ccf7a
3 changed files with 12 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: xenbus.h,v 1.16 2020/04/07 11:47:05 jdolecek Exp $ */
/* $NetBSD: xenbus.h,v 1.17 2020/04/07 13:36:22 jdolecek Exp $ */
/******************************************************************************
* xenbus.h
*
@ -57,7 +57,7 @@ struct xenbus_watch {
SLIST_ENTRY(xenbus_watch) watch_next;
/* Path being watched. */
const char *node;
char *node;
/* Callback (executed in a process context with no locks held). */
void (*xbw_callback)(struct xenbus_watch *,

View File

@ -1,4 +1,4 @@
/* $NetBSD: xbdback_xenbus.c,v 1.75 2020/04/07 11:47:06 jdolecek Exp $ */
/* $NetBSD: xbdback_xenbus.c,v 1.76 2020/04/07 13:36:22 jdolecek Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.75 2020/04/07 11:47:06 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.76 2020/04/07 13:36:22 jdolecek Exp $");
#include <sys/atomic.h>
#include <sys/buf.h>
@ -489,6 +489,7 @@ xbdback_xenbus_destroy(void *arg)
/* unregister watch */
if (xbdi->xbdi_watch.node) {
unregister_xenbus_watch(&xbdi->xbdi_watch);
free(xbdi->xbdi_watch.node, M_DEVBUF);
xbdi->xbdi_watch.node = NULL;
}
/* unmap ring */

View File

@ -1,4 +1,4 @@
/* $NetBSD: xenbus_probe.c,v 1.42 2020/04/07 11:47:06 jdolecek Exp $ */
/* $NetBSD: xenbus_probe.c,v 1.43 2020/04/07 13:36:22 jdolecek Exp $ */
/******************************************************************************
* Talks to Xen Store to figure out what devices we have.
*
@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.42 2020/04/07 11:47:06 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.43 2020/04/07 13:36:22 jdolecek Exp $");
#if 0
#define DPRINTK(fmt, args...) \
@ -234,6 +234,7 @@ free_otherend_watch(struct xenbus_device *dev)
{
if (dev->xbusd_otherend_watch.node) {
unregister_xenbus_watch(&dev->xbusd_otherend_watch);
free(dev->xbusd_otherend_watch.node, M_DEVBUF);
dev->xbusd_otherend_watch.node = NULL;
}
}
@ -614,10 +615,12 @@ xenbus_probe(void *unused)
xenbus_probe_backends();
/* Watch for changes. */
fe_watch.node = "device";
fe_watch.node = malloc(strlen("device") + 1, M_DEVBUF, M_NOWAIT);
strcpy(fe_watch.node, "device");
fe_watch.xbw_callback = frontend_changed;
register_xenbus_watch(&fe_watch);
be_watch.node = "backend";
be_watch.node = malloc(strlen("backend") + 1, M_DEVBUF, M_NOWAIT);
strcpy(be_watch.node, "backend");
be_watch.xbw_callback = backend_changed;
register_xenbus_watch(&be_watch);