diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2007-11-28 19:27:44 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2007-11-28 19:27:44 +0000 |
commit | a6f3a14f1ab9221b73fae61077d5a90c0adcd819 (patch) | |
tree | 88f023a7ab32fca5d4517cef52937f3bdeaa9fb7 | |
parent | 7235e1808acd12de480dcaa9fd3310099d822fc9 (diff) |
fill the va_blocksize with something a litte saner,
make stat(2) return st_blocksize thats a bit closer
to reality.
From NetBSD;
OK art@, beck@, tedu@
-rw-r--r-- | sys/nfs/nfs_subs.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index 624165d7f07..8f97da63297 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.66 2007/11/05 21:18:56 thib Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.67 2007/11/28 19:27:43 thib Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -1136,12 +1136,23 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) vap->va_rdev = (dev_t)rdev; vap->va_mtime = mtime; vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0]; + switch (vtyp) { + case VBLK: + vap->va_blocksize = BLKDEV_IOSIZE; + break; + case VCHR: + vap->va_blocksize = MAXBSIZE; + break; + default: + vap->va_blocksize = v3 ? vp->v_mount->mnt_stat.f_iosize : + fxdr_unsigned(int32_t, fp->fa2_blocksize); + break; + } if (v3) { vap->va_nlink = fxdr_unsigned(nlink_t, fp->fa_nlink); vap->va_uid = fxdr_unsigned(uid_t, fp->fa_uid); vap->va_gid = fxdr_unsigned(gid_t, fp->fa_gid); vap->va_size = fxdr_hyper(&fp->fa3_size); - vap->va_blocksize = NFS_FABLKSIZE; vap->va_bytes = fxdr_hyper(&fp->fa3_used); vap->va_fileid = fxdr_unsigned(int32_t, fp->fa3_fileid.nfsuquad[1]); @@ -1154,7 +1165,6 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper) vap->va_uid = fxdr_unsigned(uid_t, fp->fa_uid); vap->va_gid = fxdr_unsigned(gid_t, fp->fa_gid); vap->va_size = fxdr_unsigned(u_int32_t, fp->fa2_size); - vap->va_blocksize = fxdr_unsigned(int32_t, fp->fa2_blocksize); vap->va_bytes = (u_quad_t)fxdr_unsigned(int32_t, fp->fa2_blocks) * NFS_FABLKSIZE; |