19c0af131SPoul-Henning Kamp /*- 29c0af131SPoul-Henning Kamp * Copyright (c) 2005 Poul-Henning Kamp. All rights reserved. 39c0af131SPoul-Henning Kamp * 49c0af131SPoul-Henning Kamp * Redistribution and use in source and binary forms, with or without 59c0af131SPoul-Henning Kamp * modification, are permitted provided that the following conditions 69c0af131SPoul-Henning Kamp * are met: 79c0af131SPoul-Henning Kamp * 1. Redistributions of source code must retain the above copyright 89c0af131SPoul-Henning Kamp * notice, this list of conditions and the following disclaimer. 99c0af131SPoul-Henning Kamp * 2. Neither the name of the University nor the names of its contributors 109c0af131SPoul-Henning Kamp * may be used to endorse or promote products derived from this software 119c0af131SPoul-Henning Kamp * without specific prior written permission. 129c0af131SPoul-Henning Kamp * 139c0af131SPoul-Henning Kamp * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 149c0af131SPoul-Henning Kamp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 159c0af131SPoul-Henning Kamp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 169c0af131SPoul-Henning Kamp * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 179c0af131SPoul-Henning Kamp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 189c0af131SPoul-Henning Kamp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 199c0af131SPoul-Henning Kamp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 209c0af131SPoul-Henning Kamp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 219c0af131SPoul-Henning Kamp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 229c0af131SPoul-Henning Kamp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 239c0af131SPoul-Henning Kamp * SUCH DAMAGE. 249c0af131SPoul-Henning Kamp * 259c0af131SPoul-Henning Kamp * $FreeBSD$ 269c0af131SPoul-Henning Kamp */ 279c0af131SPoul-Henning Kamp 289c0af131SPoul-Henning Kamp /* 299c0af131SPoul-Henning Kamp * This file documents a private interface and it SHALL only be used 309c0af131SPoul-Henning Kamp * by kern/kern_conf.c and fs/devfs/... 319c0af131SPoul-Henning Kamp */ 329c0af131SPoul-Henning Kamp 339c0af131SPoul-Henning Kamp #ifndef _FS_DEVFS_DEVFS_INT_H_ 349c0af131SPoul-Henning Kamp #define _FS_DEVFS_DEVFS_INT_H_ 359c0af131SPoul-Henning Kamp 369c0af131SPoul-Henning Kamp #include <sys/queue.h> 379c0af131SPoul-Henning Kamp 389c0af131SPoul-Henning Kamp #ifdef _KERNEL 399c0af131SPoul-Henning Kamp 40e606a3c6SPoul-Henning Kamp struct devfs_dirent; 41e606a3c6SPoul-Henning Kamp 4282f4d640SKonstantin Belousov struct cdev_privdata { 4382f4d640SKonstantin Belousov struct file *cdpd_fp; 4482f4d640SKonstantin Belousov void *cdpd_data; 4582f4d640SKonstantin Belousov void (*cdpd_dtr)(void *); 4682f4d640SKonstantin Belousov LIST_ENTRY(cdev_privdata) cdpd_list; 4782f4d640SKonstantin Belousov }; 4882f4d640SKonstantin Belousov 49e606a3c6SPoul-Henning Kamp struct cdev_priv { 50e606a3c6SPoul-Henning Kamp struct cdev cdp_c; 51e606a3c6SPoul-Henning Kamp TAILQ_ENTRY(cdev_priv) cdp_list; 52e606a3c6SPoul-Henning Kamp 53e606a3c6SPoul-Henning Kamp u_int cdp_inode; 54e606a3c6SPoul-Henning Kamp 55e606a3c6SPoul-Henning Kamp u_int cdp_flags; 56e606a3c6SPoul-Henning Kamp #define CDP_ACTIVE (1 << 0) 57de10ffa5SKonstantin Belousov #define CDP_SCHED_DTR (1 << 1) 58e606a3c6SPoul-Henning Kamp 59e606a3c6SPoul-Henning Kamp u_int cdp_inuse; 60e606a3c6SPoul-Henning Kamp u_int cdp_maxdirent; 61e606a3c6SPoul-Henning Kamp struct devfs_dirent **cdp_dirents; 62e606a3c6SPoul-Henning Kamp struct devfs_dirent *cdp_dirent0; 63de10ffa5SKonstantin Belousov 64de10ffa5SKonstantin Belousov TAILQ_ENTRY(cdev_priv) cdp_dtr_list; 65de10ffa5SKonstantin Belousov void (*cdp_dtr_cb)(void *); 66de10ffa5SKonstantin Belousov void *cdp_dtr_cb_arg; 6782f4d640SKonstantin Belousov 6882f4d640SKonstantin Belousov LIST_HEAD(, cdev_privdata) cdp_fdpriv; 69e606a3c6SPoul-Henning Kamp }; 70e606a3c6SPoul-Henning Kamp 7105427aafSKonstantin Belousov #define cdev2priv(c) member2struct(cdev_priv, cdp_c, c) 7205427aafSKonstantin Belousov 73*d2ba618aSKonstantin Belousov struct cdev *devfs_alloc(int); 74e606a3c6SPoul-Henning Kamp void devfs_free(struct cdev *); 759c0af131SPoul-Henning Kamp void devfs_create(struct cdev *dev); 769c0af131SPoul-Henning Kamp void devfs_destroy(struct cdev *dev); 7782f4d640SKonstantin Belousov void devfs_destroy_cdevpriv(struct cdev_privdata *p); 789c0af131SPoul-Henning Kamp 79e606a3c6SPoul-Henning Kamp extern struct unrhdr *devfs_inos; 80e606a3c6SPoul-Henning Kamp extern struct mtx devmtx; 81828d6d12SKonstantin Belousov extern struct mtx devfs_de_interlock; 82de10ffa5SKonstantin Belousov extern struct sx clone_drain_lock; 8382f4d640SKonstantin Belousov extern struct mtx cdevpriv_mtx; 84828d6d12SKonstantin Belousov extern TAILQ_HEAD(cdev_priv_list, cdev_priv) cdevp_list; 85e606a3c6SPoul-Henning Kamp 869c0af131SPoul-Henning Kamp #endif /* _KERNEL */ 879c0af131SPoul-Henning Kamp 889c0af131SPoul-Henning Kamp #endif /* !_FS_DEVFS_DEVFS_INT_H_ */ 89