Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/xen no need to malloc()+copy watch.node, it's const...
details: https://anonhg.NetBSD.org/src/rev/231034f78167
branches: trunk
changeset: 970931:231034f78167
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Tue Apr 07 09:18:00 2020 +0000
description:
no need to malloc()+copy watch.node, it's constant string - either "device"
or "backend"; just use the strings direct
diffstat:
sys/arch/xen/include/xenbus.h | 4 ++--
sys/arch/xen/xen/xbdback_xenbus.c | 5 ++---
sys/arch/xen/xenbus/xenbus_probe.c | 11 ++++-------
3 files changed, 8 insertions(+), 12 deletions(-)
diffs (85 lines):
diff -r 2ae5289d29db -r 231034f78167 sys/arch/xen/include/xenbus.h
--- a/sys/arch/xen/include/xenbus.h Tue Apr 07 09:05:14 2020 +0000
+++ b/sys/arch/xen/include/xenbus.h Tue Apr 07 09:18:00 2020 +0000
@@ -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 @@
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 *,
diff -r 2ae5289d29db -r 231034f78167 sys/arch/xen/xen/xbdback_xenbus.c
--- a/sys/arch/xen/xen/xbdback_xenbus.c Tue Apr 07 09:05:14 2020 +0000
+++ b/sys/arch/xen/xen/xbdback_xenbus.c Tue Apr 07 09:18:00 2020 +0000
@@ -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 @@
/* 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 */
diff -r 2ae5289d29db -r 231034f78167 sys/arch/xen/xenbus/xenbus_probe.c
--- a/sys/arch/xen/xenbus/xenbus_probe.c Tue Apr 07 09:05:14 2020 +0000
+++ b/sys/arch/xen/xenbus/xenbus_probe.c Tue Apr 07 09:18:00 2020 +0000
@@ -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 @@
{
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_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);
Home |
Main Index |
Thread Index |
Old Index