Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpvfs Name kmem_free(rn, sizeof(*rn)) as ...



details:   https://anonhg.NetBSD.org/src/rev/2f862c285fcd
branches:  trunk
changeset: 335454:2f862c285fcd
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jan 07 04:05:26 2015 +0000

description:
Name kmem_free(rn, sizeof(*rn)) as freeprivate to match makeprivate.

Per pooka's request from a year or so ago when I passed this patch by
him a year or so ago, if I recall correctly.

diffstat:

 sys/rump/librump/rumpvfs/rumpfs.c |  33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diffs (126 lines):

diff -r 06dcc5fb7ac8 -r 2f862c285fcd sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Wed Jan 07 03:49:13 2015 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Wed Jan 07 04:05:26 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpfs.c,v 1.133 2015/01/07 03:45:18 riastradh Exp $   */
+/*     $NetBSD: rumpfs.c,v 1.134 2015/01/07 04:05:26 riastradh Exp $   */
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.133 2015/01/07 03:45:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.134 2015/01/07 04:05:26 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -221,6 +221,7 @@
 #define RUMPFS_DEFAULTMODE 0755
 static void freedir(struct rumpfs_node *, struct componentname *);
 static struct rumpfs_node *makeprivate(enum vtype, mode_t, dev_t, off_t, bool);
+static void freeprivate(struct rumpfs_node *);
 
 /*
  * Extra Terrestrial stuff.  We map a given key (pathname) to a file on
@@ -406,7 +407,7 @@
                        rumpblk_deregister(hostpath);
                if (et->et_rn->rn_hostpath != NULL)
                        free(et->et_rn->rn_hostpath, M_TEMP);
-               kmem_free(et->et_rn, sizeof(*et->et_rn));
+               freeprivate(et->et_rn);
                kmem_free(et, sizeof(*et));
                return EEXIST;
        }
@@ -492,7 +493,7 @@
 
        if (et->et_rn->rn_hostpath != NULL)
                free(et->et_rn->rn_hostpath, M_TEMP);
-       kmem_free(et->et_rn, sizeof(*et->et_rn));
+       freeprivate(et->et_rn);
        kmem_free(et, sizeof(*et));
 
        return 0;
@@ -556,6 +557,13 @@
 }
 
 static void
+freeprivate(struct rumpfs_node *rn)
+{
+
+       kmem_free(rn, sizeof(*rn));
+}
+
+static void
 makedir(struct rumpfs_node *rnd,
        struct componentname *cnp, struct rumpfs_node *rn)
 {
@@ -751,10 +759,11 @@
        rv = vcache_get(dvp->v_mount, &rn, sizeof(rn), vpp);
        if (rv) {
                if (rnd->rn_flags & RUMPNODE_DIR_ET)
-                       kmem_free(rn, sizeof(*rn));
+                       freeprivate(rn);
+               return rv;
        }
 
-       return rv;
+       return 0;
 }
 
 static int
@@ -953,7 +962,7 @@
        rn->rn_parent = rnd;
        rv = vcache_get(dvp->v_mount, &rn, sizeof(rn), vpp);
        if (rv) {
-               kmem_free(rn, sizeof(*rn));
+               freeprivate(rn);
                return rv;
        }
 
@@ -1051,7 +1060,7 @@
                rn->rn_va.va_flags |= UF_OPAQUE;
        rv = vcache_get(dvp->v_mount, &rn, sizeof(rn), vpp);
        if (rv) {
-               kmem_free(rn, sizeof(*rn));
+               freeprivate(rn);
                return rv;
        }
 
@@ -1084,7 +1093,7 @@
                rn->rn_va.va_flags |= UF_OPAQUE;
        rv = vcache_get(dvp->v_mount, &rn, sizeof(rn), vpp);
        if (rv) {
-               kmem_free(rn, sizeof(*rn));
+               freeprivate(rn);
                return rv;
        }
 
@@ -1119,7 +1128,7 @@
                rn->rn_va.va_flags |= UF_OPAQUE;
        rv = vcache_get(dvp->v_mount, &rn, sizeof(rn), vpp);
        if (rv) {
-               kmem_free(rn, sizeof(*rn));
+               freeprivate(rn);
                return rv;
        }
 
@@ -1619,7 +1628,7 @@
                        PNBUF_PUT(rn->rn_linktarg);
                if (rn->rn_hostpath)
                        free(rn->rn_hostpath, M_TEMP);
-               kmem_free(rn, sizeof(*rn));
+               freeprivate(rn);
        }
 
        return 0;
@@ -1712,7 +1721,7 @@
        rn->rn_parent = rn;
        if ((error = vcache_get(mp, &rn, sizeof(rn), &rfsmp->rfsmp_rvp))
            != 0) {
-               kmem_free(rn, sizeof(*rn));
+               freeprivate(rn);
                kmem_free(rfsmp, sizeof(*rfsmp));
                return error;
        }



Home | Main Index | Thread Index | Old Index