| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ptyfs_subr.c,v 1.31 2014/08/15 13:40:39 hannken Exp $ */ | | 1 | /* $NetBSD: ptyfs_subr.c,v 1.32 2014/08/16 07:22:30 hannken Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1993 | | 4 | * Copyright (c) 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to Berkeley by | | 7 | * This code is derived from software contributed to Berkeley by |
8 | * Jan-Simon Pendry. | | 8 | * Jan-Simon Pendry. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -63,27 +63,27 @@ | | | @@ -63,27 +63,27 @@ |
63 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 63 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
64 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 64 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
65 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 65 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
66 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 66 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
67 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 67 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
68 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 68 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
69 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 69 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
70 | * SUCH DAMAGE. | | 70 | * SUCH DAMAGE. |
71 | * | | 71 | * |
72 | * @(#)procfs_subr.c 8.6 (Berkeley) 5/14/95 | | 72 | * @(#)procfs_subr.c 8.6 (Berkeley) 5/14/95 |
73 | */ | | 73 | */ |
74 | | | 74 | |
75 | #include <sys/cdefs.h> | | 75 | #include <sys/cdefs.h> |
76 | __KERNEL_RCSID(0, "$NetBSD: ptyfs_subr.c,v 1.31 2014/08/15 13:40:39 hannken Exp $"); | | 76 | __KERNEL_RCSID(0, "$NetBSD: ptyfs_subr.c,v 1.32 2014/08/16 07:22:30 hannken Exp $"); |
77 | | | 77 | |
78 | #include <sys/param.h> | | 78 | #include <sys/param.h> |
79 | #include <sys/systm.h> | | 79 | #include <sys/systm.h> |
80 | #include <sys/time.h> | | 80 | #include <sys/time.h> |
81 | #include <sys/kernel.h> | | 81 | #include <sys/kernel.h> |
82 | #include <sys/vnode.h> | | 82 | #include <sys/vnode.h> |
83 | #include <sys/stat.h> | | 83 | #include <sys/stat.h> |
84 | #include <sys/malloc.h> | | 84 | #include <sys/malloc.h> |
85 | #include <sys/file.h> | | 85 | #include <sys/file.h> |
86 | #include <sys/namei.h> | | 86 | #include <sys/namei.h> |
87 | #include <sys/filedesc.h> | | 87 | #include <sys/filedesc.h> |
88 | #include <sys/select.h> | | 88 | #include <sys/select.h> |
89 | #include <sys/tty.h> | | 89 | #include <sys/tty.h> |
| @@ -114,39 +114,39 @@ ptyfs_allocvp(struct mount *mp, struct v | | | @@ -114,39 +114,39 @@ ptyfs_allocvp(struct mount *mp, struct v |
114 | memset(&key, 0, sizeof(key)); | | 114 | memset(&key, 0, sizeof(key)); |
115 | key.ptk_pty = pty; | | 115 | key.ptk_pty = pty; |
116 | key.ptk_type = type; | | 116 | key.ptk_type = type; |
117 | return vcache_get(mp, &key, sizeof(key), vpp); | | 117 | return vcache_get(mp, &key, sizeof(key), vpp); |
118 | } | | 118 | } |
119 | | | 119 | |
120 | /* | | 120 | /* |
121 | * Initialize ptyfsnode hash table. | | 121 | * Initialize ptyfsnode hash table. |
122 | */ | | 122 | */ |
123 | void | | 123 | void |
124 | ptyfs_hashinit(void) | | 124 | ptyfs_hashinit(void) |
125 | { | | 125 | { |
126 | | | 126 | |
127 | ptyfs_node_tbl = hashinit(16, HASH_LIST, true, &ptyfs_node_mask); | | 127 | ptyfs_node_tbl = hashinit(16, HASH_SLIST, true, &ptyfs_node_mask); |
128 | mutex_init(&ptyfs_hashlock, MUTEX_DEFAULT, IPL_NONE); | | 128 | mutex_init(&ptyfs_hashlock, MUTEX_DEFAULT, IPL_NONE); |
129 | } | | 129 | } |
130 | | | 130 | |
131 | /* | | 131 | /* |
132 | * Free ptyfsnode hash table. | | 132 | * Free ptyfsnode hash table. |
133 | */ | | 133 | */ |
134 | void | | 134 | void |
135 | ptyfs_hashdone(void) | | 135 | ptyfs_hashdone(void) |
136 | { | | 136 | { |
137 | | | 137 | |
138 | mutex_destroy(&ptyfs_hashlock); | | 138 | mutex_destroy(&ptyfs_hashlock); |
139 | hashdone(ptyfs_node_tbl, HASH_LIST, ptyfs_node_mask); | | 139 | hashdone(ptyfs_node_tbl, HASH_SLIST, ptyfs_node_mask); |
140 | } | | 140 | } |
141 | | | 141 | |
142 | /* | | 142 | /* |
143 | * Get a ptyfsnode from the hash table, or allocate one. | | 143 | * Get a ptyfsnode from the hash table, or allocate one. |
144 | */ | | 144 | */ |
145 | struct ptyfsnode * | | 145 | struct ptyfsnode * |
146 | ptyfs_get_node(ptyfstype type, int pty) | | 146 | ptyfs_get_node(ptyfstype type, int pty) |
147 | { | | 147 | { |
148 | struct ptyfs_hashhead *ppp; | | 148 | struct ptyfs_hashhead *ppp; |
149 | struct ptyfsnode *pp; | | 149 | struct ptyfsnode *pp; |
150 | | | 150 | |
151 | ppp = &ptyfs_node_tbl[PTYFS_FILENO(type, pty) & ptyfs_node_mask]; | | 151 | ppp = &ptyfs_node_tbl[PTYFS_FILENO(type, pty) & ptyfs_node_mask]; |
152 | | | 152 | |