FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/bus.h>
#include <sys/bio.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/module.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/vnode.h>
#include <sys/queue.h>
#include <sys/poll.h>
#include <sys/sx.h>
#include <sys/ctype.h>
#include <sys/ucred.h>
#include <sys/taskqueue.h>
#include <machine/stdarg.h>
#include <fs/devfs/devfs_int.h>
#include <vm/vm.h>
#include "opt_ddb.h"
Go to the source code of this file.
Data Structures | |
struct | clonedevs |
Macros | |
#define | dead_open (d_open_t *)enxio |
#define | dead_close (d_close_t *)enxio |
#define | dead_read (d_read_t *)enxio |
#define | dead_write (d_write_t *)enxio |
#define | dead_ioctl (d_ioctl_t *)enxio |
#define | dead_poll (d_poll_t *)enodev |
#define | dead_mmap (d_mmap_t *)enodev |
#define | dead_dump (dumper_t *)enxio |
#define | dead_kqfilter (d_kqfilter_t *)enxio |
#define | dead_mmap_single (d_mmap_single_t *)enodev |
#define | null_open (d_open_t *)nullop |
#define | null_close (d_close_t *)nullop |
#define | no_read (d_read_t *)enodev |
#define | no_write (d_write_t *)enodev |
#define | no_ioctl (d_ioctl_t *)enodev |
#define | no_mmap (d_mmap_t *)enodev |
#define | no_kqfilter (d_kqfilter_t *)enodev |
#define | no_mmap_single (d_mmap_single_t *)enodev |
#define | no_dump (dumper_t *)enodev |
#define | FIXUP(member, noop, giant) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
static | MALLOC_DEFINE (M_DEVT,"cdev","cdev storage") |
static void | destroy_devl (struct cdev *dev) |
static int | destroy_dev_sched_cbl (struct cdev *dev, void(*cb)(void *), void *arg) |
static int | make_dev_credv (int flags, struct cdev **dres, struct cdevsw *devsw, int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt, va_list ap) |
static | SLIST_HEAD (free_cdevsw, cdevsw) |
static void | dev_unlock_and_free (void) |
static void | dev_free_devlocked (struct cdev *cdev) |
static void | cdevsw_free_devlocked (struct cdevsw *csw) |
void | dev_unlock (void) |
void | dev_ref (struct cdev *dev) |
void | dev_refl (struct cdev *dev) |
void | dev_rel (struct cdev *dev) |
struct cdevsw * | dev_refthread (struct cdev *dev, int *ref) |
struct cdevsw * | devvn_refthread (struct vnode *vp, struct cdev **devp, int *ref) |
void | dev_relthread (struct cdev *dev, int ref) |
int | nullop (void) |
int | eopnotsupp (void) |
static int | enxio (void) |
static int | enodev (void) |
static void | dead_strategy (struct bio *bp) |
static void | no_strategy (struct bio *bp) |
static int | no_poll (struct cdev *dev __unused, int events, struct thread *td __unused) |
static int | giant_open (struct cdev *dev, int oflags, int devtype, struct thread *td) |
static int | giant_fdopen (struct cdev *dev, int oflags, struct thread *td, struct file *fp) |
static int | giant_close (struct cdev *dev, int fflag, int devtype, struct thread *td) |
static void | giant_strategy (struct bio *bp) |
static int | giant_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) |
static int | giant_read (struct cdev *dev, struct uio *uio, int ioflag) |
static int | giant_write (struct cdev *dev, struct uio *uio, int ioflag) |
static int | giant_poll (struct cdev *dev, int events, struct thread *td) |
static int | giant_kqfilter (struct cdev *dev, struct knote *kn) |
static int | giant_mmap (struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) |
static int | giant_mmap_single (struct cdev *dev, vm_ooffset_t *offset, vm_size_t size, vm_object_t *object, int nprot) |
static void | notify (struct cdev *dev, const char *ev, int flags) |
static void | notify_create (struct cdev *dev, int flags) |
static void | notify_destroy (struct cdev *dev) |
static struct cdev * | newdev (struct cdevsw *csw, int unit, struct cdev *si) |
static void | fini_cdevsw (struct cdevsw *devsw) |
static int | prep_cdevsw (struct cdevsw *devsw, int flags) |
static int | prep_devname (struct cdev *dev, const char *fmt, va_list ap) |
struct cdev * | make_dev (struct cdevsw *devsw, int unit, uid_t uid, gid_t gid, int mode, const char *fmt,...) |
struct cdev * | make_dev_cred (struct cdevsw *devsw, int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt,...) |
struct cdev * | make_dev_credf (int flags, struct cdevsw *devsw, int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt,...) |
int | make_dev_p (int flags, struct cdev **cdev, struct cdevsw *devsw, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt,...) |
static void | dev_dependsl (struct cdev *pdev, struct cdev *cdev) |
void | dev_depends (struct cdev *pdev, struct cdev *cdev) |
static int | make_dev_alias_v (int flags, struct cdev **cdev, struct cdev *pdev, const char *fmt, va_list ap) |
struct cdev * | make_dev_alias (struct cdev *pdev, const char *fmt,...) |
int | make_dev_alias_p (int flags, struct cdev **cdev, struct cdev *pdev, const char *fmt,...) |
int | make_dev_physpath_alias (int flags, struct cdev **cdev, struct cdev *pdev, struct cdev *old_alias, const char *physpath) |
static void | delist_dev_locked (struct cdev *dev) |
void | delist_dev (struct cdev *dev) |
void | destroy_dev (struct cdev *dev) |
const char * | devtoname (struct cdev *dev) |
int | dev_stdclone (char *name, char **namep, const char *stem, int *unit) |
void | clone_setup (struct clonedevs **cdp) |
int | clone_create (struct clonedevs **cdp, struct cdevsw *csw, int *up, struct cdev **dp, int extra) |
void | clone_cleanup (struct clonedevs **cdp) |
static | TAILQ_HEAD (cdev_priv) |
int | destroy_dev_sched_cb (struct cdev *dev, void(*cb)(void *), void *arg) |
int | destroy_dev_sched (struct cdev *dev) |
void | destroy_dev_drain (struct cdevsw *csw) |
void | drain_dev_clone_events (void) |
static void | devdtr_init (void *dummy __unused) |
SYSINIT (devdtr, SI_SUB_DEVFS, SI_ORDER_SECOND, devdtr_init, NULL) | |
Variables | |
struct mtx | devmtx |
static struct cdev_priv_list | cdevp_free_list |
static struct cdevsw | dead_cdevsw |
#define dead_close (d_close_t *)enxio |
Definition at line 291 of file kern_conf.c.
Referenced by prep_cdevsw().
#define dead_dump (dumper_t *)enxio |
Definition at line 305 of file kern_conf.c.
Referenced by prep_cdevsw().
#define dead_ioctl (d_ioctl_t *)enxio |
Definition at line 294 of file kern_conf.c.
Referenced by prep_cdevsw().
#define dead_kqfilter (d_kqfilter_t *)enxio |
Definition at line 306 of file kern_conf.c.
Referenced by prep_cdevsw().
#define dead_mmap (d_mmap_t *)enodev |
Definition at line 296 of file kern_conf.c.
Referenced by prep_cdevsw().
#define dead_mmap_single (d_mmap_single_t *)enodev |
Definition at line 307 of file kern_conf.c.
Referenced by prep_cdevsw().
#define dead_open (d_open_t *)enxio |
Definition at line 290 of file kern_conf.c.
Referenced by prep_cdevsw().
#define dead_poll (d_poll_t *)enodev |
Definition at line 295 of file kern_conf.c.
Referenced by prep_cdevsw().
#define dead_read (d_read_t *)enxio |
Definition at line 292 of file kern_conf.c.
Referenced by prep_cdevsw().
#define dead_write (d_write_t *)enxio |
Definition at line 293 of file kern_conf.c.
Referenced by prep_cdevsw().
#define FIXUP | ( | member, | |
noop, | |||
giant | |||
) |
Referenced by prep_cdevsw().
#define no_dump (dumper_t *)enodev |
Definition at line 350 of file kern_conf.c.
Referenced by prep_cdevsw().
#define no_ioctl (d_ioctl_t *)enodev |
Definition at line 331 of file kern_conf.c.
Referenced by prep_cdevsw().
#define no_kqfilter (d_kqfilter_t *)enodev |
Definition at line 333 of file kern_conf.c.
Referenced by prep_cdevsw().
#define no_mmap (d_mmap_t *)enodev |
Definition at line 332 of file kern_conf.c.
Referenced by prep_cdevsw().
#define no_mmap_single (d_mmap_single_t *)enodev |
Definition at line 334 of file kern_conf.c.
Referenced by prep_cdevsw().
#define no_read (d_read_t *)enodev |
Definition at line 329 of file kern_conf.c.
Referenced by prep_cdevsw().
#define no_write (d_write_t *)enodev |
Definition at line 330 of file kern_conf.c.
Referenced by prep_cdevsw().
#define null_close (d_close_t *)nullop |
Definition at line 328 of file kern_conf.c.
Referenced by prep_cdevsw().
#define null_open (d_open_t *)nullop |
Definition at line 327 of file kern_conf.c.
Referenced by prep_cdevsw().
__FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
Definition at line 124 of file kern_conf.c.
References devmtx.
Referenced by fini_cdevsw(), and prep_cdevsw().
void clone_cleanup | ( | struct clonedevs ** | cdp | ) |
Definition at line 1324 of file kern_conf.c.
References destroy_devl(), dev_unlock_and_free(), and free().
int clone_create | ( | struct clonedevs ** | cdp, |
struct cdevsw * | csw, | ||
int * | up, | ||
struct cdev ** | dp, | ||
int | extra | ||
) |
Definition at line 1240 of file kern_conf.c.
References dev_unlock(), dev_unlock_and_free(), newdev(), panic(), prep_cdevsw(), and printf().
void clone_setup | ( | struct clonedevs ** | cdp | ) |
Definition at line 1232 of file kern_conf.c.
References malloc().
|
static |
Definition at line 299 of file kern_conf.c.
References biofinish().
Referenced by prep_cdevsw().
void delist_dev | ( | struct cdev * | dev | ) |
Definition at line 1157 of file kern_conf.c.
References delist_dev_locked(), and dev_unlock().
|
static |
Definition at line 1128 of file kern_conf.c.
References dev_refl(), dev_unlock(), devmtx, and notify_destroy().
Referenced by delist_dev().
void destroy_dev | ( | struct cdev * | dev | ) |
Definition at line 1167 of file kern_conf.c.
References destroy_devl(), and dev_unlock_and_free().
Referenced by make_dev_physpath_alias().
void destroy_dev_drain | ( | struct cdevsw * | csw | ) |
Definition at line 1425 of file kern_conf.c.
References dev_unlock(), devmtx, and hz.
int destroy_dev_sched | ( | struct cdev * | dev | ) |
Definition at line 1418 of file kern_conf.c.
References destroy_dev_sched_cb().
Referenced by ptsdrv_free().
int destroy_dev_sched_cb | ( | struct cdev * | dev, |
void(*)(void *) | cb, | ||
void * | arg | ||
) |
Definition at line 1410 of file kern_conf.c.
References destroy_dev_sched_cbl().
Referenced by destroy_dev_sched(), and tty_rel_free().
|
static |
Definition at line 1389 of file kern_conf.c.
References dev_refl(), dev_unlock(), devmtx, and taskqueue_enqueue().
Referenced by destroy_dev_sched_cb().
|
static |
Definition at line 1031 of file kern_conf.c.
References dev_free_devlocked(), dev_refl(), dev_unlock(), devmtx, devtoname(), fini_cdevsw(), hz, notify_destroy(), printf(), and wakeup().
Referenced by clone_cleanup(), destroy_dev(), and TAILQ_HEAD().
void dev_depends | ( | struct cdev * | pdev, |
struct cdev * | cdev | ||
) |
Definition at line 890 of file kern_conf.c.
References dev_dependsl(), and dev_unlock().
Referenced by tty_makedev().
|
static |
Definition at line 880 of file kern_conf.c.
Referenced by dev_depends(), and make_dev_alias_v().
|
static |
Definition at line 112 of file kern_conf.c.
References devmtx.
Referenced by destroy_devl(), and newdev().
void dev_ref | ( | struct cdev * | dev | ) |
Definition at line 139 of file kern_conf.c.
References devmtx.
void dev_refl | ( | struct cdev * | dev | ) |
Definition at line 149 of file kern_conf.c.
References devmtx.
Referenced by ctty_clone(), delist_dev_locked(), destroy_dev_sched_cbl(), destroy_devl(), and make_dev_credv().
struct cdevsw* dev_refthread | ( | struct cdev * | dev, |
int * | ref | ||
) |
Definition at line 182 of file kern_conf.c.
References dev_unlock(), and devmtx.
Referenced by dev_strategy(), giant_close(), giant_fdopen(), giant_ioctl(), giant_kqfilter(), giant_mmap(), giant_mmap_single(), giant_open(), giant_poll(), giant_read(), giant_strategy(), and giant_write().
void dev_rel | ( | struct cdev * | dev | ) |
Definition at line 157 of file kern_conf.c.
References dev_unlock(), devmtx, devtoname(), and flag.
Referenced by TAILQ_HEAD().
void dev_relthread | ( | struct cdev * | dev, |
int | ref | ||
) |
Definition at line 249 of file kern_conf.c.
References dev_unlock(), and devmtx.
Referenced by aio_qphysio(), dev_strategy(), giant_close(), giant_fdopen(), giant_ioctl(), giant_kqfilter(), giant_mmap(), giant_mmap_single(), giant_open(), giant_poll(), giant_read(), giant_strategy(), giant_write(), and ttyhook_register().
int dev_stdclone | ( | char * | name, |
char ** | namep, | ||
const char * | stem, | ||
int * | unit | ||
) |
Definition at line 1184 of file kern_conf.c.
void dev_unlock | ( | void | ) |
Definition at line 132 of file kern_conf.c.
References devmtx.
Referenced by clone_create(), count_dev(), ctty_clone(), delist_dev(), delist_dev_locked(), destroy_dev_drain(), destroy_dev_sched_cbl(), destroy_devl(), dev_depends(), dev_refthread(), dev_rel(), dev_relthread(), devvn_refthread(), make_dev_alias_v(), make_dev_credv(), prep_cdevsw(), TAILQ_HEAD(), v_decr_usecount(), v_decr_useonly(), v_incr_usecount(), v_upgrade_usecount(), vcount(), and vn_isdisk().
|
static |
Definition at line 81 of file kern_conf.c.
References devmtx, and free().
Referenced by clone_cleanup(), clone_create(), destroy_dev(), make_dev_credv(), and TAILQ_HEAD().
|
static |
Definition at line 1444 of file kern_conf.c.
const char* devtoname | ( | struct cdev * | dev | ) |
Definition at line 1177 of file kern_conf.c.
Referenced by destroy_devl(), dev_rel(), dev_strategy(), dev_strategy_csw(), disk_err(), make_dev_credv(), and physio().
struct cdevsw* devvn_refthread | ( | struct vnode * | vp, |
struct cdev ** | devp, | ||
int * | ref | ||
) |
Definition at line 207 of file kern_conf.c.
References dev_unlock(), and devmtx.
Referenced by aio_qphysio(), and ttyhook_register().
void drain_dev_clone_events | ( | void | ) |
Definition at line 1436 of file kern_conf.c.
|
static |
Definition at line 283 of file kern_conf.c.
|
static |
Definition at line 277 of file kern_conf.c.
int eopnotsupp | ( | void | ) |
Definition at line 270 of file kern_conf.c.
|
static |
Definition at line 591 of file kern_conf.c.
References cdevsw_free_devlocked().
Referenced by destroy_devl().
|
static |
Definition at line 385 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 369 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 420 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 484 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 500 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 518 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 353 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 468 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 436 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 401 of file kern_conf.c.
References biofinish(), dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
|
static |
Definition at line 452 of file kern_conf.c.
References dev_refthread(), dev_relthread(), and Giant.
Referenced by prep_cdevsw().
struct cdev* make_dev | ( | struct cdevsw * | devsw, |
int | unit, | ||
uid_t | uid, | ||
gid_t | gid, | ||
int | mode, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 809 of file kern_conf.c.
References make_dev_credv().
struct cdev* make_dev_alias | ( | struct cdev * | pdev, |
const char * | fmt, | ||
... | |||
) |
Definition at line 940 of file kern_conf.c.
References make_dev_alias_v().
Referenced by fildesc_drvinit().
int make_dev_alias_p | ( | int | flags, |
struct cdev ** | cdev, | ||
struct cdev * | pdev, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 956 of file kern_conf.c.
References make_dev_alias_v().
Referenced by make_dev_physpath_alias().
|
static |
Definition at line 899 of file kern_conf.c.
References clean_unrhdrl(), dev_dependsl(), dev_unlock(), notify_create(), panic(), and prep_devname().
Referenced by make_dev_alias(), and make_dev_alias_p().
struct cdev* make_dev_cred | ( | struct cdevsw * | devsw, |
int | unit, | ||
struct ucred * | cr, | ||
uid_t | uid, | ||
gid_t | gid, | ||
int | mode, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 826 of file kern_conf.c.
References make_dev_credv().
Referenced by tty_makedev().
struct cdev* make_dev_credf | ( | int | flags, |
struct cdevsw * | devsw, | ||
int | unit, | ||
struct ucred * | cr, | ||
uid_t | uid, | ||
gid_t | gid, | ||
int | mode, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 843 of file kern_conf.c.
References make_dev_credv().
Referenced by ctty_drvinit(), devinit(), devstat_alloc(), fildesc_drvinit(), log_drvinit(), and ttyconsdev_init().
|
static |
Definition at line 736 of file kern_conf.c.
References clean_unrhdrl(), crhold(), dev_refl(), dev_unlock(), dev_unlock_and_free(), devtoname(), mode, newdev(), notify_create(), panic(), prep_cdevsw(), and prep_devname().
Referenced by make_dev(), make_dev_cred(), make_dev_credf(), and make_dev_p().
int make_dev_p | ( | int | flags, |
struct cdev ** | cdev, | ||
struct cdevsw * | devsw, | ||
struct ucred * | cr, | ||
uid_t | uid, | ||
gid_t | gid, | ||
int | mode, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 862 of file kern_conf.c.
References make_dev_credv().
int make_dev_physpath_alias | ( | int | flags, |
struct cdev ** | cdev, | ||
struct cdev * | pdev, | ||
struct cdev * | old_alias, | ||
const char * | physpath | ||
) |
Definition at line 969 of file kern_conf.c.
References destroy_dev(), free(), make_dev_alias_p(), malloc(), and sprintf().
|
static |
|
static |
Definition at line 570 of file kern_conf.c.
References dev_free_devlocked(), and devmtx.
Referenced by clone_create(), and make_dev_credv().
|
static |
Definition at line 344 of file kern_conf.c.
References poll_no_poll().
Referenced by prep_cdevsw().
|
static |
Definition at line 337 of file kern_conf.c.
References biofinish().
Referenced by prep_cdevsw().
|
static |
Definition at line 536 of file kern_conf.c.
References devctl_notify_f(), free(), and malloc().
Referenced by notify_create(), and notify_destroy().
|
static |
Definition at line 556 of file kern_conf.c.
References notify().
Referenced by make_dev_alias_v(), and make_dev_credv().
|
static |
Definition at line 563 of file kern_conf.c.
References notify().
Referenced by delist_dev_locked(), and destroy_devl().
int nullop | ( | void | ) |
Definition at line 263 of file kern_conf.c.
|
static |
Definition at line 605 of file kern_conf.c.
References cdevsw_free_devlocked(), dead_close, dead_dump, dead_ioctl, dead_kqfilter, dead_mmap, dead_mmap_single, dead_open, dead_poll, dead_read, dead_strategy(), dead_write, dev_unlock(), devmtx, FIXUP, giant_close(), giant_fdopen(), giant_ioctl(), giant_kqfilter(), giant_mmap(), giant_mmap_single(), giant_open(), giant_poll(), giant_read(), giant_strategy(), giant_write(), malloc(), no_dump, no_ioctl, no_kqfilter, no_mmap, no_mmap_single, no_poll(), no_read, no_strategy(), no_write, null_close, null_open, and printf().
Referenced by clone_create(), and make_dev_credv().
|
static |
Definition at line 686 of file kern_conf.c.
References devmtx, and vsnrprintf().
Referenced by make_dev_alias_v(), and make_dev_credv().
|
static |
Definition at line 64 of file kern_conf.c.
References devmtx.
SYSINIT | ( | devdtr | , |
SI_SUB_DEVFS | , | ||
SI_ORDER_SECOND | , | ||
devdtr_init | , | ||
NULL | |||
) |
|
static |
Definition at line 1353 of file kern_conf.c.
References destroy_devl(), dev_rel(), dev_unlock(), and dev_unlock_and_free().
|
static |
Definition at line 62 of file kern_conf.c.
|
static |
Definition at line 309 of file kern_conf.c.
struct mtx devmtx |
Definition at line 54 of file kern_conf.c.
Referenced by cdevsw_free_devlocked(), delist_dev_locked(), destroy_dev_drain(), destroy_dev_sched_cbl(), destroy_devl(), dev_free_devlocked(), dev_ref(), dev_refl(), dev_refthread(), dev_rel(), dev_relthread(), dev_unlock(), dev_unlock_and_free(), devvn_refthread(), mutex_init(), newdev(), prep_cdevsw(), prep_devname(), and SLIST_HEAD().