Source-Changes-HG archive

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

[src/trunk]: src/sys Add HASH_PSLIST (pslist(9)) type for hashinit()



details:   https://anonhg.NetBSD.org/src/rev/a08190948862
branches:  trunk
changeset: 816437:a08190948862
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Wed Jul 06 05:20:48 2016 +0000

description:
Add HASH_PSLIST (pslist(9)) type for hashinit()

diffstat:

 sys/kern/subr_hash.c |  15 +++++++++++++--
 sys/sys/systm.h      |   5 +++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diffs (80 lines):

diff -r 21a70f3dbcc5 -r a08190948862 sys/kern/subr_hash.c
--- a/sys/kern/subr_hash.c      Wed Jul 06 01:10:07 2016 +0000
+++ b/sys/kern/subr_hash.c      Wed Jul 06 05:20:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_hash.c,v 1.6 2014/05/29 21:15:55 rmind Exp $      */
+/*     $NetBSD: subr_hash.c,v 1.7 2016/07/06 05:20:48 ozaki-r Exp $    */
 
 /*
  * Copyright (c) 1982, 1986, 1991, 1993
@@ -37,12 +37,13 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.6 2014/05/29 21:15:55 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.7 2016/07/06 05:20:48 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/bitops.h>
 #include <sys/kmem.h>
 #include <sys/systm.h>
+#include <sys/pslist.h>
 
 static size_t
 hash_list_size(enum hashtype htype)
@@ -50,12 +51,16 @@
        LIST_HEAD(, generic) *hashtbl_list;
        SLIST_HEAD(, generic) *hashtbl_slist;
        TAILQ_HEAD(, generic) *hashtbl_tailq;
+       struct pslist_head *hashtbl_pslist;
        size_t esize;
 
        switch (htype) {
        case HASH_LIST:
                esize = sizeof(*hashtbl_list);
                break;
+       case HASH_PSLIST:
+               esize = sizeof(*hashtbl_pslist);
+               break;
        case HASH_SLIST:
                esize = sizeof(*hashtbl_slist);
                break;
@@ -80,6 +85,7 @@
        LIST_HEAD(, generic) *hashtbl_list;
        SLIST_HEAD(, generic) *hashtbl_slist;
        TAILQ_HEAD(, generic) *hashtbl_tailq;
+       struct pslist_head *hashtbl_pslist;
        u_long hashsize, i;
        size_t esize;
        void *p;
@@ -103,6 +109,11 @@
                for (i = 0; i < hashsize; i++)
                        LIST_INIT(&hashtbl_list[i]);
                break;
+       case HASH_PSLIST:
+               hashtbl_pslist = p;
+               for (i = 0; i < hashsize; i++)
+                       PSLIST_INIT(&hashtbl_pslist[i]);
+               break;
        case HASH_SLIST:
                hashtbl_slist = p;
                for (i = 0; i < hashsize; i++)
diff -r 21a70f3dbcc5 -r a08190948862 sys/sys/systm.h
--- a/sys/sys/systm.h   Wed Jul 06 01:10:07 2016 +0000
+++ b/sys/sys/systm.h   Wed Jul 06 05:20:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: systm.h,v 1.270 2016/01/23 20:44:06 christos Exp $     */
+/*     $NetBSD: systm.h,v 1.271 2016/07/06 05:20:48 ozaki-r Exp $      */
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -177,7 +177,8 @@
 enum hashtype {
        HASH_LIST,
        HASH_SLIST,
-       HASH_TAILQ
+       HASH_TAILQ,
+       HASH_PSLIST
 };
 
 #ifdef _KERNEL



Home | Main Index | Thread Index | Old Index