Changeset View
Changeset View
Standalone View
Standalone View
head/sys/fs/tmpfs/tmpfs_vfsops.c
Show First 20 Lines • Show All 135 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
tmpfs_mount(struct mount *mp) | tmpfs_mount(struct mount *mp) | ||||
{ | { | ||||
const size_t nodes_per_page = howmany(PAGE_SIZE, | const size_t nodes_per_page = howmany(PAGE_SIZE, | ||||
sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node)); | sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node)); | ||||
struct tmpfs_mount *tmp; | struct tmpfs_mount *tmp; | ||||
struct tmpfs_node *root; | struct tmpfs_node *root; | ||||
struct thread *td = curthread; | |||||
int error; | int error; | ||||
bool nonc; | bool nonc; | ||||
/* Size counters. */ | /* Size counters. */ | ||||
u_quad_t pages; | u_quad_t pages; | ||||
off_t nodes_max, size_max, maxfilesize; | off_t nodes_max, size_max, maxfilesize; | ||||
/* Root node attributes. */ | /* Root node attributes. */ | ||||
uid_t root_uid; | uid_t root_uid; | ||||
gid_t root_gid; | gid_t root_gid; | ||||
mode_t root_mode; | mode_t root_mode; | ||||
struct vattr va; | struct vattr va; | ||||
if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_TMPFS)) | |||||
return (EPERM); | |||||
if (vfs_filteropt(mp->mnt_optnew, tmpfs_opts)) | if (vfs_filteropt(mp->mnt_optnew, tmpfs_opts)) | ||||
return (EINVAL); | return (EINVAL); | ||||
if (mp->mnt_flag & MNT_UPDATE) { | if (mp->mnt_flag & MNT_UPDATE) { | ||||
/* Only support update mounts for certain options. */ | /* Only support update mounts for certain options. */ | ||||
if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0) | if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0) | ||||
return (EOPNOTSUPP); | return (EOPNOTSUPP); | ||||
▲ Show 20 Lines • Show All 340 Lines • Show Last 20 Lines |