Lines Matching +full:11 +full:mp
1 /* $NetBSD: tmpfs_vfsops.c,v 1.10 2005/12/11 12:24:29 christos Exp $ */
116 tmpfs_update_mtime_lazy(struct mount *mp)
120 MNT_VNODE_FOREACH_LAZY(vp, mp, mvp, tmpfs_update_mtime_lazy_filter, NULL) {
129 tmpfs_update_mtime_all(struct mount *mp)
133 if (VFS_TO_TMPFS(mp)->tm_nomtime)
135 MNT_VNODE_FOREACH_ALL(vp, mp, mvp) {
153 tmpfs_check_rw_maps_cb(struct mount *mp __unused, vm_map_t map __unused,
168 tmpfs_revoke_rw_maps_cb(struct mount *mp __unused, vm_map_t map,
187 tmpfs_all_rw_maps(struct mount *mp, bool (*cb)(struct mount *mp, vm_map_t,
247 if (vp->v_mount != mp) {
252 terminate = cb(mp, map, entry, cb_arg);
271 tmpfs_check_rw_maps(struct mount *mp)
276 tmpfs_all_rw_maps(mp, tmpfs_check_rw_maps_cb, &ca);
281 tmpfs_rw_to_ro(struct mount *mp)
286 forced = (mp->mnt_flag & MNT_FORCE) != 0;
289 if ((error = vn_start_write(NULL, &mp, V_WAIT)) != 0)
291 error = vfs_write_suspend_umnt(mp);
294 if (!forced && tmpfs_check_rw_maps(mp)) {
298 VFS_TO_TMPFS(mp)->tm_ronly = 1;
299 MNT_ILOCK(mp);
300 mp->mnt_flag |= MNT_RDONLY;
301 MNT_IUNLOCK(mp);
303 tmpfs_all_rw_maps(mp, tmpfs_revoke_rw_maps_cb, NULL);
304 tmpfs_update_mtime_all(mp);
305 error = vflush(mp, 0, flags, curthread);
307 VFS_TO_TMPFS(mp)->tm_ronly = 0;
308 MNT_ILOCK(mp);
309 mp->mnt_flag &= ~MNT_RDONLY;
310 MNT_IUNLOCK(mp);
313 if (!tmpfs_check_rw_maps(mp))
317 vfs_write_resume(mp, 0);
322 tmpfs_mount(struct mount *mp)
341 if (vfs_filteropt(mp->mnt_optnew, tmpfs_opts))
344 if (mp->mnt_flag & MNT_UPDATE) {
346 if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0)
348 tmp = VFS_TO_TMPFS(mp);
349 if (vfs_getopt_size(mp->mnt_optnew, "size", &size_max) == 0) {
360 if (vfs_getopt_size(mp->mnt_optnew, "easize", &ea_max_size) == 0) {
363 if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) &&
366 return (tmpfs_rw_to_ro(mp));
367 } else if (!vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) &&
371 MNT_ILOCK(mp);
372 mp->mnt_flag &= ~MNT_RDONLY;
373 MNT_IUNLOCK(mp);
375 tmp->tm_nomtime = vfs_getopt(mp->mnt_optnew, "nomtime", NULL,
377 MNT_ILOCK(mp);
378 if ((mp->mnt_flag & MNT_UNION) == 0) {
379 mp->mnt_kern_flag |= MNTK_FPLOOKUP;
381 mp->mnt_kern_flag &= ~MNTK_FPLOOKUP;
383 MNT_IUNLOCK(mp);
387 vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY);
388 error = VOP_GETATTR(mp->mnt_vnodecovered, &va, mp->mnt_cred);
389 VOP_UNLOCK(mp->mnt_vnodecovered);
393 if (mp->mnt_cred->cr_ruid != 0 ||
394 vfs_scanopt(mp->mnt_optnew, "gid", "%d", &root_gid) != 1)
396 if (mp->mnt_cred->cr_ruid != 0 ||
397 vfs_scanopt(mp->mnt_optnew, "uid", "%d", &root_uid) != 1)
399 if (mp->mnt_cred->cr_ruid != 0 ||
400 vfs_scanopt(mp->mnt_optnew, "mode", "%ho", &root_mode) != 1)
402 if (vfs_getopt_size(mp->mnt_optnew, "inodes", &nodes_max) != 0)
404 if (vfs_getopt_size(mp->mnt_optnew, "size", &size_max) != 0)
406 if (vfs_getopt_size(mp->mnt_optnew, "maxfilesize", &maxfilesize) != 0)
408 if (vfs_getopt_size(mp->mnt_optnew, "easize", &ea_max_size) != 0)
410 nonc = vfs_getopt(mp->mnt_optnew, "nonc", NULL, NULL) == 0;
411 nomtime = vfs_getopt(mp->mnt_optnew, "nomtime", NULL, NULL) == 0;
412 pgread = vfs_getopt(mp->mnt_optnew, "pgread", NULL, NULL) == 0;
460 tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
466 error = tmpfs_alloc_node(mp, tmp, VDIR, root_uid, root_gid,
477 MNT_ILOCK(mp);
478 mp->mnt_flag |= MNT_LOCAL;
479 mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED |
481 if (!nonc && (mp->mnt_flag & MNT_UNION) == 0)
482 mp->mnt_kern_flag |= MNTK_FPLOOKUP;
483 MNT_IUNLOCK(mp);
485 mp->mnt_data = tmp;
486 mp->mnt_stat.f_namemax = MAXNAMLEN;
487 vfs_getnewfsid(mp);
488 vfs_mountedfrom(mp, "tmpfs");
495 tmpfs_unmount(struct mount *mp, int mntflags)
502 tmp = VFS_TO_TMPFS(mp);
505 error = vfs_write_suspend_umnt(mp);
514 error = vflush(mp, 0, flags, curthread);
516 vfs_write_resume(mp, VR_START_WRITE);
519 MNT_ILOCK(mp);
520 if (mp->mnt_nvnodelistsize == 0) {
521 MNT_IUNLOCK(mp);
524 MNT_IUNLOCK(mp);
526 vfs_write_resume(mp, VR_START_WRITE);
542 mp->mnt_data = NULL;
544 vfs_write_resume(mp, VR_START_WRITE);
574 tmpfs_root(struct mount *mp, int flags, struct vnode **vpp)
578 error = tmpfs_alloc_vp(mp, VFS_TO_TMPFS(mp)->tm_root, flags, vpp);
585 tmpfs_fhtovp(struct mount *mp, struct fid *fhp, int flags,
602 tmp = VFS_TO_TMPFS(mp);
618 error = tmpfs_alloc_vp(mp, node, LK_EXCLUSIVE, vpp);
627 tmpfs_statfs(struct mount *mp, struct statfs *sbp)
632 tmp = VFS_TO_TMPFS(mp);
659 tmpfs_sync(struct mount *mp, int waitfor)
663 MNT_ILOCK(mp);
664 mp->mnt_kern_flag |= MNTK_SUSPEND2 | MNTK_SUSPENDED;
665 MNT_IUNLOCK(mp);
667 tmpfs_update_mtime_lazy(mp);
712 db_print_tmpfs(struct mount *mp, struct tmpfs_mount *tmp)
714 db_printf("mp %p (%s) tmp %p\n", mp,
715 mp->mnt_stat.f_mntonname, tmp);
730 struct mount *mp;
734 mp = (struct mount *)addr;
735 tmp = VFS_TO_TMPFS(mp);
736 db_print_tmpfs(mp, tmp);
740 TAILQ_FOREACH(mp, &mountlist, mnt_list) {
741 if (strcmp(mp->mnt_stat.f_fstypename, tmpfs_vfsconf.vfc_name) ==
743 tmp = VFS_TO_TMPFS(mp);
744 db_print_tmpfs(mp, tmp);