Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/tmpfs - don't keep a reference to a variable on stack.



details:   https://anonhg.NetBSD.org/src/rev/d36eed3907a5
branches:  trunk
changeset: 584300:d36eed3907a5
user:      yamt <yamt%NetBSD.org@localhost>
date:      Mon Sep 12 19:56:58 2005 +0000

description:
- don't keep a reference to a variable on stack.
- remove a meaningless assumption about the order of structure members.

diffstat:

 sys/fs/tmpfs/tmpfs_pool.c |  12 ++++++------
 sys/fs/tmpfs/tmpfs_pool.h |   3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r a1ce517bc346 -r d36eed3907a5 sys/fs/tmpfs/tmpfs_pool.c
--- a/sys/fs/tmpfs/tmpfs_pool.c Mon Sep 12 19:55:22 2005 +0000
+++ b/sys/fs/tmpfs/tmpfs_pool.c Mon Sep 12 19:56:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_pool.c,v 1.1 2005/09/10 19:20:51 jmmv Exp $      */
+/*     $NetBSD: tmpfs_pool.c,v 1.2 2005/09/12 19:56:58 yamt Exp $      */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_pool.c,v 1.1 2005/09/10 19:20:51 jmmv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_pool.c,v 1.2 2005/09/12 19:56:58 yamt Exp $");
 
 #include <sys/param.h>
 #include <sys/pool.h>
@@ -74,13 +74,13 @@
 tmpfs_pool_init(struct tmpfs_pool *tpp, size_t size, const char *what,
     struct tmpfs_mount *tmp)
 {
-       char wchan[64];
        int cnt;
 
-       cnt = snprintf(wchan, sizeof(wchan), "%s_pool_%p", what, tmp);
-       KASSERT(cnt < sizeof(wchan));
+       cnt = snprintf(tpp->tp_name, sizeof(tpp->tp_name),
+           "%s_pool_%p", what, tmp);
+       KASSERT(cnt < sizeof(tpp->tp_name));
 
-       pool_init((struct pool *)tpp, size, 0, 0, 0, wchan,
+       pool_init(&tpp->tp_pool, size, 0, 0, 0, tpp->tp_name,
            &tmpfs_pool_allocator);
        tpp->tp_mount = tmp;
 }
diff -r a1ce517bc346 -r d36eed3907a5 sys/fs/tmpfs/tmpfs_pool.h
--- a/sys/fs/tmpfs/tmpfs_pool.h Mon Sep 12 19:55:22 2005 +0000
+++ b/sys/fs/tmpfs/tmpfs_pool.h Mon Sep 12 19:56:58 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tmpfs_pool.h,v 1.1 2005/09/10 19:20:51 jmmv Exp $      */
+/*     $NetBSD: tmpfs_pool.h,v 1.2 2005/09/12 19:56:58 yamt Exp $      */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -54,6 +54,7 @@
 struct tmpfs_pool {
        struct pool             tp_pool;
        struct tmpfs_mount *    tp_mount;
+       char                    tp_name[64];
 };
 
 /* --------------------------------------------------------------------- */



Home | Main Index | Thread Index | Old Index