| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: devnodes.c,v 1.6 2011/02/10 11:00:45 pooka Exp $ */ | | 1 | /* $NetBSD: devnodes.c,v 1.7 2012/09/21 16:38:54 joerg Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2009 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2009 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -16,27 +16,27 @@ | | | @@ -16,27 +16,27 @@ |
16 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 16 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 | * SUCH DAMAGE. | | 25 | * SUCH DAMAGE. |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | __KERNEL_RCSID(0, "$NetBSD: devnodes.c,v 1.6 2011/02/10 11:00:45 pooka Exp $"); | | 29 | __KERNEL_RCSID(0, "$NetBSD: devnodes.c,v 1.7 2012/09/21 16:38:54 joerg Exp $"); |
30 | | | 30 | |
31 | #include <sys/param.h> | | 31 | #include <sys/param.h> |
32 | #include <sys/device.h> | | 32 | #include <sys/device.h> |
33 | #include <sys/filedesc.h> | | 33 | #include <sys/filedesc.h> |
34 | #include <sys/kmem.h> | | 34 | #include <sys/kmem.h> |
35 | #include <sys/lwp.h> | | 35 | #include <sys/lwp.h> |
36 | #include <sys/namei.h> | | 36 | #include <sys/namei.h> |
37 | #include <sys/stat.h> | | 37 | #include <sys/stat.h> |
38 | #include <sys/vfs_syscalls.h> | | 38 | #include <sys/vfs_syscalls.h> |
39 | | | 39 | |
40 | #include "rump_vfs_private.h" | | 40 | #include "rump_vfs_private.h" |
41 | | | 41 | |
42 | /* realqvik(tm) "devfs" */ | | 42 | /* realqvik(tm) "devfs" */ |
| @@ -120,27 +120,27 @@ makeonenode(char *buf, devmajor_t blk, d | | | @@ -120,27 +120,27 @@ makeonenode(char *buf, devmajor_t blk, d |
120 | if (c1 != -1) { | | 120 | if (c1 != -1) { |
121 | cstr1[0] = '0' + c1; | | 121 | cstr1[0] = '0' + c1; |
122 | cstr1[1] = '\0'; | | 122 | cstr1[1] = '\0'; |
123 | } | | 123 | } |
124 | | | 124 | |
125 | if (c2 != -1) { | | 125 | if (c2 != -1) { |
126 | cstr2[0] = 'a' + c2; | | 126 | cstr2[0] = 'a' + c2; |
127 | cstr2[1] = '\0'; | | 127 | cstr2[1] = '\0'; |
128 | | | 128 | |
129 | } | | 129 | } |
130 | | | 130 | |
131 | /* block device */ | | 131 | /* block device */ |
132 | snprintf(buf, MAXPATHLEN, "/dev/%s%s%s", base, cstr1, cstr2); | | 132 | snprintf(buf, MAXPATHLEN, "/dev/%s%s%s", base, cstr1, cstr2); |
133 | if (blk != NODEV) { | | 133 | if (blk != NODEVMAJOR) { |
134 | switch (doesitexist(buf, true, blk, dmin)) { | | 134 | switch (doesitexist(buf, true, blk, dmin)) { |
135 | case DIFFERENT: | | 135 | case DIFFERENT: |
136 | aprint_verbose("mkdevnodes: block device %s " | | 136 | aprint_verbose("mkdevnodes: block device %s " |
137 | "already exists\n", buf); | | 137 | "already exists\n", buf); |
138 | break; | | 138 | break; |
139 | case NOTEXIST: | | 139 | case NOTEXIST: |
140 | if ((error = do_sys_mknod(curlwp, buf, 0600 | S_IFBLK, | | 140 | if ((error = do_sys_mknod(curlwp, buf, 0600 | S_IFBLK, |
141 | makedev(blk, dmin), &rv, UIO_SYSSPACE)) != 0) | | 141 | makedev(blk, dmin), &rv, UIO_SYSSPACE)) != 0) |
142 | aprint_verbose("mkdevnodes: failed to " | | 142 | aprint_verbose("mkdevnodes: failed to " |
143 | "create %s: %d\n", buf, error); | | 143 | "create %s: %d\n", buf, error); |
144 | break; | | 144 | break; |
145 | case SAME: | | 145 | case SAME: |
146 | /* done */ | | 146 | /* done */ |