diff options
author | John Baldwin <jhb@FreeBSD.org> | 2007-08-28 20:28:12 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2007-08-28 20:28:12 +0000 |
commit | cc479dda4a663966637549f429020e002458ef3d (patch) | |
tree | 6c90a59f892dc8f1d97e9a4c9dbc5d141cf5adfa /sys/compat/freebsd32 | |
parent | 0e6ed4feab627360a69a484a8c077b6296a59703 (diff) |
Rework the routines to convert a 5.x+ statfs structure (with fixed-size
64-bit counters) to a 4.x statfs structure (with long-sized counters).
- For block counters, we scale up the block size sufficiently large so
that the resulting block counts fit into a the long-sized (long for the
ABI, so 32-bit in freebsd32) counters. In 4.x the NFS client's statfs
VOP did this already. This can lie about the block size to 4.x binaries,
but it presents a more accurate picture of the ratios of free and
available space.
- For non-block counters, fix the freebsd32 stats converter to cap the
values at INT32_MAX rather than losing the upper 32-bits to match the
behavior of the 4.x statfs conversion routine in vfs_syscalls.c
Approved by: re (kensmith)
Notes
Notes:
svn path=/head/; revision=172003
Diffstat (limited to 'sys/compat/freebsd32')
-rw-r--r-- | sys/compat/freebsd32/freebsd32_misc.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index f99edc9eecc7..97397883e8e4 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -135,28 +135,28 @@ freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap) static void copy_statfs(struct statfs *in, struct statfs32 *out) { - + + statfs_scale_blocks(in, INT32_MAX); bzero(out, sizeof(*out)); CP(*in, *out, f_bsize); - CP(*in, *out, f_iosize); + out->f_iosize = MIN(in->f_iosize, INT32_MAX); CP(*in, *out, f_blocks); CP(*in, *out, f_bfree); CP(*in, *out, f_bavail); - CP(*in, *out, f_files); - CP(*in, *out, f_ffree); + out->f_files = MIN(in->f_files, INT32_MAX); + out->f_ffree = MIN(in->f_ffree, INT32_MAX); CP(*in, *out, f_fsid); CP(*in, *out, f_owner); CP(*in, *out, f_type); CP(*in, *out, f_flags); - CP(*in, *out, f_flags); - CP(*in, *out, f_syncwrites); - CP(*in, *out, f_asyncwrites); + out->f_syncwrites = MIN(in->f_syncwrites, INT32_MAX); + out->f_asyncwrites = MIN(in->f_asyncwrites, INT32_MAX); strlcpy(out->f_fstypename, in->f_fstypename, MFSNAMELEN); strlcpy(out->f_mntonname, in->f_mntonname, min(MNAMELEN, FREEBSD4_MNAMELEN)); - CP(*in, *out, f_syncreads); - CP(*in, *out, f_asyncreads); + out->f_syncreads = MIN(in->f_syncreads, INT32_MAX); + out->f_asyncreads = MIN(in->f_asyncreads, INT32_MAX); strlcpy(out->f_mntfromname, in->f_mntfromname, min(MNAMELEN, FREEBSD4_MNAMELEN)); } |