Deleted Added
full compact
kern_conf.c (46792) kern_conf.c (47028)
1/*-
2 * Parts Copyright (c) 1995 Terrence R. Lambert
3 * Copyright (c) 1995 Julian R. Elischer
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
1/*-
2 * Parts Copyright (c) 1995 Terrence R. Lambert
3 * Copyright (c) 1995 Julian R. Elischer
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 16 unchanged lines hidden (view full) ---

25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $Id: kern_conf.c,v 1.35 1999/05/09 08:18:12 phk Exp $
33 * $Id: kern_conf.c,v 1.36 1999/05/09 13:00:46 phk Exp $
34 */
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/module.h>
39#include <sys/conf.h>
40#include <sys/vnode.h>
41

--- 23 unchanged lines hidden (view full) ---

65 return(NODEV);
66}
67
68int
69cdevsw_add(dev_t *descrip,
70 struct cdevsw *newentry,
71 struct cdevsw **oldentry)
72{
34 */
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/module.h>
39#include <sys/conf.h>
40#include <sys/vnode.h>
41

--- 23 unchanged lines hidden (view full) ---

65 return(NODEV);
66}
67
68int
69cdevsw_add(dev_t *descrip,
70 struct cdevsw *newentry,
71 struct cdevsw **oldentry)
72{
73 int i ;
73 int i;
74 static int setup;
74
75
76 if (!setup) {
77 for (i = 0; i < NUMCDEV; i++)
78 if (!bmaj2cmaj[i])
79 bmaj2cmaj[i] = 254;
80 setup++;
81 }
82
75 if ( *descrip == NODEV) { /* auto (0 is valid) */
76 /*
77 * Search the table looking for a slot...
78 */
79 for (i = cdevsw_ALLOCSTART; i < nchrdev; i++)
80 if (cdevsw[i] == NULL)
81 break; /* found one! */
82 /* out of allocable slots? */

--- 73 unchanged lines hidden (view full) ---

156 return error;
157 }
158
159 if (data->chainevh)
160 return data->chainevh(mod, what, data->chainarg);
161 else
162 return 0;
163}
83 if ( *descrip == NODEV) { /* auto (0 is valid) */
84 /*
85 * Search the table looking for a slot...
86 */
87 for (i = cdevsw_ALLOCSTART; i < nchrdev; i++)
88 if (cdevsw[i] == NULL)
89 break; /* found one! */
90 /* out of allocable slots? */

--- 73 unchanged lines hidden (view full) ---

164 return error;
165 }
166
167 if (data->chainevh)
168 return data->chainevh(mod, what, data->chainarg);
169 else
170 return 0;
171}
172
173/*
174 * dev_t and u_dev_t primitives
175 */
176
177#define DEVT_FASCIST 1
178
179int
180major(dev_t x)
181{
182#ifdef DEVT_FASCIST
183 return(253 - ((x >> 8) & 0xff));
184#else
185 return((x >> 8) & 0xff);
186#endif
187}
188
189int
190minor(dev_t x)
191{
192 return(x & 0xffff00ff);
193}
194
195dev_t
196makedev(int x, int y)
197{
198#ifdef DEVT_FASCIST
199 return (((253 - x) << 8) | y);
200#else
201 return ((x << 8) | y);
202#endif
203}
204
205udev_t
206dev2udev(dev_t x)
207{
208 return umakedev(major(x), minor(x));
209}
210
211dev_t
212udev2dev(udev_t x, int b)
213{
214 return makedev(umajor(x), uminor(x));
215}
216
217int
218uminor(udev_t dev)
219{
220 return(dev & 0xffff00ff);
221}
222
223int
224umajor(udev_t dev)
225{
226 return((dev & 0xff00) >> 8);
227}
228
229udev_t
230umakedev(int x, int y)
231{
232 return ((x << 8) | y);
233}
234