Module Name: src
Committed By: jdolecek
Date: Tue Apr 7 09:18:00 UTC 2020
Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: xbdback_xenbus.c
src/sys/arch/xen/xenbus: xenbus_probe.c
Log Message:
no need to malloc()+copy watch.node, it's constant string - either "device"
or "backend"; just use the strings direct
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/xen/xenbus/xenbus_probe.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/xen/include/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.14 src/sys/arch/xen/include/xenbus.h:1.15
--- src/sys/arch/xen/include/xenbus.h:1.14 Sat Feb 2 12:32:55 2019
+++ src/sys/arch/xen/include/xenbus.h Tue Apr 7 09:18:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.14 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: xenbus.h,v 1.15 2020/04/07 09:18:00 jdolecek Exp $ */
/******************************************************************************
* xenbus.h
*
@@ -57,7 +57,7 @@ struct xenbus_watch {
SLIST_ENTRY(xenbus_watch) watch_next;
/* Path being watched. */
- char *node;
+ const char *node;
/* Callback (executed in a process context with no locks held). */
void (*xbw_callback)(struct xenbus_watch *,
Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.73 src/sys/arch/xen/xen/xbdback_xenbus.c:1.74
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.73 Fri Jan 17 19:30:51 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c Tue Apr 7 09:18:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xbdback_xenbus.c,v 1.73 2020/01/17 19:30:51 ad Exp $ */
+/* $NetBSD: xbdback_xenbus.c,v 1.74 2020/04/07 09:18:00 jdolecek Exp $ */
/*
* Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.73 2020/01/17 19:30:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.74 2020/04/07 09:18:00 jdolecek Exp $");
#include <sys/atomic.h>
#include <sys/buf.h>
@@ -490,7 +490,6 @@ 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 */
Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.40 src/sys/arch/xen/xenbus/xenbus_probe.c:1.41
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.40 Tue Feb 26 15:55:33 2019
+++ src/sys/arch/xen/xenbus/xenbus_probe.c Tue Apr 7 09:18:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.40 2019/02/26 15:55:33 joerg Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.41 2020/04/07 09:18:00 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.40 2019/02/26 15:55:33 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.41 2020/04/07 09:18:00 jdolecek Exp $");
#if 0
#define DPRINTK(fmt, args...) \
@@ -242,7 +242,6 @@ free_otherend_watch(struct xenbus_device
{
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;
}
}
@@ -623,12 +622,10 @@ xenbus_probe(void *unused)
xenbus_probe_backends();
/* Watch for changes. */
- fe_watch.node = malloc(strlen("device") + 1, M_DEVBUF, M_NOWAIT);
- strcpy(fe_watch.node, "device");
+ fe_watch.node = "device";
fe_watch.xbw_callback = frontend_changed;
register_xenbus_watch(&fe_watch);
- be_watch.node = malloc(strlen("backend") + 1, M_DEVBUF, M_NOWAIT);
- strcpy(be_watch.node, "backend");
+ be_watch.node = "backend";
be_watch.xbw_callback = backend_changed;
register_xenbus_watch(&be_watch);