version 1.63, 2014/06/10 16:10:59 |
version 1.63.2.1, 2016/05/09 19:45:00 |
Line 102 tmpfs_mount(struct mount *mp, const char |
|
Line 102 tmpfs_mount(struct mount *mp, const char |
|
uint64_t memlimit; |
uint64_t memlimit; |
ino_t nodes; |
ino_t nodes; |
int error; |
int error; |
|
bool set_memlimit; |
|
bool set_nodes; |
|
|
if (args == NULL) |
if (args == NULL) |
return EINVAL; |
return EINVAL; |
Line 146 tmpfs_mount(struct mount *mp, const char |
|
Line 148 tmpfs_mount(struct mount *mp, const char |
|
/* Get the memory usage limit for this file-system. */ |
/* Get the memory usage limit for this file-system. */ |
if (args->ta_size_max < PAGE_SIZE) { |
if (args->ta_size_max < PAGE_SIZE) { |
memlimit = UINT64_MAX; |
memlimit = UINT64_MAX; |
|
set_memlimit = false; |
} else { |
} else { |
memlimit = args->ta_size_max; |
memlimit = args->ta_size_max; |
|
set_memlimit = true; |
} |
} |
KASSERT(memlimit > 0); |
KASSERT(memlimit > 0); |
|
|
if (args->ta_nodes_max <= 3) { |
if (args->ta_nodes_max <= 3) { |
nodes = 3 + (memlimit / 1024); |
nodes = 3 + (memlimit / 1024); |
|
set_nodes = false; |
} else { |
} else { |
nodes = args->ta_nodes_max; |
nodes = args->ta_nodes_max; |
|
set_nodes = true; |
} |
} |
nodes = MIN(nodes, INT_MAX); |
nodes = MIN(nodes, INT_MAX); |
KASSERT(nodes >= 3); |
KASSERT(nodes >= 3); |
|
|
if (mp->mnt_flag & MNT_UPDATE) { |
if (mp->mnt_flag & MNT_UPDATE) { |
tmp = VFS_TO_TMPFS(mp); |
tmp = VFS_TO_TMPFS(mp); |
if (nodes < tmp->tm_nodes_cnt) |
if (set_nodes && nodes < tmp->tm_nodes_cnt) |
return EBUSY; |
return EBUSY; |
if ((error = tmpfs_mntmem_set(tmp, memlimit)) != 0) |
if (set_memlimit) { |
return error; |
if ((error = tmpfs_mntmem_set(tmp, memlimit)) != 0) |
tmp->tm_nodes_max = nodes; |
return error; |
|
} |
|
if (set_nodes) |
|
tmp->tm_nodes_max = nodes; |
root = tmp->tm_root; |
root = tmp->tm_root; |
root->tn_uid = args->ta_root_uid; |
root->tn_uid = args->ta_root_uid; |
root->tn_gid = args->ta_root_gid; |
root->tn_gid = args->ta_root_gid; |
Line 205 tmpfs_mount(struct mount *mp, const char |
|
Line 214 tmpfs_mount(struct mount *mp, const char |
|
mp->mnt_stat.f_namemax = TMPFS_MAXNAMLEN; |
mp->mnt_stat.f_namemax = TMPFS_MAXNAMLEN; |
mp->mnt_fs_bshift = PAGE_SHIFT; |
mp->mnt_fs_bshift = PAGE_SHIFT; |
mp->mnt_dev_bshift = DEV_BSHIFT; |
mp->mnt_dev_bshift = DEV_BSHIFT; |
mp->mnt_iflag |= IMNT_MPSAFE; |
mp->mnt_iflag |= IMNT_MPSAFE | IMNT_CAN_RWTORO; |
vfs_getnewfsid(mp); |
vfs_getnewfsid(mp); |
|
|
error = set_statvfs_info(path, UIO_USERSPACE, "tmpfs", UIO_SYSSPACE, |
error = set_statvfs_info(path, UIO_USERSPACE, "tmpfs", UIO_SYSSPACE, |