diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-03-16 19:42:58 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2008-03-16 19:42:58 +0000 |
commit | d4545e818f0707235e329a03a45dae9d48d70808 (patch) | |
tree | 31f7d6172379994f72e216732c09176657d6ddb1 /sys/nfs | |
parent | 84746867a9863df603adc37bc169855703df4c5b (diff) |
Widen some struct statfs fields to support large filesystem stata
and add some to be able to support statvfs(2). Do the compat dance
to provide backward compatibility. ok thib@ miod@
Diffstat (limited to 'sys/nfs')
-rw-r--r-- | sys/nfs/nfs_serv.c | 13 | ||||
-rw-r--r-- | sys/nfs/nfs_vfsops.c | 28 |
2 files changed, 19 insertions, 22 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 53de291d927..c545fba06ba 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_serv.c,v 1.48 2008/01/06 17:38:23 blambert Exp $ */ +/* $OpenBSD: nfs_serv.c,v 1.49 2008/03/16 19:42:57 otto Exp $ */ /* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */ /* @@ -3061,12 +3061,11 @@ nfsrv_statfs(nfsd, slp, procp, mrq) tval = (u_quad_t)sf->f_bavail; tval *= (u_quad_t)sf->f_bsize; txdr_hyper(tval, &sfp->sf_abytes); - sfp->sf_tfiles.nfsuquad[0] = 0; - sfp->sf_tfiles.nfsuquad[1] = txdr_unsigned(sf->f_files); - sfp->sf_ffiles.nfsuquad[0] = 0; - sfp->sf_ffiles.nfsuquad[1] = txdr_unsigned(sf->f_ffree); - sfp->sf_afiles.nfsuquad[0] = 0; - sfp->sf_afiles.nfsuquad[1] = txdr_unsigned(sf->f_ffree); + tval = (u_quad_t)sf->f_files; + txdr_hyper(tval, &sfp->sf_tfiles); + tval = (u_quad_t)sf->f_ffree; + txdr_hyper(tval, &sfp->sf_ffiles); + txdr_hyper(tval, &sfp->sf_afiles); sfp->sf_invarsec = 0; } else { sfp->sf_tsize = txdr_unsigned(NFS_MAXDGRAMDATA); diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index 81acebb6371..a04ca7f69fe 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.69 2008/01/06 18:38:32 deraadt Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.70 2008/03/16 19:42:57 otto Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -46,6 +46,7 @@ #include <sys/mount.h> #include <sys/buf.h> #include <sys/mbuf.h> +#include <sys/dirent.h> #include <sys/socket.h> #include <sys/socketvar.h> #include <sys/systm.h> @@ -145,15 +146,18 @@ nfs_statfs(mp, sbp, p) if (v3) { sbp->f_bsize = NFS_FABLKSIZE; tquad = fxdr_hyper(&sfp->sf_tbytes); - sbp->f_blocks = (u_int32_t)(tquad / (u_quad_t)NFS_FABLKSIZE); + sbp->f_blocks = tquad / (u_quad_t)NFS_FABLKSIZE; tquad = fxdr_hyper(&sfp->sf_fbytes); - sbp->f_bfree = (u_int32_t)(tquad / (u_quad_t)NFS_FABLKSIZE); + sbp->f_bfree = tquad / (u_quad_t)NFS_FABLKSIZE; tquad = fxdr_hyper(&sfp->sf_abytes); - sbp->f_bavail = (int32_t)((quad_t)tquad / (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); + sbp->f_bavail = (quad_t)tquad / (quad_t)NFS_FABLKSIZE; + + tquad = fxdr_hyper(&sfp->sf_tfiles); + sbp->f_files = tquad; + tquad = fxdr_hyper(&sfp->sf_ffiles); + sbp->f_ffree = tquad; + sbp->f_favail = tquad; + sbp->f_namemax = MAXNAMLEN; } else { sbp->f_bsize = fxdr_unsigned(int32_t, sfp->sf_bsize); sbp->f_blocks = fxdr_unsigned(int32_t, sfp->sf_blocks); @@ -162,13 +166,7 @@ nfs_statfs(mp, sbp, p) 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); - bcopy(&mp->mnt_stat.mount_info.nfs_args, - &sbp->mount_info.nfs_args, sizeof(struct nfs_args)); - } - strncpy(&sbp->f_fstypename[0], mp->mnt_vfc->vfc_name, MFSNAMELEN); + copy_statfs_info(sbp, mp); m_freem(mrep); nfsmout: vrele(vp); |