Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_vnops.c
Show First 20 Lines • Show All 1,690 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
int | int | ||||
vn_statfile(struct file *fp, struct stat *sb, struct ucred *active_cred) | vn_statfile(struct file *fp, struct stat *sb, struct ucred *active_cred) | ||||
{ | { | ||||
struct vnode *vp = fp->f_vnode; | struct vnode *vp = fp->f_vnode; | ||||
int error; | int error; | ||||
vn_lock(vp, LK_SHARED | LK_RETRY); | vn_lock(vp, LK_SHARED | LK_RETRY); | ||||
error = VOP_STAT(vp, sb, active_cred, fp->f_cred); | error = VOP_STAT(vp, sb, 0, active_cred, fp->f_cred); | ||||
VOP_UNLOCK(vp); | VOP_UNLOCK(vp); | ||||
return (error); | return (error); | ||||
} | } | ||||
/* | /* | ||||
* File table vnode ioctl routine. | * File table vnode ioctl routine. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 1,101 Lines • ▼ Show 20 Lines | vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif) | ||||
); | ); | ||||
/* | /* | ||||
* Retrieve vnode attributes. | * Retrieve vnode attributes. | ||||
*/ | */ | ||||
va.va_fsid = VNOVAL; | va.va_fsid = VNOVAL; | ||||
va.va_rdev = NODEV; | va.va_rdev = NODEV; | ||||
vn_lock(vp, LK_SHARED | LK_RETRY); | vn_lock(vp, LK_SHARED | LK_RETRY); | ||||
error = VOP_GETATTR(vp, &va, curthread->td_ucred); | error = VOP_GETATTR(vp, 0, &va, curthread->td_ucred); | ||||
VOP_UNLOCK(vp); | VOP_UNLOCK(vp); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
if (va.va_fsid != VNOVAL) | if (va.va_fsid != VNOVAL) | ||||
kif->kf_un.kf_file.kf_file_fsid = va.va_fsid; | kif->kf_un.kf_file.kf_file_fsid = va.va_fsid; | ||||
else | else | ||||
kif->kf_un.kf_file.kf_file_fsid = | kif->kf_un.kf_file.kf_file_fsid = | ||||
vp->v_mount->mnt_stat.f_fsid.val[0]; | vp->v_mount->mnt_stat.f_fsid.val[0]; | ||||
▲ Show 20 Lines • Show All 530 Lines • ▼ Show 20 Lines | vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp, | ||||
interrupted = 0; | interrupted = 0; | ||||
dat = NULL; | dat = NULL; | ||||
error = vn_lock(invp, LK_SHARED); | error = vn_lock(invp, LK_SHARED); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
if (VOP_PATHCONF(invp, _PC_MIN_HOLE_SIZE, &holein) != 0) | if (VOP_PATHCONF(invp, _PC_MIN_HOLE_SIZE, &holein) != 0) | ||||
holein = 0; | holein = 0; | ||||
error = VOP_GETATTR(invp, &inva, incred); | error = VOP_GETATTR(invp, 0, &inva, incred); | ||||
if (error == 0 && inva.va_size > OFF_MAX) | if (error == 0 && inva.va_size > OFF_MAX) | ||||
error = EFBIG; | error = EFBIG; | ||||
VOP_UNLOCK(invp); | VOP_UNLOCK(invp); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
/* | /* | ||||
* Use va_bytes >= va_size as a hint that the file does not have | * Use va_bytes >= va_size as a hint that the file does not have | ||||
▲ Show 20 Lines • Show All 639 Lines • ▼ Show 20 Lines | vn_dir_check_empty(struct vnode *vp) | ||||
off_t off; | off_t off; | ||||
int eofflag, error; | int eofflag, error; | ||||
struct dirent *dp; | struct dirent *dp; | ||||
struct vattr va; | struct vattr va; | ||||
ASSERT_VOP_LOCKED(vp, "vfs_emptydir"); | ASSERT_VOP_LOCKED(vp, "vfs_emptydir"); | ||||
VNPASS(vp->v_type == VDIR, vp); | VNPASS(vp->v_type == VDIR, vp); | ||||
error = VOP_GETATTR(vp, &va, td->td_ucred); | error = VOP_GETATTR(vp, 0, &va, td->td_ucred); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
dirbuflen = max(DEV_BSIZE, GENERIC_MAXDIRSIZ); | dirbuflen = max(DEV_BSIZE, GENERIC_MAXDIRSIZ); | ||||
if (dirbuflen < va.va_blocksize) | if (dirbuflen < va.va_blocksize) | ||||
dirbuflen = va.va_blocksize; | dirbuflen = va.va_blocksize; | ||||
dirbuf = malloc(dirbuflen, M_TEMP, M_WAITOK); | dirbuf = malloc(dirbuflen, M_TEMP, M_WAITOK); | ||||
▲ Show 20 Lines • Show All 242 Lines • Show Last 20 Lines |