Home | History | Annotate | Line # | Download | only in mfs
mfs_vfsops.c revision 1.52
      1  1.52       agc /*	$NetBSD: mfs_vfsops.c,v 1.52 2003/08/07 16:34:41 agc Exp $	*/
      2   1.2       cgd 
      3   1.1   mycroft /*
      4   1.1   mycroft  * Copyright (c) 1989, 1990, 1993, 1994
      5   1.1   mycroft  *	The Regents of the University of California.  All rights reserved.
      6   1.1   mycroft  *
      7   1.1   mycroft  * Redistribution and use in source and binary forms, with or without
      8   1.1   mycroft  * modification, are permitted provided that the following conditions
      9   1.1   mycroft  * are met:
     10   1.1   mycroft  * 1. Redistributions of source code must retain the above copyright
     11   1.1   mycroft  *    notice, this list of conditions and the following disclaimer.
     12   1.1   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     13   1.1   mycroft  *    notice, this list of conditions and the following disclaimer in the
     14   1.1   mycroft  *    documentation and/or other materials provided with the distribution.
     15  1.52       agc  * 3. Neither the name of the University nor the names of its contributors
     16   1.1   mycroft  *    may be used to endorse or promote products derived from this software
     17   1.1   mycroft  *    without specific prior written permission.
     18   1.1   mycroft  *
     19   1.1   mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20   1.1   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21   1.1   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22   1.1   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23   1.1   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24   1.1   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25   1.1   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26   1.1   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27   1.1   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28   1.1   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29   1.1   mycroft  * SUCH DAMAGE.
     30   1.1   mycroft  *
     31  1.15      fvdl  *	@(#)mfs_vfsops.c	8.11 (Berkeley) 6/19/95
     32   1.1   mycroft  */
     33  1.36     lukem 
     34  1.36     lukem #include <sys/cdefs.h>
     35  1.52       agc __KERNEL_RCSID(0, "$NetBSD: mfs_vfsops.c,v 1.52 2003/08/07 16:34:41 agc Exp $");
     36  1.17  jonathan 
     37  1.34       mrg #if defined(_KERNEL_OPT)
     38  1.17  jonathan #include "opt_compat_netbsd.h"
     39  1.17  jonathan #endif
     40   1.1   mycroft 
     41   1.1   mycroft #include <sys/param.h>
     42   1.1   mycroft #include <sys/systm.h>
     43   1.1   mycroft #include <sys/time.h>
     44   1.1   mycroft #include <sys/kernel.h>
     45   1.1   mycroft #include <sys/proc.h>
     46   1.1   mycroft #include <sys/buf.h>
     47   1.1   mycroft #include <sys/mount.h>
     48   1.1   mycroft #include <sys/signalvar.h>
     49   1.1   mycroft #include <sys/vnode.h>
     50   1.1   mycroft #include <sys/malloc.h>
     51   1.1   mycroft 
     52  1.33   thorpej #include <miscfs/syncfs/syncfs.h>
     53  1.33   thorpej 
     54   1.1   mycroft #include <ufs/ufs/quota.h>
     55   1.1   mycroft #include <ufs/ufs/inode.h>
     56   1.1   mycroft #include <ufs/ufs/ufsmount.h>
     57   1.1   mycroft #include <ufs/ufs/ufs_extern.h>
     58   1.1   mycroft 
     59   1.1   mycroft #include <ufs/ffs/fs.h>
     60   1.1   mycroft #include <ufs/ffs/ffs_extern.h>
     61   1.1   mycroft 
     62   1.1   mycroft #include <ufs/mfs/mfsnode.h>
     63   1.1   mycroft #include <ufs/mfs/mfs_extern.h>
     64   1.1   mycroft 
     65   1.1   mycroft caddr_t	mfs_rootbase;	/* address of mini-root in kernel virtual memory */
     66   1.1   mycroft u_long	mfs_rootsize;	/* size of mini-root in bytes */
     67   1.1   mycroft 
     68   1.1   mycroft static	int mfs_minor;	/* used for building internal dev_t */
     69   1.1   mycroft 
     70  1.10  christos extern int (**mfs_vnodeop_p) __P((void *));
     71  1.44   thorpej 
     72  1.44   thorpej MALLOC_DEFINE(M_MFSNODE, "MFS node", "MFS vnode private part");
     73   1.1   mycroft 
     74   1.1   mycroft /*
     75   1.1   mycroft  * mfs vfs operations.
     76   1.1   mycroft  */
     77  1.14   thorpej 
     78  1.31  jdolecek extern const struct vnodeopv_desc mfs_vnodeop_opv_desc;
     79  1.14   thorpej 
     80  1.31  jdolecek const struct vnodeopv_desc * const mfs_vnodeopv_descs[] = {
     81  1.14   thorpej 	&mfs_vnodeop_opv_desc,
     82  1.14   thorpej 	NULL,
     83  1.14   thorpej };
     84  1.14   thorpej 
     85   1.1   mycroft struct vfsops mfs_vfsops = {
     86   1.1   mycroft 	MOUNT_MFS,
     87   1.1   mycroft 	mfs_mount,
     88   1.1   mycroft 	mfs_start,
     89   1.1   mycroft 	ffs_unmount,
     90   1.1   mycroft 	ufs_root,
     91   1.1   mycroft 	ufs_quotactl,
     92   1.1   mycroft 	mfs_statfs,
     93   1.1   mycroft 	ffs_sync,
     94   1.1   mycroft 	ffs_vget,
     95   1.1   mycroft 	ffs_fhtovp,
     96   1.1   mycroft 	ffs_vptofh,
     97   1.1   mycroft 	mfs_init,
     98  1.35       chs 	mfs_reinit,
     99  1.23  jdolecek 	mfs_done,
    100  1.15      fvdl 	ffs_sysctl,
    101  1.16      fvdl 	NULL,
    102  1.19  wrstuden 	ufs_check_export,
    103  1.14   thorpej 	mfs_vnodeopv_descs,
    104   1.1   mycroft };
    105   1.1   mycroft 
    106  1.15      fvdl /*
    107  1.15      fvdl  * Memory based filesystem initialization.
    108  1.15      fvdl  */
    109  1.15      fvdl void
    110  1.15      fvdl mfs_init()
    111  1.15      fvdl {
    112  1.48  christos #ifdef _LKM
    113  1.48  christos 	malloc_type_attach(M_MFSNODE);
    114  1.48  christos #endif
    115  1.23  jdolecek 	/*
    116  1.23  jdolecek 	 * ffs_init() ensures to initialize necessary resources
    117  1.23  jdolecek 	 * only once.
    118  1.23  jdolecek 	 */
    119  1.23  jdolecek 	ffs_init();
    120  1.35       chs }
    121  1.35       chs 
    122  1.35       chs void
    123  1.35       chs mfs_reinit()
    124  1.35       chs {
    125  1.35       chs 	ffs_reinit();
    126  1.15      fvdl }
    127  1.15      fvdl 
    128  1.23  jdolecek void
    129  1.23  jdolecek mfs_done()
    130  1.23  jdolecek {
    131  1.23  jdolecek 	/*
    132  1.23  jdolecek 	 * ffs_done() ensures to free necessary resources
    133  1.23  jdolecek 	 * only once, when it's no more needed.
    134  1.23  jdolecek 	 */
    135  1.23  jdolecek 	ffs_done();
    136  1.48  christos #ifdef _LKM
    137  1.48  christos 	malloc_type_detach(M_MFSNODE);
    138  1.48  christos #endif
    139  1.23  jdolecek }
    140  1.15      fvdl 
    141   1.1   mycroft /*
    142   1.1   mycroft  * Called by main() when mfs is going to be mounted as root.
    143   1.1   mycroft  */
    144   1.1   mycroft 
    145  1.10  christos int
    146   1.1   mycroft mfs_mountroot()
    147   1.1   mycroft {
    148  1.15      fvdl 	struct fs *fs;
    149  1.15      fvdl 	struct mount *mp;
    150  1.51      fvdl 	struct proc *p = curproc;	/* XXX */
    151   1.1   mycroft 	struct ufsmount *ump;
    152   1.1   mycroft 	struct mfsnode *mfsp;
    153  1.15      fvdl 	int error = 0;
    154   1.1   mycroft 
    155   1.1   mycroft 	/*
    156  1.13       mrg 	 * Get vnodes for rootdev.
    157   1.1   mycroft 	 */
    158  1.15      fvdl 	if (bdevvp(rootdev, &rootvp)) {
    159  1.15      fvdl 		printf("mfs_mountroot: can't setup bdevvp's");
    160  1.15      fvdl 		return (error);
    161  1.15      fvdl 	}
    162  1.15      fvdl 
    163  1.21  wrstuden 	if ((error = vfs_rootmountalloc(MOUNT_MFS, "mfs_root", &mp))) {
    164  1.21  wrstuden 		vrele(rootvp);
    165  1.15      fvdl 		return (error);
    166  1.21  wrstuden 	}
    167   1.1   mycroft 
    168   1.1   mycroft 	mfsp = malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK);
    169   1.1   mycroft 	rootvp->v_data = mfsp;
    170   1.1   mycroft 	rootvp->v_op = mfs_vnodeop_p;
    171   1.1   mycroft 	rootvp->v_tag = VT_MFS;
    172   1.1   mycroft 	mfsp->mfs_baseoff = mfs_rootbase;
    173   1.1   mycroft 	mfsp->mfs_size = mfs_rootsize;
    174   1.1   mycroft 	mfsp->mfs_vnode = rootvp;
    175  1.26   thorpej 	mfsp->mfs_proc = NULL;		/* indicate kernel space */
    176  1.39   hannken 	mfsp->mfs_shutdown = 0;
    177  1.40   hannken 	bufq_alloc(&mfsp->mfs_buflist, BUFQ_FCFS);
    178  1.51      fvdl 	if ((error = ffs_mountfs(rootvp, mp, p)) != 0) {
    179  1.15      fvdl 		mp->mnt_op->vfs_refcount--;
    180  1.15      fvdl 		vfs_unbusy(mp);
    181  1.40   hannken 		bufq_free(&mfsp->mfs_buflist);
    182   1.1   mycroft 		free(mp, M_MOUNT);
    183   1.1   mycroft 		free(mfsp, M_MFSNODE);
    184  1.21  wrstuden 		vrele(rootvp);
    185   1.1   mycroft 		return (error);
    186  1.15      fvdl 	}
    187  1.15      fvdl 	simple_lock(&mountlist_slock);
    188   1.4   mycroft 	CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
    189  1.15      fvdl 	simple_unlock(&mountlist_slock);
    190   1.1   mycroft 	mp->mnt_vnodecovered = NULLVP;
    191   1.1   mycroft 	ump = VFSTOUFS(mp);
    192   1.1   mycroft 	fs = ump->um_fs;
    193  1.15      fvdl 	(void) copystr(mp->mnt_stat.f_mntonname, fs->fs_fsmnt, MNAMELEN - 1, 0);
    194  1.51      fvdl 	(void)ffs_statfs(mp, &mp->mnt_stat, p);
    195  1.15      fvdl 	vfs_unbusy(mp);
    196   1.1   mycroft 	inittodr((time_t)0);
    197   1.1   mycroft 	return (0);
    198   1.1   mycroft }
    199   1.1   mycroft 
    200   1.1   mycroft /*
    201   1.1   mycroft  * This is called early in boot to set the base address and size
    202   1.1   mycroft  * of the mini-root.
    203   1.1   mycroft  */
    204  1.10  christos int
    205   1.1   mycroft mfs_initminiroot(base)
    206   1.1   mycroft 	caddr_t base;
    207   1.1   mycroft {
    208  1.45      fvdl 	struct fs *fs = (struct fs *)(base + SBLOCK_UFS1);
    209   1.1   mycroft 
    210   1.1   mycroft 	/* check for valid super block */
    211  1.45      fvdl 	if (fs->fs_magic != FS_UFS1_MAGIC || fs->fs_bsize > MAXBSIZE ||
    212   1.1   mycroft 	    fs->fs_bsize < sizeof(struct fs))
    213   1.1   mycroft 		return (0);
    214   1.1   mycroft 	mountroot = mfs_mountroot;
    215   1.1   mycroft 	mfs_rootbase = base;
    216   1.1   mycroft 	mfs_rootsize = fs->fs_fsize * fs->fs_size;
    217  1.32       cgd 	rootdev = makedev(255, mfs_minor);
    218  1.32       cgd 	mfs_minor++;
    219   1.1   mycroft 	return (mfs_rootsize);
    220   1.1   mycroft }
    221   1.1   mycroft 
    222   1.1   mycroft /*
    223   1.1   mycroft  * VFS Operations.
    224   1.1   mycroft  *
    225   1.1   mycroft  * mount system call
    226   1.1   mycroft  */
    227   1.1   mycroft /* ARGSUSED */
    228   1.1   mycroft int
    229  1.51      fvdl mfs_mount(mp, path, data, ndp, p)
    230  1.25  augustss 	struct mount *mp;
    231  1.11       cgd 	const char *path;
    232  1.11       cgd 	void *data;
    233   1.1   mycroft 	struct nameidata *ndp;
    234  1.51      fvdl 	struct proc *p;
    235   1.1   mycroft {
    236   1.1   mycroft 	struct vnode *devvp;
    237   1.1   mycroft 	struct mfs_args args;
    238   1.1   mycroft 	struct ufsmount *ump;
    239  1.25  augustss 	struct fs *fs;
    240  1.25  augustss 	struct mfsnode *mfsp;
    241   1.1   mycroft 	int flags, error;
    242  1.37       chs 
    243  1.41  christos 	if (mp->mnt_flag & MNT_GETARGS) {
    244  1.41  christos 		struct vnode *vp;
    245  1.41  christos 		struct mfsnode *mfsp;
    246  1.41  christos 
    247  1.41  christos 		ump = VFSTOUFS(mp);
    248  1.41  christos 		if (ump == NULL)
    249  1.41  christos 			return EIO;
    250  1.41  christos 
    251  1.41  christos 		vp = ump->um_devvp;
    252  1.41  christos 		if (vp == NULL)
    253  1.41  christos 			return EIO;
    254  1.41  christos 
    255  1.41  christos 		mfsp = VTOMFS(vp);
    256  1.41  christos 		if (mfsp == NULL)
    257  1.41  christos 			return EIO;
    258  1.41  christos 
    259  1.41  christos 		args.fspec = NULL;
    260  1.41  christos 		vfs_showexport(mp, &args.export, &ump->um_export);
    261  1.41  christos 		args.base = mfsp->mfs_baseoff;
    262  1.41  christos 		args.size = mfsp->mfs_size;
    263  1.41  christos 		return copyout(&args, data, sizeof(args));
    264  1.41  christos 	}
    265  1.37       chs 	/*
    266  1.37       chs 	 * XXX turn off async to avoid hangs when writing lots of data.
    267  1.37       chs 	 * the problem is that MFS needs to allocate pages to clean pages,
    268  1.37       chs 	 * so if we wait until the last minute to clean pages then there
    269  1.37       chs 	 * may not be any pages available to do the cleaning.
    270  1.42       chs 	 * ... and since the default partially-synchronous mode turns out
    271  1.42       chs 	 * to not be sufficient under heavy load, make it full synchronous.
    272  1.37       chs 	 */
    273  1.37       chs 	mp->mnt_flag &= ~MNT_ASYNC;
    274  1.42       chs 	mp->mnt_flag |= MNT_SYNCHRONOUS;
    275   1.1   mycroft 
    276  1.10  christos 	error = copyin(data, (caddr_t)&args, sizeof (struct mfs_args));
    277  1.10  christos 	if (error)
    278   1.1   mycroft 		return (error);
    279   1.1   mycroft 
    280   1.1   mycroft 	/*
    281   1.1   mycroft 	 * If updating, check whether changing from read-only to
    282   1.1   mycroft 	 * read/write; if there is no device name, that's all we do.
    283   1.1   mycroft 	 */
    284   1.1   mycroft 	if (mp->mnt_flag & MNT_UPDATE) {
    285   1.1   mycroft 		ump = VFSTOUFS(mp);
    286   1.1   mycroft 		fs = ump->um_fs;
    287   1.1   mycroft 		if (fs->fs_ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
    288   1.1   mycroft 			flags = WRITECLOSE;
    289   1.1   mycroft 			if (mp->mnt_flag & MNT_FORCE)
    290   1.1   mycroft 				flags |= FORCECLOSE;
    291  1.51      fvdl 			error = ffs_flushfiles(mp, flags, p);
    292   1.1   mycroft 			if (error)
    293   1.1   mycroft 				return (error);
    294   1.1   mycroft 		}
    295   1.1   mycroft 		if (fs->fs_ronly && (mp->mnt_flag & MNT_WANTRDWR))
    296   1.1   mycroft 			fs->fs_ronly = 0;
    297   1.1   mycroft 		if (args.fspec == 0)
    298   1.1   mycroft 			return (vfs_export(mp, &ump->um_export, &args.export));
    299   1.1   mycroft 		return (0);
    300   1.1   mycroft 	}
    301   1.1   mycroft 	error = getnewvnode(VT_MFS, (struct mount *)0, mfs_vnodeop_p, &devvp);
    302   1.1   mycroft 	if (error)
    303   1.1   mycroft 		return (error);
    304   1.1   mycroft 	devvp->v_type = VBLK;
    305  1.32       cgd 	if (checkalias(devvp, makedev(255, mfs_minor), (struct mount *)0))
    306   1.1   mycroft 		panic("mfs_mount: dup dev");
    307  1.32       cgd 	mfs_minor++;
    308   1.1   mycroft 	mfsp = (struct mfsnode *)malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK);
    309   1.1   mycroft 	devvp->v_data = mfsp;
    310   1.1   mycroft 	mfsp->mfs_baseoff = args.base;
    311   1.1   mycroft 	mfsp->mfs_size = args.size;
    312   1.1   mycroft 	mfsp->mfs_vnode = devvp;
    313  1.26   thorpej 	mfsp->mfs_proc = p;
    314  1.39   hannken 	mfsp->mfs_shutdown = 0;
    315  1.40   hannken 	bufq_alloc(&mfsp->mfs_buflist, BUFQ_FCFS);
    316  1.51      fvdl 	if ((error = ffs_mountfs(devvp, mp, p)) != 0) {
    317  1.39   hannken 		mfsp->mfs_shutdown = 1;
    318   1.1   mycroft 		vrele(devvp);
    319   1.1   mycroft 		return (error);
    320   1.1   mycroft 	}
    321   1.1   mycroft 	ump = VFSTOUFS(mp);
    322   1.1   mycroft 	fs = ump->um_fs;
    323  1.46  christos 	error = set_statfs_info(path, UIO_USERSPACE, args.fspec,
    324  1.51      fvdl 	    UIO_USERSPACE, mp, p);
    325  1.46  christos 	(void)memcpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname,
    326  1.47  christos 	    sizeof(mp->mnt_stat.f_mntonname));
    327  1.46  christos 	return error;
    328   1.1   mycroft }
    329   1.1   mycroft 
    330   1.1   mycroft int	mfs_pri = PWAIT | PCATCH;		/* XXX prob. temp */
    331   1.1   mycroft 
    332   1.1   mycroft /*
    333   1.1   mycroft  * Used to grab the process and keep it in the kernel to service
    334   1.1   mycroft  * memory filesystem I/O requests.
    335   1.1   mycroft  *
    336  1.28   thorpej  * Loop servicing I/O requests.
    337  1.28   thorpej  * Copy the requested data into or out of the memory filesystem
    338  1.28   thorpej  * address space.
    339   1.1   mycroft  */
    340   1.1   mycroft /* ARGSUSED */
    341   1.1   mycroft int
    342  1.51      fvdl mfs_start(mp, flags, p)
    343   1.1   mycroft 	struct mount *mp;
    344   1.1   mycroft 	int flags;
    345  1.51      fvdl 	struct proc *p;
    346   1.1   mycroft {
    347  1.25  augustss 	struct vnode *vp = VFSTOUFS(mp)->um_devvp;
    348  1.25  augustss 	struct mfsnode *mfsp = VTOMFS(vp);
    349  1.28   thorpej 	struct buf *bp;
    350  1.28   thorpej 	caddr_t base;
    351  1.15      fvdl 	int sleepreturn = 0;
    352  1.51      fvdl 	struct lwp *l; /* XXX NJWLWP */
    353   1.1   mycroft 
    354  1.51      fvdl 	/* XXX NJWLWP the vnode interface again gives us a proc in a
    355  1.51      fvdl 	 * place where we want a execution context. Cheat.
    356  1.51      fvdl 	 */
    357  1.51      fvdl 	KASSERT(curproc == p);
    358  1.51      fvdl 	l = curlwp;
    359  1.28   thorpej 	base = mfsp->mfs_baseoff;
    360  1.39   hannken 	while (mfsp->mfs_shutdown != 1) {
    361  1.39   hannken 		while ((bp = BUFQ_GET(&mfsp->mfs_buflist)) != NULL) {
    362  1.30    simonb 			mfs_doio(bp, base);
    363  1.30    simonb 			wakeup((caddr_t)bp);
    364  1.30    simonb 		}
    365   1.1   mycroft 		/*
    366   1.1   mycroft 		 * If a non-ignored signal is received, try to unmount.
    367  1.15      fvdl 		 * If that fails, or the filesystem is already in the
    368  1.15      fvdl 		 * process of being unmounted, clear the signal (it has been
    369  1.15      fvdl 		 * "processed"), otherwise we will loop here, as tsleep
    370  1.15      fvdl 		 * will always return EINTR/ERESTART.
    371   1.1   mycroft 		 */
    372  1.15      fvdl 		if (sleepreturn != 0) {
    373  1.33   thorpej 			/*
    374  1.33   thorpej 			 * XXX Freeze syncer.  Must do this before locking
    375  1.33   thorpej 			 * the mount point.  See dounmount() for details.
    376  1.33   thorpej 			 */
    377  1.33   thorpej 			lockmgr(&syncer_lock, LK_EXCLUSIVE, NULL);
    378  1.33   thorpej 			if (vfs_busy(mp, LK_NOWAIT, 0) != 0)
    379  1.33   thorpej 				lockmgr(&syncer_lock, LK_RELEASE, NULL);
    380  1.51      fvdl 			else if (dounmount(mp, 0, p) != 0)
    381  1.51      fvdl 				CLRSIG(p, CURSIG(l));
    382  1.15      fvdl 			sleepreturn = 0;
    383  1.12      fvdl 			continue;
    384   1.9   mycroft 		}
    385  1.28   thorpej 
    386  1.28   thorpej 		sleepreturn = tsleep(vp, mfs_pri, "mfsidl", 0);
    387   1.1   mycroft 	}
    388  1.39   hannken 	KASSERT(BUFQ_PEEK(&mfsp->mfs_buflist) == NULL);
    389  1.40   hannken 	bufq_free(&mfsp->mfs_buflist);
    390  1.15      fvdl 	return (sleepreturn);
    391   1.1   mycroft }
    392   1.1   mycroft 
    393   1.1   mycroft /*
    394   1.1   mycroft  * Get file system statistics.
    395   1.1   mycroft  */
    396  1.10  christos int
    397  1.51      fvdl mfs_statfs(mp, sbp, p)
    398   1.1   mycroft 	struct mount *mp;
    399   1.1   mycroft 	struct statfs *sbp;
    400  1.51      fvdl 	struct proc *p;
    401   1.1   mycroft {
    402   1.1   mycroft 	int error;
    403   1.1   mycroft 
    404  1.51      fvdl 	error = ffs_statfs(mp, sbp, p);
    405   1.1   mycroft #ifdef COMPAT_09
    406   1.1   mycroft 	sbp->f_type = 3;
    407   1.1   mycroft #else
    408   1.1   mycroft 	sbp->f_type = 0;
    409   1.1   mycroft #endif
    410   1.1   mycroft 	strncpy(&sbp->f_fstypename[0], mp->mnt_op->vfs_name, MFSNAMELEN);
    411   1.1   mycroft 	return (error);
    412   1.1   mycroft }
    413