sbp->f_iosize = NFS_MAXDGRAMDATA; sbp->f_bsize = fxdr_unsigned(int32_t, sfp->sf_bsize); sbp->f_blocks = fxdr_unsigned(int32_t, sfp->sf_blocks); sbp->f_bfree = fxdr_unsigned(int32_t, sfp->sf_bfree); sbp->f_bavail = fxdr_unsigned(int32_t, sfp->sf_bavail); if (isnq) { sbp->f_files = fxdr_unsigned(int32_t, sfp->sf_files); sbp->f_ffree = fxdr_unsigned(int32_t, sfp->sf_ffree);
sbp->f_iosize = min(nmp->nm_rsize, nmp->nm_wsize); if (v3) { sbp->f_bsize = NFS_FABLKSIZE; fxdr_hyper(&sfp->sf_tbytes, &tquad); sbp->f_blocks = (long)(tquad / ((u_quad_t)NFS_FABLKSIZE)); fxdr_hyper(&sfp->sf_fbytes, &tquad); sbp->f_bfree = (long)(tquad / ((u_quad_t)NFS_FABLKSIZE)); fxdr_hyper(&sfp->sf_abytes, &tquad); sbp->f_bavail = (long)(tquad / ((u_quad_t)NFS_FABLKSIZE)); sbp->f_files = (fxdr_unsigned(int32_t, sfp->sf_tfiles.nfsuquad[1]) & 0x7fffffff); sbp->f_ffree = (fxdr_unsigned(int32_t, sfp->sf_ffiles.nfsuquad[1]) & 0x7fffffff);
nfs_statfs(mp, sbp, p)	struct mount *mp;	register struct statfs *sbp;	struct proc *p;{	register struct vnode *vp;	register struct nfsv2_statfs *sfp;	register caddr_t cp;	register int32_t t1;	caddr_t bpos, dpos, cp2;	int error = 0, isnq;	struct mbuf *mreq, *mrep, *md, *mb, *mb2;	struct nfsmount *nmp;	struct ucred *cred;	struct nfsnode *np;	nmp = VFSTONFS(mp);	isnq = (nmp->nm_flag & NFSMNT_NQNFS);	if ((error = nfs_nget(mp, &nmp->nm_fh, &np)) != 0)		return (error);	vp = NFSTOV(np);	nfsstats.rpccnt[NFSPROC_STATFS]++;	cred = crget();	cred->cr_ngroups = 0;	nfsm_reqhead(vp, NFSPROC_STATFS, NFSX_FH);	nfsm_fhtom(vp);	nfsm_request(vp, NFSPROC_STATFS, p, cred);	nfsm_dissect(sfp, struct nfsv2_statfs *, NFSX_STATFS(isnq));#ifdef COMPAT_09	sbp->f_type = 2;#else	sbp->f_type = 0;#endif	sbp->f_flags = nmp->nm_flag;	sbp->f_iosize = NFS_MAXDGRAMDATA;	sbp->f_bsize = fxdr_unsigned(int32_t, sfp->sf_bsize);	sbp->f_blocks = fxdr_unsigned(int32_t, sfp->sf_blocks);	sbp->f_bfree = fxdr_unsigned(int32_t, sfp->sf_bfree);	sbp->f_bavail = fxdr_unsigned(int32_t, sfp->sf_bavail);	if (isnq) {		sbp->f_files = fxdr_unsigned(int32_t, sfp->sf_files);		sbp->f_ffree = fxdr_unsigned(int32_t, sfp->sf_ffree);	} else {		sbp->f_files = 0;		sbp->f_ffree = 0;	}	if (sbp != &mp->mnt_stat) {		bcopy(mp->mnt_stat.f_mntonname, sbp->f_mntonname, MNAMELEN);		bcopy(mp->mnt_stat.f_mntfromname, sbp->f_mntfromname, MNAMELEN);	}	strncpy(&sbp->f_fstypename[0], mp->mnt_op->vfs_name, MFSNAMELEN);	nfsm_reqdone;	vrele(vp);	crfree(cred);	return (error);}