Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/vfs_syscalls.c
Show First 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | kern_do_statfs(struct thread *td, struct mount *mp, struct statfs *buf) | ||||
vfs_rel(mp); | vfs_rel(mp); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
#ifdef MAC | #ifdef MAC | ||||
error = mac_mount_check_stat(td->td_ucred, mp); | error = mac_mount_check_stat(td->td_ucred, mp); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
#endif | #endif | ||||
/* | error = VFS_STATFS(mp, buf); | ||||
* Set these in case the underlying filesystem fails to do so. | |||||
*/ | |||||
sp = &mp->mnt_stat; | |||||
sp->f_version = STATFS_VERSION; | |||||
sp->f_namemax = NAME_MAX; | |||||
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; | |||||
error = VFS_STATFS(mp, sp); | |||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
*buf = *sp; | |||||
if (priv_check(td, PRIV_VFS_GENERATION)) { | if (priv_check(td, PRIV_VFS_GENERATION)) { | ||||
buf->f_fsid.val[0] = buf->f_fsid.val[1] = 0; | buf->f_fsid.val[0] = buf->f_fsid.val[1] = 0; | ||||
prison_enforce_statfs(td->td_ucred, mp, buf); | prison_enforce_statfs(td->td_ucred, mp, buf); | ||||
} | } | ||||
out: | out: | ||||
vfs_unbusy(mp); | vfs_unbusy(mp); | ||||
return (error); | return (error); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | if (mode == MNT_WAIT) { | ||||
if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK) != 0) { | if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK) != 0) { | ||||
nmp = TAILQ_NEXT(mp, mnt_list); | nmp = TAILQ_NEXT(mp, mnt_list); | ||||
continue; | continue; | ||||
} | } | ||||
} | } | ||||
if (sfsp != NULL && count < maxcount) { | if (sfsp != NULL && count < maxcount) { | ||||
sp = &mp->mnt_stat; | sp = &mp->mnt_stat; | ||||
/* | /* | ||||
* Set these in case the underlying filesystem | |||||
* fails to do so. | |||||
*/ | |||||
sp->f_version = STATFS_VERSION; | |||||
sp->f_namemax = NAME_MAX; | |||||
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; | |||||
/* | |||||
* If MNT_NOWAIT is specified, do not refresh | * If MNT_NOWAIT is specified, do not refresh | ||||
* the fsstat cache. | * the fsstat cache. | ||||
*/ | */ | ||||
if (mode != MNT_NOWAIT) { | if (mode != MNT_NOWAIT) { | ||||
error = VFS_STATFS(mp, sp); | error = VFS_STATFS(mp, sp); | ||||
if (error != 0) { | if (error != 0) { | ||||
mtx_lock(&mountlist_mtx); | mtx_lock(&mountlist_mtx); | ||||
nmp = TAILQ_NEXT(mp, mnt_list); | nmp = TAILQ_NEXT(mp, mnt_list); | ||||
▲ Show 20 Lines • Show All 4,070 Lines • ▼ Show 20 Lines | kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf) | ||||
error = prison_canseemount(td->td_ucred, mp); | error = prison_canseemount(td->td_ucred, mp); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
#ifdef MAC | #ifdef MAC | ||||
error = mac_mount_check_stat(td->td_ucred, mp); | error = mac_mount_check_stat(td->td_ucred, mp); | ||||
if (error != 0) | if (error != 0) | ||||
goto out; | goto out; | ||||
#endif | #endif | ||||
/* | error = VFS_STATFS(mp, buf); | ||||
* Set these in case the underlying filesystem fails to do so. | |||||
*/ | |||||
sp = &mp->mnt_stat; | |||||
sp->f_version = STATFS_VERSION; | |||||
sp->f_namemax = NAME_MAX; | |||||
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; | |||||
error = VFS_STATFS(mp, sp); | |||||
if (error == 0) | |||||
*buf = *sp; | |||||
out: | out: | ||||
vfs_unbusy(mp); | vfs_unbusy(mp); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) | kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 346 Lines • Show Last 20 Lines |