X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/6601e61aa18bf4f09af135ff61fc7f4771d23b06..4b17d6b6e417f714551ec129064745ea9919780e:/bsd/dev/i386/conf.c diff --git a/bsd/dev/i386/conf.c b/bsd/dev/i386/conf.c index 0e5ea99b4..bff6f7232 100644 --- a/bsd/dev/i386/conf.c +++ b/bsd/dev/i386/conf.c @@ -1,26 +1,31 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 1997-2012 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. * - * @APPLE_LICENSE_HEADER_END@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* - * Copyright (c) 1997 by Apple Computer, Inc., all rights reserved * Copyright (c) 1993 NeXT Computer, Inc. * * UNIX Device switch tables. @@ -40,7 +45,6 @@ #include /* Prototypes that should be elsewhere: */ -extern int isdisk(dev_t dev, int type); extern dev_t chrtoblk(dev_t dev); extern int chrtoblk_set(int cdev, int bdev); extern int iskmemdev(dev_t dev); @@ -49,14 +53,14 @@ struct bdevsw bdevsw[] = { /* * For block devices, every other block of 8 slots is - * reserved to NeXT. The other slots are available for + * reserved for Apple. The other slots are available for * the user. This way we can both add new entries without - * running into each other. Be sure to fill in NeXT's + * running into each other. Be sure to fill in Apple's * 8 reserved slots when you jump over us -- we'll do the * same for you. */ - /* 0 - 7 are reserved to NeXT */ + /* 0 - 7 are reserved for Apple */ NO_BDEVICE, /* 0*/ NO_BDEVICE, /* 1*/ @@ -77,7 +81,7 @@ struct bdevsw bdevsw[] = NO_BDEVICE, /*14*/ NO_BDEVICE, /*15*/ - /* 16 - 23 are reserved to NeXT */ + /* 16 - 23 are reserved for Apple */ NO_BDEVICE, /*16*/ NO_BDEVICE, /*17*/ NO_BDEVICE, /*18*/ @@ -97,15 +101,11 @@ extern d_read_t cnread; extern d_write_t cnwrite; extern d_ioctl_t cnioctl; extern d_select_t cnselect; -extern d_getc_t cngetc; -extern d_putc_t cnputc; extern d_open_t kmopen; extern d_close_t kmclose; extern d_read_t kmread; extern d_write_t kmwrite; extern d_ioctl_t kmioctl; -extern d_getc_t kmgetc; -extern d_putc_t kmputc; extern d_open_t sgopen; extern d_close_t sgclose; extern d_ioctl_t sgioctl; @@ -121,6 +121,7 @@ extern d_ioctl_t volioctl; #endif extern d_open_t cttyopen; +extern d_close_t cttyclose; extern d_read_t cttyread; extern d_write_t cttywrite; extern d_ioctl_t cttyioctl; @@ -140,7 +141,6 @@ extern d_close_t ptsclose; extern d_read_t ptsread; extern d_write_t ptswrite; extern d_stop_t ptsstop; -extern d_putc_t ptsputc; extern d_open_t ptcopen; extern d_close_t ptcclose; extern d_read_t ptcread; @@ -153,7 +153,6 @@ extern d_ioctl_t ptyioctl; #define ptsread eno_rdwrt #define ptswrite eno_rdwrt #define ptsstop nulldev -#define ptsputc nulldev #define ptcopen eno_opcl #define ptcclose eno_opcl @@ -187,25 +186,25 @@ struct cdevsw cdevsw[] = { /* * For character devices, every other block of 16 slots is - * reserved to NeXT. The other slots are available for + * reserved for Apple. The other slots are available for * the user. This way we can both add new entries without - * running into each other. Be sure to fill in NeXT's + * running into each other. Be sure to fill in Apple's * 16 reserved slots when you jump over us -- we'll do the * same for you. */ - /* 0 - 15 are reserved to NeXT */ + /* 0 - 15 are reserved for Apple */ { cnopen, cnclose, cnread, cnwrite, /* 0*/ cnioctl, nullstop, nullreset, 0, cnselect, - eno_mmap, eno_strat, cngetc, cnputc, D_TTY + eno_mmap, eno_strat, eno_getc, eno_putc, D_TTY }, NO_CDEVICE, /* 1*/ { - cttyopen, nullclose, cttyread, cttywrite, /* 2*/ + cttyopen, cttyclose, cttyread, cttywrite, /* 2*/ cttyioctl, nullstop, nullreset, 0, cttyselect, - eno_mmap, eno_strat, eno_getc, eno_putc, D_TTY + eno_mmap, eno_strat, eno_getc, eno_putc, D_TTY | D_TRACKCLOSE }, { nullopen, nullclose, mmread, mmwrite, /* 3*/ @@ -235,7 +234,7 @@ struct cdevsw cdevsw[] = { kmopen, kmclose, kmread, kmwrite, /*12*/ kmioctl, nullstop, nullreset, km_tty, ttselect, - eno_mmap, eno_strat, kmgetc, kmputc, 0 + eno_mmap, eno_strat, eno_getc, eno_putc, 0 }, NO_CDEVICE, /*13*/ NO_CDEVICE, /*14*/ @@ -290,6 +289,7 @@ struct cdevsw cdevsw[] = }; int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]); +uint64_t cdevsw_flags[sizeof (cdevsw) / sizeof (cdevsw[0])]; #include /* for VCHR and VBLK */ /* @@ -308,7 +308,7 @@ isdisk(dev_t dev, int type) } /* FALL THROUGH */ case VBLK: - if (bdevsw[maj].d_type == D_DISK) { + if ((D_TYPEMASK & bdevsw[maj].d_type) == D_DISK) { return (1); } break; @@ -325,7 +325,7 @@ static int chrtoblktab[] = { /* 8 */ NODEV, /* 9 */ NODEV, /* 10 */ NODEV, /* 11 */ NODEV, /* 12 */ NODEV, /* 13 */ NODEV, - /* 14 */ 6, /* 15 */ NODEV, + /* 14 */ NODEV, /* 15 */ NODEV, /* 16 */ NODEV, /* 17 */ NODEV, /* 18 */ NODEV, /* 19 */ NODEV, /* 20 */ NODEV, /* 21 */ NODEV, @@ -338,7 +338,7 @@ static int chrtoblktab[] = { /* 34 */ NODEV, /* 35 */ NODEV, /* 36 */ NODEV, /* 37 */ NODEV, /* 38 */ NODEV, /* 39 */ NODEV, - /* 40 */ NODEV, /* 41 */ 1, + /* 40 */ NODEV, /* 41 */ NODEV, /* 42 */ NODEV, /* 43 */ NODEV, /* 44 */ NODEV, };