Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/xen add wrapper to free response from xenbus_dev_re...



details:   https://anonhg.NetBSD.org/src/rev/68ddf8e3dd24
branches:  trunk
changeset: 1008982:68ddf8e3dd24
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Apr 07 16:10:48 2020 +0000

description:
add wrapper to free response from xenbus_dev_request_and_reply(), so
that call in xenbus_dev_write() wouldn't need to know how it's allocated

diffstat:

 sys/arch/xen/include/xenbus.h    |   3 ++-
 sys/arch/xen/xenbus/xenbus_dev.c |   8 ++++----
 sys/arch/xen/xenbus/xenbus_xs.c  |  10 ++++++++--
 3 files changed, 14 insertions(+), 7 deletions(-)

diffs (84 lines):

diff -r 37560bcb84d4 -r 68ddf8e3dd24 sys/arch/xen/include/xenbus.h
--- a/sys/arch/xen/include/xenbus.h     Tue Apr 07 15:59:57 2020 +0000
+++ b/sys/arch/xen/include/xenbus.h     Tue Apr 07 16:10:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.21 2020/04/07 15:59:57 jdolecek Exp $ */
+/* $NetBSD: xenbus.h,v 1.22 2020/04/07 16:10:48 jdolecek Exp $ */
 /******************************************************************************
  * xenbus.h
  *
@@ -153,6 +153,7 @@
 
 /* Used by xenbus_dev to borrow kernel's store connection. */
 int xenbus_dev_request_and_reply(struct xsd_sockmsg *msg, void **);
+void xenbus_dev_reply_free(struct xsd_sockmsg *msg, void *);
 
 void xenbus_probe(void *);
 
diff -r 37560bcb84d4 -r 68ddf8e3dd24 sys/arch/xen/xenbus/xenbus_dev.c
--- a/sys/arch/xen/xenbus/xenbus_dev.c  Tue Apr 07 15:59:57 2020 +0000
+++ b/sys/arch/xen/xenbus/xenbus_dev.c  Tue Apr 07 16:10:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_dev.c,v 1.16 2020/04/07 15:43:42 jdolecek Exp $ */
+/* $NetBSD: xenbus_dev.c,v 1.17 2020/04/07 16:10:48 jdolecek Exp $ */
 /*
  * xenbus_dev.c
  * 
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.16 2020/04/07 15:43:42 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.17 2020/04/07 16:10:48 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -40,7 +40,6 @@
 #include <sys/errno.h>
 #include <sys/param.h>
 #include <sys/proc.h>
-#include <sys/malloc.h>
 #include <sys/systm.h>
 #include <sys/dirent.h>
 #include <sys/stat.h>
@@ -312,7 +311,8 @@
                        queue_reply(xlwp, (char *)&xlwp->u.msg,
                                                sizeof(xlwp->u.msg));
                        queue_reply(xlwp, (char *)reply, xlwp->u.msg.len);
-                       free(reply, M_DEVBUF);
+
+                       xenbus_dev_reply_free(&xlwp->u.msg, reply);
                }
                break;
 
diff -r 37560bcb84d4 -r 68ddf8e3dd24 sys/arch/xen/xenbus/xenbus_xs.c
--- a/sys/arch/xen/xenbus/xenbus_xs.c   Tue Apr 07 15:59:57 2020 +0000
+++ b/sys/arch/xen/xenbus/xenbus_xs.c   Tue Apr 07 16:10:48 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_xs.c,v 1.25 2020/04/07 15:59:57 jdolecek Exp $ */
+/* $NetBSD: xenbus_xs.c,v 1.26 2020/04/07 16:10:48 jdolecek Exp $ */
 /******************************************************************************
  * xenbus_xs.c
  *
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.25 2020/04/07 15:59:57 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.26 2020/04/07 16:10:48 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -175,6 +175,12 @@
        return err;
 }
 
+void
+xenbus_dev_reply_free(struct xsd_sockmsg *msg, void *reply)
+{
+       free(reply, M_DEVBUF);
+}
+
 /* Send message to xs, get kmalloc'ed reply.  ERR_PTR() on error. */
 static int
 xs_talkv(struct xenbus_transaction *t,



Home | Main Index | Thread Index | Old Index