X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/5d5c5d0d5b79ade9a973d55186ffda2638ba2b6e..7ee9d059c4eecf68ae4f8b0fb99ae2471eda79af:/bsd/sys/conf.h diff --git a/bsd/sys/conf.h b/bsd/sys/conf.h index c23d3a478..39e4fef37 100644 --- a/bsd/sys/conf.h +++ b/bsd/sys/conf.h @@ -1,31 +1,29 @@ /* * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * 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. - * - * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and + * 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. + * + * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and * limitations under the License. - * - * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ /*- @@ -73,6 +71,8 @@ #include #include +#include +#include /* * Definitions of device driver entry switches @@ -111,9 +111,6 @@ typedef int stop_fcn_t(struct tty *tp, int rw); typedef int reset_fcn_t(int uban); typedef int select_fcn_t(dev_t dev, int which, void * wql, struct proc *p); typedef int mmap_fcn_t(void); -typedef int getc_fcn_t(dev_t dev); -typedef int putc_fcn_t(dev_t dev, char c); -typedef int d_poll_t(dev_t dev, int events, struct proc *p); #define d_open_t open_close_fcn_t #define d_close_t open_close_fcn_t @@ -125,8 +122,6 @@ typedef int d_poll_t(dev_t dev, int events, struct proc *p); #define d_select_t select_fcn_t #define d_mmap_t mmap_fcn_t #define d_strategy_t strategy_fcn_t -#define d_getc_t getc_fcn_t -#define d_putc_t putc_fcn_t __BEGIN_DECLS int enodev(void); @@ -146,10 +141,11 @@ __END_DECLS #define eno_stop ((stop_fcn_t *)&enodev) #define eno_reset ((reset_fcn_t *)&enodev) #define eno_mmap ((mmap_fcn_t *)&enodev) -#define eno_getc ((getc_fcn_t *)&enodev) -#define eno_putc ((putc_fcn_t *)&enodev) #define eno_select ((select_fcn_t *)&enodev) +/* For source backward compatibility only! */ +#define eno_getc ((void *)&enodev) +#define eno_putc ((void *)&enodev) /* * Block device switch table @@ -188,22 +184,36 @@ struct cdevsw { open_close_fcn_t *d_close; read_write_fcn_t *d_read; read_write_fcn_t *d_write; - ioctl_fcn_t *d_ioctl; - stop_fcn_t *d_stop; - reset_fcn_t *d_reset; + ioctl_fcn_t *d_ioctl; + stop_fcn_t *d_stop; + reset_fcn_t *d_reset; struct tty **d_ttys; select_fcn_t *d_select; - mmap_fcn_t *d_mmap; + mmap_fcn_t *d_mmap; strategy_fcn_t *d_strategy; - getc_fcn_t *d_getc; - putc_fcn_t *d_putc; - int d_type; + void *d_reserved_1; + void *d_reserved_2; + int d_type; }; +#ifdef BSD_KERNEL_PRIVATE +void devsw_init(void); + +extern uint64_t cdevsw_flags[]; +#define CDEVSW_SELECT_KQUEUE 0x01 +#define CDEVSW_USE_OFFSET 0x02 + +struct thread; + +typedef struct devsw_lock { + TAILQ_ENTRY(devsw_lock) dl_list; + struct thread *dl_thread; + dev_t dl_dev; + int dl_mode; +} *devsw_lock_t; + +#endif /* BSD_KERNEL_PRIVATE */ -#ifdef KERNEL_PRIVATE -extern struct cdevsw cdevsw[]; -#endif /* KERNEL_PRIVATE */ /* * Contents of empty cdevsw slot. @@ -282,6 +292,16 @@ extern struct swdevt swdevt[]; * else -1 */ __BEGIN_DECLS +#ifdef KERNEL_PRIVATE +extern struct cdevsw cdevsw[]; +extern int cdevsw_setkqueueok(int, struct cdevsw*, int); +#endif /* KERNEL_PRIVATE */ + +#ifdef BSD_KERNEL_PRIVATE +extern void devsw_lock(dev_t, int); +extern void devsw_unlock(dev_t, int); +#endif /* BSD_KERNEL_PRIVATE */ + int bdevsw_isfree(int); int bdevsw_add(int, struct bdevsw *); int bdevsw_remove(int, struct bdevsw *); @@ -289,6 +309,7 @@ int cdevsw_isfree(int); int cdevsw_add(int, struct cdevsw *); int cdevsw_add_with_bdev(int index, struct cdevsw * csw, int bdev); int cdevsw_remove(int, struct cdevsw *); +int isdisk(dev_t, int); __END_DECLS #endif /* KERNEL */