|
FreeBSD kernel kern code
|
#include <sys/cdefs.h>#include <sys/param.h>#include <sys/systm.h>#include <sys/fcntl.h>#include <sys/file.h>#include <sys/kdb.h>#include <sys/stat.h>#include <sys/priv.h>#include <sys/proc.h>#include <sys/limits.h>#include <sys/lock.h>#include <sys/mount.h>#include <sys/mutex.h>#include <sys/namei.h>#include <sys/vnode.h>#include <sys/bio.h>#include <sys/buf.h>#include <sys/filio.h>#include <sys/resourcevar.h>#include <sys/sx.h>#include <sys/sysctl.h>#include <sys/ttycom.h>#include <sys/conf.h>#include <sys/syslog.h>#include <sys/unistd.h>#include <security/audit/audit.h>#include <security/mac/mac_framework.h>#include <vm/vm.h>#include <vm/vm_extern.h>#include <vm/pmap.h>#include <vm/vm_map.h>#include <vm/vm_object.h>#include <vm/vm_page.h>
Go to the source code of this file.
Functions | |
| __FBSDID ("$BSDSUniX$") | |
| int | vn_open (struct nameidata *ndp, int *flagp, int cmode, struct file *fp) |
| int | vn_open_cred (struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags, struct ucred *cred, struct file *fp) |
| int | vn_writechk (struct vnode *vp) |
| int | vn_close (struct vnode *vp, int flags, struct ucred *file_cred, struct thread *td) |
| static int | sequential_heuristic (struct uio *uio, struct file *fp) |
| int | vn_rdwr (enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset, enum uio_seg segflg, int ioflg, struct ucred *active_cred, struct ucred *file_cred, ssize_t *aresid, struct thread *td) |
| int | vn_rdwr_inchunks (enum uio_rw rw, struct vnode *vp, void *base, size_t len, off_t offset, enum uio_seg segflg, int ioflg, struct ucred *active_cred, struct ucred *file_cred, size_t *aresid, struct thread *td) |
| off_t | foffset_lock (struct file *fp, int flags) |
| void | foffset_unlock (struct file *fp, off_t val, int flags) |
| void | foffset_lock_uio (struct file *fp, struct uio *uio, int flags) |
| void | foffset_unlock_uio (struct file *fp, struct uio *uio, int flags) |
| static int | get_advice (struct file *fp, struct uio *uio) |
| static int | vn_read (struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) |
| static int | vn_write (struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) |
| SYSCTL_INT (_debug, OID_AUTO, vn_io_fault_enable, CTLFLAG_RW,&vn_io_fault_enable, 0,"Enable vn_io_fault lock avoidance") | |
| SYSCTL_ULONG (_debug, OID_AUTO, vn_io_faults, CTLFLAG_RD,&vn_io_faults_cnt, 0,"Count of vn_io_fault lock avoidance triggers") | |
| static int | vn_io_fault (struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) |
| int | vn_io_fault_uiomove (char *data, int xfersize, struct uio *uio) |
| int | vn_io_fault_pgmove (vm_page_t ma[], vm_offset_t offset, int xfersize, struct uio *uio) |
| static int | vn_truncate (struct file *fp, off_t length, struct ucred *active_cred, struct thread *td) |
| static int | vn_statfile (struct file *fp, struct stat *sb, struct ucred *active_cred, struct thread *td) |
| int | vn_stat (struct vnode *vp, struct stat *sb, struct ucred *active_cred, struct ucred *file_cred, struct thread *td) |
| static int | vn_ioctl (struct file *fp, u_long com, void *data, struct ucred *active_cred, struct thread *td) |
| static int | vn_poll (struct file *fp, int events, struct ucred *active_cred, struct thread *td) |
| int | _vn_lock (struct vnode *vp, int flags, char *file, int line) |
| static int | vn_closefile (struct file *fp, struct thread *td) |
| static int | vn_start_write_locked (struct mount *mp, int flags) |
| int | vn_start_write (struct vnode *vp, struct mount **mpp, int flags) |
| int | vn_start_secondary_write (struct vnode *vp, struct mount **mpp, int flags) |
| void | vn_finished_write (struct mount *mp) |
| void | vn_finished_secondary_write (struct mount *mp) |
| int | vfs_write_suspend (struct mount *mp) |
| void | vfs_write_resume_flags (struct mount *mp, int flags) |
| void | vfs_write_resume (struct mount *mp) |
| static int | vn_kqfilter (struct file *fp, struct knote *kn) |
| int | vn_extattr_get (struct vnode *vp, int ioflg, int attrnamespace, const char *attrname, int *buflen, char *buf, struct thread *td) |
| int | vn_extattr_set (struct vnode *vp, int ioflg, int attrnamespace, const char *attrname, int buflen, char *buf, struct thread *td) |
| int | vn_extattr_rm (struct vnode *vp, int ioflg, int attrnamespace, const char *attrname, struct thread *td) |
| int | vn_vget_ino (struct vnode *vp, ino_t ino, int lkflags, struct vnode **rvp) |
| int | vn_rlimit_fsize (const struct vnode *vp, const struct uio *uio, const struct thread *td) |
| int | vn_chmod (struct file *fp, mode_t mode, struct ucred *active_cred, struct thread *td) |
| int | vn_chown (struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, struct thread *td) |
| void | vn_pages_remove (struct vnode *vp, vm_pindex_t start, vm_pindex_t end) |
| int | vn_bmap_seekhole (struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred) |
Variables | |
| static fo_rdwr_t | vn_read |
| static fo_rdwr_t | vn_write |
| static fo_rdwr_t | vn_io_fault |
| static fo_truncate_t | vn_truncate |
| static fo_ioctl_t | vn_ioctl |
| static fo_poll_t | vn_poll |
| static fo_kqfilter_t | vn_kqfilter |
| static fo_stat_t | vn_statfile |
| static fo_close_t | vn_closefile |
| struct fileops | vnops |
| static const int | io_hold_cnt = 16 |
| static int | vn_io_fault_enable = 0 |
| static u_long | vn_io_faults_cnt |
| __FBSDID | ( | "$BSDSUniX$" | ) |
| int _vn_lock | ( | struct vnode * | vp, |
| int | flags, | ||
| char * | file, | ||
| int | line | ||
| ) |
Definition at line 1389 of file vfs_vnops.c.
| off_t foffset_lock | ( | struct file * | fp, |
| int | flags | ||
| ) |
Definition at line 524 of file vfs_vnops.c.
References mtx_pool_find(), and mtxpool_sleep.
Referenced by foffset_lock_uio(), kern_getdirentries(), and sys_lseek().


| void foffset_lock_uio | ( | struct file * | fp, |
| struct uio * | uio, | ||
| int | flags | ||
| ) |
Definition at line 593 of file vfs_vnops.c.
References foffset_lock().
Referenced by vn_io_fault().


| void foffset_unlock | ( | struct file * | fp, |
| off_t | val, | ||
| int | flags | ||
| ) |
Definition at line 560 of file vfs_vnops.c.
References mtx_pool_find(), mtxpool_sleep, and wakeup().
Referenced by foffset_unlock_uio(), kern_getdirentries(), and sys_lseek().


| void foffset_unlock_uio | ( | struct file * | fp, |
| struct uio * | uio, | ||
| int | flags | ||
| ) |
Definition at line 601 of file vfs_vnops.c.
References foffset_unlock().
Referenced by vn_io_fault().


|
static |
Definition at line 609 of file vfs_vnops.c.
References mtx_pool_find(), and mtxpool_sleep.
Referenced by vn_read(), and vn_write().


|
static |
Definition at line 337 of file vfs_vnops.c.
Referenced by vn_read(), and vn_write().

| SYSCTL_INT | ( | _debug | , |
| OID_AUTO | , | ||
| vn_io_fault_enable | , | ||
| CTLFLAG_RW | , | ||
| & | vn_io_fault_enable, | ||
| 0 | , | ||
| "Enable vn_io_fault lock avoidance" | |||
| ) |
| SYSCTL_ULONG | ( | _debug | , |
| OID_AUTO | , | ||
| vn_io_faults | , | ||
| CTLFLAG_RD | , | ||
| & | vn_io_faults_cnt, | ||
| 0 | , | ||
| "Count of vn_io_fault lock avoidance triggers" | |||
| ) |
| void vfs_write_resume | ( | struct mount * | mp | ) |
Definition at line 1700 of file vfs_vnops.c.
References vfs_write_resume_flags().
Referenced by vfs_write_suspend().


| void vfs_write_resume_flags | ( | struct mount * | mp, |
| int | flags | ||
| ) |
Definition at line 1672 of file vfs_vnops.c.
References vn_start_write_locked(), and wakeup().
Referenced by vfs_write_resume().


| int vfs_write_suspend | ( | struct mount * | mp | ) |
Definition at line 1644 of file vfs_vnops.c.
References vfs_write_resume().

| int vn_bmap_seekhole | ( | struct vnode * | vp, |
| u_long | cmd, | ||
| off_t * | off, | ||
| struct ucred * | cred | ||
| ) |
Definition at line 1941 of file vfs_vnops.c.
| int vn_chmod | ( | struct file * | fp, |
| mode_t | mode, | ||
| struct ucred * | active_cred, | ||
| struct thread * | td | ||
| ) |
Definition at line 1891 of file vfs_vnops.c.
References setfmode().

| int vn_chown | ( | struct file * | fp, |
| uid_t | uid, | ||
| gid_t | gid, | ||
| struct ucred * | active_cred, | ||
| struct thread * | td | ||
| ) |
Definition at line 1910 of file vfs_vnops.c.
References setfown().

| int vn_close | ( | struct vnode * | vp, |
| int | flags, | ||
| struct ucred * | file_cred, | ||
| struct thread * | td | ||
| ) |
Definition at line 303 of file vfs_vnops.c.
References vn_finished_write(), vn_start_write(), and vput().
Referenced by acct_disable(), alq_shutdown(), coredump(), expand_name(), link_elf_ctf_get(), link_elf_load_file(), linker_hints_lookup(), linker_lookup_file(), sys_acct(), sys_ktrace(), vfs_mountroot_readconf(), vn_closefile(), and vop_stdvptocnp().


|
static |
Definition at line 1423 of file vfs_vnops.c.
References badfileops, and vn_close().

| int vn_extattr_get | ( | struct vnode * | vp, |
| int | ioflg, | ||
| int | attrnamespace, | ||
| const char * | attrname, | ||
| int * | buflen, | ||
| char * | buf, | ||
| struct thread * | td | ||
| ) |
Definition at line 1728 of file vfs_vnops.c.
References buf.
| int vn_extattr_rm | ( | struct vnode * | vp, |
| int | ioflg, | ||
| int | attrnamespace, | ||
| const char * | attrname, | ||
| struct thread * | td | ||
| ) |
Definition at line 1808 of file vfs_vnops.c.
References vn_finished_write(), and vn_start_write().

| int vn_extattr_set | ( | struct vnode * | vp, |
| int | ioflg, | ||
| int | attrnamespace, | ||
| const char * | attrname, | ||
| int | buflen, | ||
| char * | buf, | ||
| struct thread * | td | ||
| ) |
Definition at line 1769 of file vfs_vnops.c.
References buf, vn_finished_write(), and vn_start_write().

| void vn_finished_secondary_write | ( | struct mount * | mp | ) |
Definition at line 1622 of file vfs_vnops.c.
References panic(), and wakeup().
Referenced by vgonel().


| void vn_finished_write | ( | struct mount * | mp | ) |
Definition at line 1599 of file vfs_vnops.c.
References panic(), and wakeup().
Referenced by aio_fsync_vnode(), alq_doio(), coredump(), dounmount(), extattr_delete_vp(), extattr_set_vp(), flushbufqueues(), kern_linkat(), kern_mkdirat(), kern_mkfifoat(), kern_mknodat(), kern_posix_fallocate(), kern_renameat(), kern_rmdirat(), kern_symlinkat(), kern_truncate(), kern_unlinkat(), setfflags(), setfmode(), setfown(), setutimes(), sync_fsync(), sync_vnode(), sys_extattrctl(), sys_fhopen(), sys_fsync(), sys_sync(), sys_undelete(), uipc_bind(), vacl_delete(), vacl_set_acl(), vlrureclaim(), vn_close(), vn_extattr_rm(), vn_extattr_set(), vn_open_cred(), vn_rdwr(), vn_truncate(), vn_write(), and vtryrecycle().


|
static |
Definition at line 883 of file vfs_vnops.c.
References cloneuio(), foffset_lock_uio(), foffset_unlock_uio(), free(), io_hold_cnt, uiomove(), vn_io_fault_enable, vn_io_faults_cnt, vn_read, and vn_write.

| int vn_io_fault_pgmove | ( | vm_page_t | ma[], |
| vm_offset_t | offset, | ||
| int | xfersize, | ||
| struct uio * | uio | ||
| ) |
Definition at line 1094 of file vfs_vnops.c.
| int vn_io_fault_uiomove | ( | char * | data, |
| int | xfersize, | ||
| struct uio * | uio | ||
| ) |
Definition at line 1038 of file vfs_vnops.c.
References uiomove().

|
static |
Definition at line 1319 of file vfs_vnops.c.
|
static |
Definition at line 1710 of file vfs_vnops.c.
| int vn_open | ( | struct nameidata * | ndp, |
| int * | flagp, | ||
| int | cmode, | ||
| struct file * | fp | ||
| ) |
Definition at line 106 of file vfs_vnops.c.
References vn_open_cred().
Referenced by expand_name(), kern_openat(), link_elf_ctf_get(), link_elf_load_file(), linker_hints_lookup(), linker_lookup_file(), sys_acct(), sys_ktrace(), and vfs_mountroot_readconf().


| int vn_open_cred | ( | struct nameidata * | ndp, |
| int * | flagp, | ||
| int | cmode, | ||
| u_int | vn_open_flags, | ||
| struct ucred * | cred, | ||
| struct file * | fp | ||
| ) |
Definition at line 124 of file vfs_vnops.c.
References accmode, bwillwrite(), namei(), NDFREE(), vn_finished_write(), vn_start_write(), vn_writechk(), vput(), and vrele().
Referenced by alq_open_flags(), coredump(), vn_open(), and vop_stdvptocnp().


| void vn_pages_remove | ( | struct vnode * | vp, |
| vm_pindex_t | start, | ||
| vm_pindex_t | end | ||
| ) |
Definition at line 1929 of file vfs_vnops.c.
|
static |
Definition at line 1360 of file vfs_vnops.c.
| int vn_rdwr | ( | enum uio_rw | rw, |
| struct vnode * | vp, | ||
| void * | base, | ||
| int | len, | ||
| off_t | offset, | ||
| enum uio_seg | segflg, | ||
| int | ioflg, | ||
| struct ucred * | active_cred, | ||
| struct ucred * | file_cred, | ||
| ssize_t * | aresid, | ||
| struct thread * | td | ||
| ) |
Definition at line 379 of file vfs_vnops.c.
References vn_finished_write(), and vn_start_write().
Referenced by acct_process(), gz_open(), kern_sendfile(), link_elf_ctf_get(), link_elf_load_file(), linker_hints_lookup(), putU32(), vfs_mountroot_readconf(), and vn_rdwr_inchunks().


| int vn_rdwr_inchunks | ( | enum uio_rw | rw, |
| struct vnode * | vp, | ||
| void * | base, | ||
| size_t | len, | ||
| off_t | offset, | ||
| enum uio_seg | segflg, | ||
| int | ioflg, | ||
| struct ucred * | active_cred, | ||
| struct ucred * | file_cred, | ||
| size_t * | aresid, | ||
| struct thread * | td | ||
| ) |
Definition at line 474 of file vfs_vnops.c.
References bwillwrite(), kern_yield(), and vn_rdwr().
Referenced by core_output(), do_flush(), gzwrite(), and sbuf_drain_core_output().


|
static |
Definition at line 631 of file vfs_vnops.c.
References get_advice(), mtx_pool_find(), mtxpool_sleep, sequential_heuristic(), and start.

| int vn_rlimit_fsize | ( | const struct vnode * | vp, |
| const struct uio * | uio, | ||
| const struct thread * | td | ||
| ) |
Definition at line 1873 of file vfs_vnops.c.
References kern_psignal(), and lim_cur().

| int vn_start_secondary_write | ( | struct vnode * | vp, |
| struct mount ** | mpp, | ||
| int | flags | ||
| ) |
Definition at line 1537 of file vfs_vnops.c.
References vfs_rel().
Referenced by vgonel().


| int vn_start_write | ( | struct vnode * | vp, |
| struct mount ** | mpp, | ||
| int | flags | ||
| ) |
Definition at line 1491 of file vfs_vnops.c.
References vn_start_write_locked().
Referenced by aio_fsync_vnode(), alq_doio(), coredump(), dounmount(), extattr_delete_vp(), extattr_set_vp(), flushbufqueues(), kern_linkat(), kern_mkdirat(), kern_mkfifoat(), kern_mknodat(), kern_posix_fallocate(), kern_renameat(), kern_rmdirat(), kern_symlinkat(), kern_truncate(), kern_unlinkat(), setfflags(), setfmode(), setfown(), setutimes(), sync_fsync(), sync_vnode(), sys_extattrctl(), sys_fhopen(), sys_fsync(), sys_sync(), sys_undelete(), uipc_bind(), vacl_delete(), vacl_set_acl(), vlrureclaim(), vn_close(), vn_extattr_rm(), vn_extattr_set(), vn_open_cred(), vn_rdwr(), vn_truncate(), vn_write(), and vtryrecycle().


|
static |
Definition at line 1457 of file vfs_vnops.c.
Referenced by vfs_write_resume_flags(), and vn_start_write().

| int vn_stat | ( | struct vnode * | vp, |
| struct stat * | sb, | ||
| struct ucred * | active_cred, | ||
| struct ucred * | file_cred, | ||
| struct thread * | td | ||
| ) |
Definition at line 1209 of file vfs_vnops.c.
References mode, and priv_check().
Referenced by kern_statat_vnhook(), kern_unlinkat(), sys_fhstat(), and vn_statfile().


|
static |
Definition at line 1186 of file vfs_vnops.c.
References vn_stat().

|
static |
Definition at line 1136 of file vfs_vnops.c.
References vn_finished_write(), vn_start_write(), and vn_writechk().

| int vn_vget_ino | ( | struct vnode * | vp, |
| ino_t | ino, | ||
| int | lkflags, | ||
| struct vnode ** | rvp | ||
| ) |
Definition at line 1837 of file vfs_vnops.c.
References vfs_busy(), vfs_ref(), vfs_rel(), vfs_unbusy(), and vput().

|
static |
Definition at line 718 of file vfs_vnops.c.
References bwillwrite(), get_advice(), mtx_pool_find(), mtxpool_sleep, sequential_heuristic(), start, vn_finished_write(), and vn_start_write().

| int vn_writechk | ( | struct vnode * | vp | ) |
Definition at line 283 of file vfs_vnops.c.
Referenced by kern_truncate(), sys_fhopen(), vn_access(), vn_open_cred(), and vn_truncate().

|
static |
Definition at line 841 of file vfs_vnops.c.
Referenced by vn_io_fault().
|
static |
Definition at line 89 of file vfs_vnops.c.
|
static |
Definition at line 83 of file vfs_vnops.c.
|
static |
Definition at line 842 of file vfs_vnops.c.
Referenced by vn_io_fault().
|
static |
Definition at line 845 of file vfs_vnops.c.
Referenced by vn_io_fault().
|
static |
Definition at line 85 of file vfs_vnops.c.
|
static |
Definition at line 87 of file vfs_vnops.c.
|
static |
Definition at line 86 of file vfs_vnops.c.
|
static |
Definition at line 81 of file vfs_vnops.c.
Referenced by vn_io_fault().
|
static |
Definition at line 88 of file vfs_vnops.c.
|
static |
Definition at line 84 of file vfs_vnops.c.
|
static |
Definition at line 82 of file vfs_vnops.c.
Referenced by vn_io_fault().
| struct fileops vnops |
Definition at line 91 of file vfs_vnops.c.
Referenced by kern_openat(), ptsdev_close(), and sys_fhopen().