nwfs_vfsops.c revision 132023
151852Sbp/*
266539Sbp * Copyright (c) 1999, 2000 Boris Popov
351852Sbp * All rights reserved.
451852Sbp *
551852Sbp * Redistribution and use in source and binary forms, with or without
651852Sbp * modification, are permitted provided that the following conditions
751852Sbp * are met:
851852Sbp * 1. Redistributions of source code must retain the above copyright
951852Sbp *    notice, this list of conditions and the following disclaimer.
1051852Sbp * 2. Redistributions in binary form must reproduce the above copyright
1151852Sbp *    notice, this list of conditions and the following disclaimer in the
1251852Sbp *    documentation and/or other materials provided with the distribution.
1351852Sbp * 3. All advertising materials mentioning features or use of this software
1451852Sbp *    must display the following acknowledgement:
1551852Sbp *    This product includes software developed by Boris Popov.
1651852Sbp * 4. Neither the name of the author nor the names of any co-contributors
1751852Sbp *    may be used to endorse or promote products derived from this software
1851852Sbp *    without specific prior written permission.
1951852Sbp *
2051852Sbp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2151852Sbp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2251852Sbp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2351852Sbp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2451852Sbp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2551852Sbp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2651852Sbp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2751852Sbp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2851852Sbp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2951852Sbp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3051852Sbp * SUCH DAMAGE.
3151852Sbp *
3251852Sbp * $FreeBSD: head/sys/fs/nwfs/nwfs_vfsops.c 132023 2004-07-12 08:14:09Z alfred $
3351852Sbp */
3451852Sbp#include "opt_ncp.h"
3551852Sbp#ifndef NCP
3651852Sbp#error "NWFS requires NCP protocol"
3751852Sbp#endif
3851852Sbp
3951852Sbp#include <sys/param.h>
4051852Sbp#include <sys/systm.h>
4151852Sbp#include <sys/proc.h>
4251852Sbp#include <sys/kernel.h>
4351852Sbp#include <sys/sysctl.h>
4451852Sbp#include <sys/vnode.h>
4551852Sbp#include <sys/mount.h>
4651852Sbp#include <sys/stat.h>
4751852Sbp#include <sys/malloc.h>
4860041Sphk#include <sys/bio.h>
4951852Sbp#include <sys/buf.h>
5051852Sbp
5151852Sbp#include <netncp/ncp.h>
5251852Sbp#include <netncp/ncp_conn.h>
5351852Sbp#include <netncp/ncp_subr.h>
5451852Sbp#include <netncp/ncp_ncp.h>
5551852Sbp#include <netncp/ncp_nls.h>
5651852Sbp
5777223Sru#include <fs/nwfs/nwfs.h>
5877223Sru#include <fs/nwfs/nwfs_node.h>
5977223Sru#include <fs/nwfs/nwfs_subr.h>
6051852Sbp
6151852Sbpint nwfs_debuglevel = 0;
6251852Sbp
6351852Sbpstatic int nwfs_version = NWFS_VERSION;
6451852Sbp
6551852SbpSYSCTL_DECL(_vfs_nwfs);
6696755StrhodesSYSCTL_NODE(_vfs, OID_AUTO, nwfs, CTLFLAG_RW, 0, "Netware filesystem");
6751852SbpSYSCTL_INT(_vfs_nwfs, OID_AUTO, version, CTLFLAG_RD, &nwfs_version, 0, "");
6851852SbpSYSCTL_INT(_vfs_nwfs, OID_AUTO, debuglevel, CTLFLAG_RW, &nwfs_debuglevel, 0, "");
6951852Sbp
7059755SpeterMODULE_DEPEND(nwfs, ncp, 1, 1, 1);
7174637SbpMODULE_DEPEND(nwfs, libmchain, 1, 1, 1);
7259755Speter
73116271Sphkstatic vfs_mount_t	nwfs_mount;
74116271Sphkstatic vfs_quotactl_t	nwfs_quotactl;
75116271Sphkstatic vfs_root_t	nwfs_root;
76116271Sphkstatic vfs_start_t	nwfs_start;
77116271Sphkstatic vfs_statfs_t	nwfs_statfs;
78116271Sphkstatic vfs_unmount_t	nwfs_unmount;
79116271Sphkstatic vfs_init_t	nwfs_init;
80116271Sphkstatic vfs_uninit_t	nwfs_uninit;
8151852Sbp
8251852Sbpstatic struct vfsops nwfs_vfsops = {
83116271Sphk	.vfs_init =		nwfs_init,
84116271Sphk	.vfs_mount =		nwfs_mount,
85116271Sphk	.vfs_quotactl =		nwfs_quotactl,
86116271Sphk	.vfs_root =		nwfs_root,
87116271Sphk	.vfs_start =		nwfs_start,
88116271Sphk	.vfs_statfs =		nwfs_statfs,
89116271Sphk	.vfs_sync =		vfs_stdsync,
90116271Sphk	.vfs_uninit =		nwfs_uninit,
91116271Sphk	.vfs_unmount =		nwfs_unmount,
9251852Sbp};
9351852Sbp
9451852Sbp
9551852SbpVFS_SET(nwfs_vfsops, nwfs, VFCF_NETWORK);
9651852Sbp
9751852Sbpint nwfs_pbuf_freecnt = -1;	/* start out unlimited */
9851852Sbpstatic int nwfsid = 1;
9951852Sbp
10051852Sbpstatic int
10151852Sbpnwfs_initnls(struct nwmount *nmp) {
10251852Sbp	char	*pc, *pe;
10351852Sbp	int	error = 0;
10451852Sbp#define COPY_TABLE(t,d)	{ \
10551852Sbp		if (t) { \
10651852Sbp			error = copyin((t), pc, 256); \
10751852Sbp			if (error) break; \
10851852Sbp		} else \
10951852Sbp			bcopy(d, pc, 256); \
11051852Sbp		(t) = pc; pc += 256; \
11151852Sbp	}
11251852Sbp
11351852Sbp	nmp->m.nls.opt |= NWHP_NLS | NWHP_DOS;
11451852Sbp	if ((nmp->m.flags & NWFS_MOUNT_HAVE_NLS) == 0) {
11552814Sarchie		nmp->m.nls.to_lower = ncp_defnls.to_lower;
11652814Sarchie		nmp->m.nls.to_upper = ncp_defnls.to_upper;
11751852Sbp		nmp->m.nls.n2u = ncp_defnls.n2u;
11851852Sbp		nmp->m.nls.u2n = ncp_defnls.u2n;
11951852Sbp		return 0;
12051852Sbp	}
121111119Simp	MALLOC(pe, char *, 256 * 4, M_NWFSDATA, M_WAITOK);
12251852Sbp	pc = pe;
12351852Sbp	do {
12452814Sarchie		COPY_TABLE(nmp->m.nls.to_lower, ncp_defnls.to_lower);
12552814Sarchie		COPY_TABLE(nmp->m.nls.to_upper, ncp_defnls.to_upper);
12651852Sbp		COPY_TABLE(nmp->m.nls.n2u, ncp_defnls.n2u);
12751852Sbp		COPY_TABLE(nmp->m.nls.u2n, ncp_defnls.u2n);
12851852Sbp	} while(0);
12951852Sbp	if (error) {
13051852Sbp		free(pe, M_NWFSDATA);
13151852Sbp		return error;
13251852Sbp	}
13351852Sbp	return 0;
13451852Sbp}
13551852Sbp/*
13651852Sbp * mp - path - addr in user space of mount point (ie /usr or whatever)
13751852Sbp * data - addr in user space of mount params
13851852Sbp */
13951852Sbpstatic int nwfs_mount(struct mount *mp, char *path, caddr_t data,
14083366Sjulian		      struct nameidata *ndp, struct thread *td)
14151852Sbp{
14251852Sbp	struct nwfs_args args; 	  /* will hold data from mount request */
14351852Sbp	int error;
14451852Sbp	struct nwmount *nmp = NULL;
14551852Sbp	struct ncp_conn *conn = NULL;
14651852Sbp	struct ncp_handle *handle = NULL;
14751852Sbp	struct vnode *vp;
14851852Sbp	char *pc,*pe;
14951852Sbp
15051852Sbp	if (data == NULL) {
15151852Sbp		nwfs_printf("missing data argument\n");
15251852Sbp		return 1;
15351852Sbp	}
15451852Sbp	if (mp->mnt_flag & MNT_UPDATE) {
15551852Sbp		nwfs_printf("MNT_UPDATE not implemented");
15651852Sbp		return (EOPNOTSUPP);
15751852Sbp	}
15851852Sbp	error = copyin(data, (caddr_t)&args, sizeof(struct nwfs_args));
15951852Sbp	if (error)
16051852Sbp		return (error);
16151852Sbp	if (args.version != NWFS_VERSION) {
16251852Sbp		nwfs_printf("mount version mismatch: kernel=%d, mount=%d\n",NWFS_VERSION,args.version);
16351852Sbp		return (1);
16451852Sbp	}
16591406Sjhb	error = ncp_conn_getbyref(args.connRef, td , td->td_ucred,NCPM_EXECUTE,&conn);
16651852Sbp	if (error) {
16751852Sbp		nwfs_printf("invalid connection refernce %d\n",args.connRef);
16851852Sbp		return (error);
16951852Sbp	}
17051852Sbp	error = ncp_conn_gethandle(conn, NULL, &handle);
17151852Sbp	if (error) {
17251852Sbp		nwfs_printf("can't get connection handle\n");
17351852Sbp		return (error);
17451852Sbp	}
17583366Sjulian	ncp_conn_unlock(conn, td);	/* we keep the ref */
17651852Sbp	mp->mnt_stat.f_iosize = conn->buffer_size;
17751852Sbp        /* We must malloc our own mount info */
178112916Stjr        MALLOC(nmp,struct nwmount *,sizeof(struct nwmount),M_NWFSDATA,
179112916Stjr	    M_WAITOK | M_USE_RESERVE | M_ZERO);
18051852Sbp        if (nmp == NULL) {
18151852Sbp                nwfs_printf("could not alloc nwmount\n");
18251852Sbp                error = ENOMEM;
18351852Sbp		goto bad;
18451852Sbp        }
18551852Sbp        mp->mnt_data = (qaddr_t)nmp;
18651852Sbp	nmp->connh = handle;
18751852Sbp	nmp->n_root = NULL;
18851852Sbp	nmp->n_id = nwfsid++;
18951852Sbp        nmp->m = args;
19051852Sbp	nmp->m.file_mode = (nmp->m.file_mode &
19151852Sbp			    (S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFREG;
19251852Sbp	nmp->m.dir_mode  = (nmp->m.dir_mode &
19351852Sbp			    (S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFDIR;
19451852Sbp	if ((error = nwfs_initnls(nmp)) != 0) goto bad;
19551852Sbp	pc = mp->mnt_stat.f_mntfromname;
19651852Sbp	pe = pc+sizeof(mp->mnt_stat.f_mntfromname);
19751852Sbp	bzero(pc, MNAMELEN);
19851852Sbp	*(pc++) = '/';
19951852Sbp	pc = index(strncpy(pc, conn->li.server, pe-pc-2),0);
20051852Sbp	if (pc < pe-1) {
20151852Sbp		*(pc++) = ':';
20251852Sbp		pc=index(strncpy(pc, conn->li.user, pe-pc-2),0);
20351852Sbp		if (pc < pe-1) {
20451852Sbp			*(pc++) = '/';
20551852Sbp			strncpy(pc, nmp->m.mounted_vol, pe-pc-2);
20651852Sbp		}
20751852Sbp	}
20851852Sbp	/* protect against invalid mount points */
20951852Sbp	nmp->m.mount_point[sizeof(nmp->m.mount_point)-1] = '\0';
21051852Sbp	vfs_getnewfsid(mp);
211132023Salfred	error = nwfs_root(mp, &vp, td);
21251852Sbp	if (error)
21351852Sbp		goto bad;
21451852Sbp	/*
21551852Sbp	 * Lose the lock but keep the ref.
21651852Sbp	 */
21783366Sjulian	VOP_UNLOCK(vp, 0, curthread);
218103936Sjeff	NCPVODEBUG("rootvp.vrefcnt=%d\n",vrefcnt(vp));
21951852Sbp	return error;
22051852Sbpbad:
22151852Sbp        if (nmp)
22251852Sbp		free(nmp, M_NWFSDATA);
22351852Sbp	if (handle)
22451852Sbp		ncp_conn_puthandle(handle, NULL, 0);
22551852Sbp        return error;
22651852Sbp}
22751852Sbp
22851852Sbp/* Unmount the filesystem described by mp. */
22951852Sbpstatic int
23083366Sjuliannwfs_unmount(struct mount *mp, int mntflags, struct thread *td)
23151852Sbp{
23251852Sbp	struct nwmount *nmp = VFSTONWFS(mp);
23351852Sbp	struct ncp_conn *conn;
23451852Sbp	int error, flags;
23551852Sbp
23651852Sbp	NCPVODEBUG("nwfs_unmount: flags=%04x\n",mntflags);
23751852Sbp	flags = 0;
23851852Sbp	if (mntflags & MNT_FORCE)
23951852Sbp		flags |= FORCECLOSE;
24076688Siedowse	/* There is 1 extra root vnode reference from nwfs_mount(). */
241132023Salfred	error = vflush(mp, 1, flags, td);
24276688Siedowse	if (error)
24351852Sbp		return (error);
24451852Sbp	conn = NWFSTOCONN(nmp);
24551852Sbp	ncp_conn_puthandle(nmp->connh,NULL,0);
24691406Sjhb	if (ncp_conn_lock(conn, td, td->td_ucred,NCPM_WRITE | NCPM_EXECUTE) == 0) {
24774062Sbp		if(ncp_conn_free(conn))
24883366Sjulian			ncp_conn_unlock(conn, td);
24951852Sbp	}
25051852Sbp	mp->mnt_data = (qaddr_t)0;
25151852Sbp	if (nmp->m.flags & NWFS_MOUNT_HAVE_NLS)
25252814Sarchie		free(nmp->m.nls.to_lower, M_NWFSDATA);
25351852Sbp	free(nmp, M_NWFSDATA);
25451852Sbp	mp->mnt_flag &= ~MNT_LOCAL;
25551852Sbp	return (error);
25651852Sbp}
25751852Sbp
25851852Sbp/*  Return locked vnode to root of a filesystem */
25951852Sbpstatic int
260132023Salfrednwfs_root(struct mount *mp, struct vnode **vpp, struct thread *td) {
26151852Sbp	struct vnode *vp;
26251852Sbp	struct nwmount *nmp;
26351852Sbp	struct nwnode *np;
26451852Sbp	struct ncp_conn *conn;
26551852Sbp	struct nw_entry_info fattr;
26691406Sjhb	struct ucred *cred =  td->td_ucred;
26751852Sbp	int error, nsf, opt;
26851852Sbp	u_char vol;
26951852Sbp
27051852Sbp	nmp = VFSTONWFS(mp);
27151852Sbp	conn = NWFSTOCONN(nmp);
27251852Sbp	if (nmp->n_root) {
27351852Sbp		*vpp = NWTOV(nmp->n_root);
27483366Sjulian		while (vget(*vpp, LK_EXCLUSIVE, curthread) != 0)
27566540Sbp			;
27651852Sbp		return 0;
27751852Sbp	}
27851852Sbp	error = ncp_lookup_volume(conn, nmp->m.mounted_vol, &vol,
27983366Sjulian		&nmp->n_rootent.f_id, td, cred);
28051852Sbp	if (error)
28151852Sbp		return ENOENT;
28251852Sbp	nmp->n_volume = vol;
28383366Sjulian	error = ncp_get_namespaces(conn, vol, &nsf, td, cred);
28451852Sbp	if (error)
28551852Sbp		return ENOENT;
28651852Sbp	if (nsf & NW_NSB_OS2) {
28751852Sbp		NCPVODEBUG("volume %s has os2 namespace\n",nmp->m.mounted_vol);
28851852Sbp		if ((nmp->m.flags & NWFS_MOUNT_NO_OS2) == 0) {
28951852Sbp			nmp->name_space = NW_NS_OS2;
29051852Sbp			nmp->m.nls.opt &= ~NWHP_DOS;
29151852Sbp		}
29251852Sbp	}
29351852Sbp	opt = nmp->m.nls.opt;
29451852Sbp	nsf = opt & (NWHP_UPPER | NWHP_LOWER);
29551852Sbp	if (opt & NWHP_DOS) {
29651852Sbp		if (nsf == (NWHP_UPPER | NWHP_LOWER)) {
29751852Sbp			nmp->m.nls.opt &= ~(NWHP_LOWER | NWHP_UPPER);
29851852Sbp		} else if (nsf == 0) {
29951852Sbp			nmp->m.nls.opt |= NWHP_LOWER;
30051852Sbp		}
30151852Sbp	} else {
30251852Sbp		if (nsf == (NWHP_UPPER | NWHP_LOWER)) {
30351852Sbp			nmp->m.nls.opt &= ~(NWHP_LOWER | NWHP_UPPER);
30451852Sbp		}
30551852Sbp	}
30651852Sbp	if (nmp->m.root_path[0]) {
30751852Sbp		nmp->m.root_path[0]--;
30851852Sbp		error = ncp_obtain_info(nmp, nmp->n_rootent.f_id,
30983366Sjulian		    -nmp->m.root_path[0], nmp->m.root_path, &fattr, td, cred);
31051852Sbp		if (error) {
31151852Sbp			NCPFATAL("Invalid root path specified\n");
31251852Sbp			return ENOENT;
31351852Sbp		}
31451852Sbp		nmp->n_rootent.f_parent = fattr.dirEntNum;
31551852Sbp		nmp->m.root_path[0]++;
31651852Sbp		error = ncp_obtain_info(nmp, nmp->n_rootent.f_id,
31783366Sjulian		    -nmp->m.root_path[0], nmp->m.root_path, &fattr, td, cred);
31851852Sbp		if (error) {
31951852Sbp			NCPFATAL("Invalid root path specified\n");
32051852Sbp			return ENOENT;
32151852Sbp		}
32251852Sbp		nmp->n_rootent.f_id = fattr.dirEntNum;
32351852Sbp	} else {
32451852Sbp		error = ncp_obtain_info(nmp, nmp->n_rootent.f_id,
32583366Sjulian		    0, NULL, &fattr, td, cred);
32651852Sbp		if (error) {
32751852Sbp			NCPFATAL("Can't obtain volume info\n");
32851852Sbp			return ENOENT;
32951852Sbp		}
33074064Sbp		fattr.nameLen = strlen(strcpy(fattr.entryName, "#.ROOT"));
33151852Sbp		nmp->n_rootent.f_parent = nmp->n_rootent.f_id;
33251852Sbp	}
33351852Sbp	error = nwfs_nget(mp, nmp->n_rootent, &fattr, NULL, &vp);
33451852Sbp	if (error)
33551852Sbp		return (error);
336101308Sjeff	vp->v_vflag |= VV_ROOT;
33751852Sbp	np = VTONW(vp);
33851852Sbp	if (nmp->m.root_path[0] == 0)
33951852Sbp		np->n_flag |= NVOLUME;
34051852Sbp	nmp->n_root = np;
34183366Sjulian/*	error = VOP_GETATTR(vp, &vattr, cred, td);
34251852Sbp	if (error) {
34351852Sbp		vput(vp);
34451852Sbp		NCPFATAL("Can't get root directory entry\n");
34551852Sbp		return error;
34651852Sbp	}*/
34751852Sbp	*vpp = vp;
34851852Sbp	return (0);
34951852Sbp}
35051852Sbp
35151852Sbp/*
35251852Sbp * Vfs start routine, a no-op.
35351852Sbp */
35451852Sbp/* ARGSUSED */
35551852Sbpstatic int
35683366Sjuliannwfs_start(mp, flags, td)
35751852Sbp	struct mount *mp;
35851852Sbp	int flags;
35983366Sjulian	struct thread *td;
36051852Sbp{
36151852Sbp	NCPVODEBUG("flags=%04x\n",flags);
36251852Sbp	return (0);
36351852Sbp}
36451852Sbp
36551852Sbp/*
36651852Sbp * Do operations associated with quotas, not supported
36751852Sbp */
36851852Sbp/* ARGSUSED */
36951852Sbpstatic int
37083366Sjuliannwfs_quotactl(mp, cmd, uid, arg, td)
37151852Sbp	struct mount *mp;
37251852Sbp	int cmd;
37351852Sbp	uid_t uid;
37451852Sbp	caddr_t arg;
37583366Sjulian	struct thread *td;
37651852Sbp{
37751852Sbp	NCPVODEBUG("return EOPNOTSUPP\n");
37851852Sbp	return (EOPNOTSUPP);
37951852Sbp}
38051852Sbp
38151852Sbp/*ARGSUSED*/
38251852Sbpint
38351852Sbpnwfs_init(struct vfsconf *vfsp)
38451852Sbp{
38551852Sbp	nwfs_hash_init();
38651852Sbp	nwfs_pbuf_freecnt = nswbuf / 2 + 1;
38751852Sbp	NCPVODEBUG("always happy to load!\n");
38851852Sbp	return (0);
38951852Sbp}
39051852Sbp
39151852Sbp/*ARGSUSED*/
39251852Sbpint
39351852Sbpnwfs_uninit(struct vfsconf *vfsp)
39451852Sbp{
39551852Sbp
39651852Sbp	nwfs_hash_free();
39751852Sbp	NCPVODEBUG("unloaded\n");
39851852Sbp	return (0);
39951852Sbp}
40051852Sbp
40151852Sbp/*
40251852Sbp * nwfs_statfs call
40351852Sbp */
40451852Sbpint
40583366Sjuliannwfs_statfs(mp, sbp, td)
40651852Sbp	struct mount *mp;
40766539Sbp	struct statfs *sbp;
40883366Sjulian	struct thread *td;
40951852Sbp{
41051852Sbp	struct nwmount *nmp = VFSTONWFS(mp);
41151852Sbp	int error = 0, secsize;
41251852Sbp	struct nwnode *np = nmp->n_root;
41351852Sbp	struct ncp_volume_info vi;
41451852Sbp
41551852Sbp	if (np == NULL) return EINVAL;
41683366Sjulian	error = ncp_get_volume_info_with_number(NWFSTOCONN(nmp),
41791406Sjhb	    nmp->n_volume, &vi, td, td->td_ucred);
41851852Sbp	if (error) return error;
41951852Sbp	secsize = 512;			/* XXX how to get real value ??? */
42096755Strhodes	/* fundamental filesystem block size */
42151852Sbp	sbp->f_bsize = vi.sectors_per_block*secsize;
42251852Sbp	/* optimal transfer block size */
42351852Sbp	sbp->f_iosize = NWFSTOCONN(nmp)->buffer_size;
42496755Strhodes	/* total data blocks in filesystem */
42551852Sbp	sbp->f_blocks= vi.total_blocks;
42651852Sbp	/* free blocks in fs */
42751852Sbp	sbp->f_bfree = vi.free_blocks + vi.purgeable_blocks;
42851852Sbp	/* free blocks avail to non-superuser */
42951852Sbp	sbp->f_bavail= vi.free_blocks+vi.purgeable_blocks;
43096755Strhodes	/* total file nodes in filesystem */
43151852Sbp	sbp->f_files = vi.total_dir_entries;
43251852Sbp	/* free file nodes in fs */
43351852Sbp	sbp->f_ffree = vi.available_dir_entries;
43451852Sbp	sbp->f_flags = 0;		/* copy of mount exported flags */
43551852Sbp	if (sbp != &mp->mnt_stat) {
43696755Strhodes		sbp->f_fsid = mp->mnt_stat.f_fsid;	/* filesystem id */
43751852Sbp		sbp->f_owner = mp->mnt_stat.f_owner;	/* user that mounted the filesystem */
43851852Sbp		sbp->f_type = mp->mnt_vfc->vfc_typenum;	/* type of filesystem */
43951852Sbp		bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);
44051852Sbp		bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);
44151852Sbp	}
44251852Sbp	strncpy(sbp->f_fstypename, mp->mnt_vfc->vfc_name, MFSNAMELEN);
44351852Sbp	return 0;
44451852Sbp}
445