1149144Sphk/*- 2149144Sphk * Copyright (c) 2005 Poul-Henning Kamp. All rights reserved. 3149144Sphk * 4149144Sphk * Redistribution and use in source and binary forms, with or without 5149144Sphk * modification, are permitted provided that the following conditions 6149144Sphk * are met: 7149144Sphk * 1. Redistributions of source code must retain the above copyright 8149144Sphk * notice, this list of conditions and the following disclaimer. 9149144Sphk * 2. Neither the name of the University nor the names of its contributors 10149144Sphk * may be used to endorse or promote products derived from this software 11149144Sphk * without specific prior written permission. 12149144Sphk * 13149144Sphk * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 14149144Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15149144Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16149144Sphk * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 17149144Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18149144Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19149144Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20149144Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21149144Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22149144Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23149144Sphk * SUCH DAMAGE. 24149144Sphk * 25149144Sphk * $FreeBSD: releng/10.2/sys/fs/devfs/devfs_int.h 278283 2015-02-05 20:49:13Z hselasky $ 26149144Sphk */ 27149144Sphk 28149144Sphk/* 29149144Sphk * This file documents a private interface and it SHALL only be used 30149144Sphk * by kern/kern_conf.c and fs/devfs/... 31149144Sphk */ 32149144Sphk 33149144Sphk#ifndef _FS_DEVFS_DEVFS_INT_H_ 34149144Sphk#define _FS_DEVFS_DEVFS_INT_H_ 35149144Sphk 36149144Sphk#include <sys/queue.h> 37149144Sphk 38149144Sphk#ifdef _KERNEL 39149144Sphk 40150342Sphkstruct devfs_dirent; 41213215Sjhstruct devfs_mount; 42150342Sphk 43179175Skibstruct cdev_privdata { 44179175Skib struct file *cdpd_fp; 45179175Skib void *cdpd_data; 46179175Skib void (*cdpd_dtr)(void *); 47179175Skib LIST_ENTRY(cdev_privdata) cdpd_list; 48179175Skib}; 49179175Skib 50150342Sphkstruct cdev_priv { 51150342Sphk struct cdev cdp_c; 52150342Sphk TAILQ_ENTRY(cdev_priv) cdp_list; 53150342Sphk 54150342Sphk u_int cdp_inode; 55150342Sphk 56150342Sphk u_int cdp_flags; 57150342Sphk#define CDP_ACTIVE (1 << 0) 58171181Skib#define CDP_SCHED_DTR (1 << 1) 59278283Shselasky#define CDP_UNREF_DTR (1 << 2) 60150342Sphk 61150342Sphk u_int cdp_inuse; 62150342Sphk u_int cdp_maxdirent; 63150342Sphk struct devfs_dirent **cdp_dirents; 64150342Sphk struct devfs_dirent *cdp_dirent0; 65171181Skib 66171181Skib TAILQ_ENTRY(cdev_priv) cdp_dtr_list; 67171181Skib void (*cdp_dtr_cb)(void *); 68171181Skib void *cdp_dtr_cb_arg; 69179175Skib 70179175Skib LIST_HEAD(, cdev_privdata) cdp_fdpriv; 71150342Sphk}; 72150342Sphk 73240539Sed#define cdev2priv(c) __containerof(c, struct cdev_priv, cdp_c) 74179828Skib 75213725Sjhstruct cdev *devfs_alloc(int); 76213725Sjhint devfs_dev_exists(const char *); 77213725Sjhvoid devfs_free(struct cdev *); 78213725Sjhvoid devfs_create(struct cdev *); 79213725Sjhvoid devfs_destroy(struct cdev *); 80213725Sjhvoid devfs_destroy_cdevpriv(struct cdev_privdata *); 81149144Sphk 82213215Sjhint devfs_dir_find(const char *); 83213215Sjhvoid devfs_dir_ref_de(struct devfs_mount *, struct devfs_dirent *); 84213215Sjhvoid devfs_dir_unref_de(struct devfs_mount *, struct devfs_dirent *); 85213215Sjhint devfs_pathpath(const char *, const char *); 86213215Sjh 87150342Sphkextern struct unrhdr *devfs_inos; 88150342Sphkextern struct mtx devmtx; 89163481Skibextern struct mtx devfs_de_interlock; 90171181Skibextern struct sx clone_drain_lock; 91179175Skibextern struct mtx cdevpriv_mtx; 92163481Skibextern TAILQ_HEAD(cdev_priv_list, cdev_priv) cdevp_list; 93150342Sphk 94149144Sphk#endif /* _KERNEL */ 95149144Sphk 96149144Sphk#endif /* !_FS_DEVFS_DEVFS_INT_H_ */ 97