Lines Matching +full:qemu +full:- +full:user +full:- +full:static
1 /*-
2 * Copyright (c) 2017-2020 Juniper Networks, Inc.
49 /* This count is static now. Can be made tunable later */
52 static MALLOC_DEFINE(M_P9MNT, "p9fs_mount", "Mount structures for p9fs");
53 static uma_zone_t p9fs_node_zone;
61 static const char *p9fs_opts[] = {
77 if (node->parent && node->parent != node) { in p9fs_dispose_node()
78 vrele(P9FS_NTOV(node->parent)); in p9fs_dispose_node()
84 vp->v_data = NULL; in p9fs_dispose_node()
87 if (!(vp->v_vflag & VV_ROOT)) { in p9fs_dispose_node()
88 free(node->inode.i_name, M_TEMP); in p9fs_dispose_node()
96 static int
126 static int
140 static int
153 vses = &vmp->p9fs_session; in p9fs_unmount()
177 mp->mnt_data = NULL; in p9fs_unmount()
181 vses->clnt->trans_status = P9FS_CONNECT; in p9fs_unmount()
195 np = vp->v_data; in p9fs_node_cmp()
201 if (np->vqid.qid_path == qid->path) { in p9fs_node_cmp()
202 if (vp->v_vflag & VV_ROOT) in p9fs_node_cmp()
204 else if (np->vqid.qid_mode == qid->type && in p9fs_node_cmp()
205 np->vqid.qid_version == qid->version) in p9fs_node_cmp()
214 * - Destroy the FID LIST locks
215 * - Dispose all node knowledge
267 vses = &vmp->p9fs_session; in p9fs_vget_common()
270 hash = fnv_32_buf(&fid->qid.path, sizeof(uint64_t), FNV1_32_INIT); in p9fs_vget_common()
272 &fid->qid); in p9fs_vget_common()
276 if (vp->v_vflag & VV_ROOT) { in p9fs_vget_common()
282 error = p9fs_reload_stats_dotl(vp, curthread->td_ucred); in p9fs_vget_common()
284 node = vp->v_data; in p9fs_vget_common()
287 node->flags |= P9FS_NODE_DELETED; in p9fs_vget_common()
321 STAILQ_INIT(&np->vfid_list); in p9fs_vget_common()
326 STAILQ_INIT(&np->vofid_list); in p9fs_vget_common()
329 np->parent = parent; in p9fs_vget_common()
330 np->p9fs_ses = vses; /* Map the current session */ in p9fs_vget_common()
331 inode = &np->inode; in p9fs_vget_common()
333 inode->i_name = malloc(strlen(name)+1, M_TEMP, M_NOWAIT | M_ZERO); in p9fs_vget_common()
334 strlcpy(inode->i_name, name, strlen(name)+1); in p9fs_vget_common()
336 vp->v_type = VDIR; /* root vp is a directory */ in p9fs_vget_common()
337 vp->v_vflag |= VV_ROOT; in p9fs_vget_common()
341 vp->v_data = np; in p9fs_vget_common()
342 np->v_node = vp; in p9fs_vget_common()
343 inode = &np->inode; in p9fs_vget_common()
344 inode->i_qid_path = fid->qid.path; in p9fs_vget_common()
347 lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); in p9fs_vget_common()
358 error = p9fs_reload_stats_dotl(vp, curthread->td_ucred); in p9fs_vget_common()
365 p9fs_node_cmp, &fid->qid); in p9fs_vget_common()
372 STAILQ_INSERT_TAIL(&vses->virt_node_list, np, p9fs_node_next); in p9fs_vget_common()
373 np->flags |= P9FS_NODE_IN_SESSION; in p9fs_vget_common()
403 static int
415 if (vfs_filteropt(mp->mnt_optnew, p9fs_opts)) in p9_mount()
419 error = vfs_getopt(mp->mnt_optnew, "from", (void **)&from, &len); in p9_mount()
420 if (error != 0 || from[len - 1] != '\0') in p9_mount()
425 mp->mnt_data = vmp; in p9_mount()
426 vmp->p9fs_mountp = mp; in p9_mount()
427 vmp->mount_tag = from; in p9_mount()
428 vmp->mount_tag_len = len; in p9_mount()
429 vses = &vmp->p9fs_session; in p9_mount()
430 vses->p9fs_mount = mp; in p9_mount()
431 p9fs_root = &vses->rnp; in p9_mount()
432 /* Hardware iosize from the Qemu */ in p9_mount()
433 mp->mnt_iosize_max = PAGE_SIZE; in p9_mount()
444 STAILQ_INIT(&p9fs_root->vfid_list); in p9_mount()
447 STAILQ_INIT(&p9fs_root->vofid_list); in p9_mount()
448 p9fs_root->parent = p9fs_root; in p9_mount()
449 p9fs_root->flags |= P9FS_ROOT; in p9_mount()
450 p9fs_root->p9fs_ses = vses; in p9_mount()
452 strlcpy(mp->mnt_stat.f_mntfromname, from, in p9_mount()
453 sizeof(mp->mnt_stat.f_mntfromname)); in p9_mount()
455 mp->mnt_flag |= MNT_LOCAL; in p9_mount()
456 mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED; in p9_mount()
466 mp->mnt_data = NULL; in p9_mount()
472 static int
478 * Minimal support for MNT_UPDATE - allow changing from in p9fs_mount()
481 if (mp->mnt_flag & MNT_UPDATE) { in p9fs_mount()
482 if ((mp->mnt_flag & MNT_RDONLY) && !vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0)) { in p9fs_mount()
483 mp->mnt_flag &= ~MNT_RDONLY; in p9fs_mount()
500 static int
510 np = &vmp->p9fs_session.rnp; in p9fs_root()
511 clnt = vmp->p9fs_session.clnt; in p9fs_root()
514 P9_DEBUG(VOPS, "%s: node=%p name=%s\n",__func__, np, np->inode.i_name); in p9fs_root()
516 vfid = p9fs_get_fid(clnt, np, curthread->td_ucred, VFID, -1, &error); in p9fs_root()
519 /* for root use the nobody user's fid as vfid. in p9fs_root()
520 * This is used while unmounting as root when non-root in p9fs_root()
521 * user has mounted p9fs in p9fs_root()
523 if (vfid == NULL && clnt->trans_status == P9FS_BEGIN_DISCONNECT) in p9fs_root()
524 vfid = vmp->p9fs_session.mnt_fid; in p9fs_root()
536 np->v_node = *vpp; in p9fs_root()
541 static int
552 np = &vmp->p9fs_session.rnp; in p9fs_statfs()
553 clnt = vmp->p9fs_session.clnt; in p9fs_statfs()
556 vfid = p9fs_get_fid(clnt, np, curthread->td_ucred, VFID, -1, &error); in p9fs_statfs()
564 buf->f_type = statfs.type; in p9fs_statfs()
567 * Qemu server can do. in p9fs_statfs()
570 buf->f_bsize = PAGE_SIZE; in p9fs_statfs()
572 buf->f_bsize = statfs.bsize; in p9fs_statfs()
574 buf->f_iosize = buf->f_bsize; in p9fs_statfs()
575 buf->f_blocks = statfs.blocks; in p9fs_statfs()
576 buf->f_bfree = statfs.bfree; in p9fs_statfs()
577 buf->f_bavail = statfs.bavail; in p9fs_statfs()
578 buf->f_files = statfs.files; in p9fs_statfs()
579 buf->f_ffree = statfs.ffree; in p9fs_statfs()
583 buf->f_bsize = PAGE_SIZE; in p9fs_statfs()
584 buf->f_iosize = buf->f_bsize; /* XXX */ in p9fs_statfs()
590 static int