Subject: Re: df and union mounts
To: None <cjones@rupert.oscs.montana.edu, trevin@xmission.com>
From: Charles M. Hannum <mycroft@ai.mit.edu>
List: current-users
Date: 01/30/1996 11:42:38
Does the following patch do what you want?


Index: union_vfsops.c
===================================================================
RCS file: /a/cvsroot/src/sys/miscfs/union/union_vfsops.c,v
retrieving revision 1.10
diff -c -2 -r1.10 union_vfsops.c
*** union_vfsops.c	1995/06/18 14:47:47	1.10
--- union_vfsops.c	1996/01/30 16:40:36
***************
*** 429,444 ****
  
  	/* now copy across the "interesting" information and fake the rest */
- #if 0
- 	sbp->f_type = mstat.f_type;
- 	sbp->f_flags = mstat.f_flags;
- 	sbp->f_bsize = mstat.f_bsize;
- 	sbp->f_iosize = mstat.f_iosize;
- #endif
  	lbsize = mstat.f_bsize;
! 	sbp->f_blocks = mstat.f_blocks;
! 	sbp->f_bfree = mstat.f_bfree;
! 	sbp->f_bavail = mstat.f_bavail;
! 	sbp->f_files = mstat.f_files;
! 	sbp->f_ffree = mstat.f_ffree;
  
  	error = VFS_STATFS(um->um_uppervp->v_mount, &mstat, p);
--- 429,435 ----
  
  	/* now copy across the "interesting" information and fake the rest */
  	lbsize = mstat.f_bsize;
! 	sbp->f_blocks = mstat.f_blocks - mstat.f_bfree;
! 	sbp->f_files = mstat.f_files - mstat.f_ffree;
  
  	error = VFS_STATFS(um->um_uppervp->v_mount, &mstat, p);
***************
*** 457,470 ****
  	 */
  
! 	if (mstat.f_bsize != lbsize) {
  		sbp->f_blocks = sbp->f_blocks * lbsize / mstat.f_bsize;
- 		sbp->f_bfree = sbp->f_bfree * lbsize / mstat.f_bsize;
- 		sbp->f_bavail = sbp->f_bavail * lbsize / mstat.f_bsize;
- 	}
  	sbp->f_blocks += mstat.f_blocks;
! 	sbp->f_bfree += mstat.f_bfree;
! 	sbp->f_bavail += mstat.f_bavail;
  	sbp->f_files += mstat.f_files;
! 	sbp->f_ffree += mstat.f_ffree;
  
  	if (sbp != &mp->mnt_stat) {
--- 448,458 ----
  	 */
  
! 	if (mstat.f_bsize != lbsize)
  		sbp->f_blocks = sbp->f_blocks * lbsize / mstat.f_bsize;
  	sbp->f_blocks += mstat.f_blocks;
! 	sbp->f_bfree = mstat.f_bfree;
! 	sbp->f_bavail = mstat.f_bavail;
  	sbp->f_files += mstat.f_files;
! 	sbp->f_ffree = mstat.f_ffree;
  
  	if (sbp != &mp->mnt_stat) {