X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/blobdiff_plain/597aea932ac3ac7477bdb343a994fe7948ec9582..ca466baeb91097acf0817cd63a0c33886ca69d31:/sys/vfs/fdesc/fdesc_vfsops.c diff --git a/sys/vfs/fdesc/fdesc_vfsops.c b/sys/vfs/fdesc/fdesc_vfsops.c index 011feaed0e..f39d25d746 100644 --- a/sys/vfs/fdesc/fdesc_vfsops.c +++ b/sys/vfs/fdesc/fdesc_vfsops.c @@ -36,7 +36,7 @@ * @(#)fdesc_vfsops.c 8.4 (Berkeley) 1/21/94 * * $FreeBSD: src/sys/miscfs/fdesc/fdesc_vfsops.c,v 1.22.2.3 2002/08/23 17:42:39 njl Exp $ - * $DragonFly: src/sys/vfs/fdesc/fdesc_vfsops.c,v 1.7 2004/04/24 04:32:03 drhodus Exp $ + * $DragonFly: src/sys/vfs/fdesc/fdesc_vfsops.c,v 1.18 2006/05/05 21:15:09 dillon Exp $ */ /* @@ -57,10 +57,12 @@ #include "fdesc.h" +extern struct vnodeopv_entry_desc fdesc_vnodeop_entries[]; + static MALLOC_DEFINE(M_FDESCMNT, "FDESC mount", "FDESC mount structure"); static int fdesc_mount (struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct thread *td); + struct thread *td); static int fdesc_unmount (struct mount *mp, int mntflags, struct thread *td); static int fdesc_statfs (struct mount *mp, struct statfs *sbp, @@ -70,13 +72,11 @@ static int fdesc_statfs (struct mount *mp, struct statfs *sbp, * Mount the per-process file descriptors (/dev/fd) */ static int -fdesc_mount(struct mount *mp, char *path, caddr_t data, - struct nameidata *ndp, struct thread *td) +fdesc_mount(struct mount *mp, char *path, caddr_t data, struct thread *td) { int error = 0; struct fdescmount *fmp; struct vnode *rvp; - size_t size; if (path == NULL) panic("fdesc_mount: cannot mount as root"); @@ -87,6 +87,9 @@ fdesc_mount(struct mount *mp, char *path, caddr_t data, if (mp->mnt_flag & MNT_UPDATE) return (EOPNOTSUPP); + vfs_add_vnodeops(mp, &mp->mnt_vn_norm_ops, + fdesc_vnodeop_entries, 0); + error = fdesc_allocvp(Froot, FD_ROOT, mp, &rvp, td); if (error) return (error); @@ -101,11 +104,9 @@ fdesc_mount(struct mount *mp, char *path, caddr_t data, mp->mnt_data = (qaddr_t) fmp; vfs_getnewfsid(mp); - (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size); - bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size); bzero(mp->mnt_stat.f_mntfromname, MNAMELEN); bcopy("fdesc", mp->mnt_stat.f_mntfromname, sizeof("fdesc")); - (void)fdesc_statfs(mp, &mp->mnt_stat, td); + fdesc_statfs(mp, &mp->mnt_stat, td); return (0); } @@ -141,7 +142,6 @@ fdesc_unmount(struct mount *mp, int mntflags, struct thread *td) int fdesc_root(struct mount *mp, struct vnode **vpp) { - struct thread *td = curthread; /* XXX */ struct vnode *vp; /* @@ -149,7 +149,7 @@ fdesc_root(struct mount *mp, struct vnode **vpp) */ vp = VFSTOFDESC(mp)->f_root; vref(vp); - vn_lock(vp, NULL, LK_EXCLUSIVE | LK_RETRY, td); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); *vpp = vp; return (0); } @@ -177,7 +177,7 @@ fdesc_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) last = min(fdp->fd_nfiles, lim); freefd = 0; for (i = fdp->fd_freefile; i < last; i++) - if (fdp->fd_ofiles[i] == NULL) + if (fdp->fd_files[i].fp == NULL) freefd++; /* @@ -198,27 +198,19 @@ fdesc_statfs(struct mount *mp, struct statfs *sbp, struct thread *td) if (sbp != &mp->mnt_stat) { sbp->f_type = mp->mnt_vfc->vfc_typenum; bcopy(&mp->mnt_stat.f_fsid, &sbp->f_fsid, sizeof(sbp->f_fsid)); - bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN); bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN); } return (0); } static struct vfsops fdesc_vfsops = { - fdesc_mount, - vfs_stdstart, - fdesc_unmount, - fdesc_root, - vfs_stdquotactl, - fdesc_statfs, - vfs_stdsync, - vfs_stdvget, - vfs_stdfhtovp, - vfs_stdcheckexp, - vfs_stdvptofh, - fdesc_init, - vfs_stduninit, - vfs_stdextattrctl, + .vfs_mount = fdesc_mount, + .vfs_unmount = fdesc_unmount, + .vfs_root = fdesc_root, + .vfs_statfs = fdesc_statfs, + .vfs_sync = vfs_stdsync, + .vfs_init = fdesc_init, + .vfs_uninit = fdesc_uninit }; VFS_SET(fdesc_vfsops, fdesc, VFCF_SYNTHETIC);