Patch #: 191 Type: operational change Priority: none Modification: cope with UNIX filesystems larger than 2 Gigabytes Submitted: David Hornsby Reported: John David Anglin Archived: munnari.OZ.AU mac/cap.patches/cap60.patch191 Application: 'cd cap60; patch -p < cap60.patches/cap60.patch191' Summary: scale v_size/v_free values to maximum of 1,952MBytes File: cap60/applications/aufs/afpvols.h File: cap60/applications/aufs/afpos.c *** applications/aufs/afpvols.h.orig Sat Jan 8 10:49:33 1994 --- applications/aufs/afpvols.h Wed Feb 16 16:09:25 1994 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 1994/01/07 23:48:44 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/afpvols.h,v 2.2 1994/01/07 23:48:44 djh Rel djh $ ! * $Revision: 2.2 $ */ /* --- 1,7 ---- /* ! * $Author: djh $ $Date: 1994/02/16 05:09:02 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/afpvols.h,v 2.3 1994/02/16 05:09:02 djh Rel djh $ ! * $Revision: 2.3 $ */ /* *************** *** 38,45 **** sdword v_cdate; /* volume creation date */ sdword v_mdate; /* volume modification date */ sdword v_bdate; /* volume backup date */ ! sdword v_size; /* size of volume in bytes */ ! sdword v_free; /* free bytes on volume */ } VolEntry, *VolPtr; /* user volume table */ #define NILVOL ((VolPtr) 0) --- 38,45 ---- sdword v_cdate; /* volume creation date */ sdword v_mdate; /* volume modification date */ sdword v_bdate; /* volume backup date */ ! dword v_size; /* size of volume in bytes */ ! dword v_free; /* free bytes on volume */ } VolEntry, *VolPtr; /* user volume table */ #define NILVOL ((VolPtr) 0) *** applications/aufs/afpos.c.orig Tue Feb 1 15:52:10 1994 --- applications/aufs/afpos.c Wed Feb 16 16:09:29 1994 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 1994/02/01 04:51:41 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/afpos.c,v 2.49 1994/02/01 04:51:41 djh Rel djh $ ! * $Revision: 2.49 $ * */ --- 1,7 ---- /* ! * $Author: djh $ $Date: 1994/02/16 05:09:02 $ ! * $Header: /mac/src/cap60/applications/aufs/RCS/afpos.c,v 2.50 1994/02/16 05:09:02 djh Rel djh $ ! * $Revision: 2.50 $ * */ *************** *** 2291,2296 **** --- 2291,2333 ---- } /* + * scale the AUFS volume size information to comply + * with the upper limit of Macintosh file systems + * (currently 2 Gigabytes) + * + * To avoid problems with "on disk" sizes being + * calculated incorrectly (ie: 2,546.9MB on disk for + * 8,903 bytes used) we seem to need an allocation + * block size smaller than 32k, so we arbitrarily + * choose 31k and apply the formula from IM vol IV, + * page 241 + * + * abSize = (1 + ((volSize/512)/64k)) * 512 + * + * giving a volume size of 2046820352 bytes (1,952MB) + * + */ + + #ifndef MAXMACVOLSIZE + #define MAXMACVOLSIZE 2046820352 + #endif MAXMACVOLSIZE + + void + scaleVolSize(v) + VolPtr v; + { + float scale; + + if (v->v_size >= MAXMACVOLSIZE) { + scale = (MAXMACVOLSIZE >> 16)/(float)(v->v_size >> 16); + v->v_free = scale * v->v_free; + v->v_size = MAXMACVOLSIZE; + } + + return; + } + + /* * OSErr OSVolInfo(VolPtr v) * * Update volume information for volume pointed to by v. *************** *** 2301,2309 **** * v_attr Read only flag (V_RONLY) * v_cdate creation date (of v_path) * v_mdate modification date (of v_path) ! * v_size size of volume in bytes ???? ! * v_free free bytes on volume ???? * */ export OSErr --- 2338,2348 ---- * v_attr Read only flag (V_RONLY) * v_cdate creation date (of v_path) * v_mdate modification date (of v_path) ! * v_size size of volume in bytes (32 bits ##) ! * v_free free bytes on volume (32 bits ##) * + * ## expect trouble if the volume size exceeds 4 Gigabytes. + * */ export OSErr *************** *** 2323,2328 **** --- 2362,2368 ---- struct statfs fsbuf; #endif USESTATFS time_t sometime; + void scaleVolSize(); if (stat(path,&buf) != 0) /* directory exists? */ return(aeObjectNotFound); /* no... */ *************** *** 2390,2395 **** --- 2430,2436 ---- dqblk.dqb_bhardlimit != 0) { /* make sure not unlimited */ v->v_size = dqblk.dqb_bhardlimit*512; v->v_free = (dqblk.dqb_bhardlimit-dqblk.dqb_curblocks)*512; + scaleVolSize(v); return(noErr); } #endif USEQUOTA *************** *** 2404,2409 **** --- 2445,2451 ---- dqblk.dqb_bhardlimit != 0) { v->v_size = dqblk.dqb_bhardlimit*512; v->v_free = (dqblk.dqb_bhardlimit-dqblk.dqb_curblocks)*512; + scaleVolSize(v); return(noErr); } } *************** *** 2419,2424 **** --- 2461,2467 ---- v->v_size = ubuf.f_tfree*1024; } v->v_free = ubuf.f_tfree*1024; + scaleVolSize(v); return(noErr); } #endif USEUSTAT *************** *** 2428,2433 **** --- 2471,2477 ---- v->v_size = fsbuf.f_bsize * fsbuf.f_blocks; /* limiting factor: cannot report on overutilization of a volume */ v->v_free = (fsbuf.f_bfree < 0) ? 0 : fsbuf.f_bsize * fsbuf.f_bfree; + scaleVolSize(v); return(noErr); } # else /* sgi || apollo */ *************** *** 2446,2451 **** --- 2490,2496 ---- /* limiting factor: cannot report on overutilization of a volume */ v->v_free = (fsbuf.f_bavail < 0) ? 0 : fsbuf.f_bsize * fsbuf.f_bavail; #endif /* __386BSD__ || __osf__ */ + scaleVolSize(v); return(noErr); } # endif /* sgi || apollo */ *************** *** 2456,2461 **** --- 2501,2507 ---- v->v_size = 0x1000000; /* some random number */ v->v_free = 0x1000000; /* same random number */ #endif SIZESERVER + scaleVolSize(v); return(noErr); /* all ok */ } *************** *** 2551,2556 **** --- 2597,2603 ---- struct fs_data buffer[NUMGETMNTBUF]; struct fs_data *bp; int nbytes = sizeof(struct fs_data)*NUMGETMNTBUF; + void scaleVolSize(); if (!oldgetmnt) { /* Ultrix 2.2 */ *************** *** 2579,2584 **** --- 2626,2632 ---- /* bfreen must be "good" in that it cannot go below 0 when */ /* out of space -- it is unsigned! */ v->v_free = ((getuid() == 0) ? bp->fd_req.bfree : bp->fd_req.bfreen) * 1024; + scaleVolSize(v); return(noErr); } #endif /* GETMNT */ *** lib/cap/abversion.c.orig Sat Feb 5 14:34:40 1994 --- lib/cap/abversion.c Wed Feb 16 16:13:44 1994 *************** *** 1,7 **** /* ! * $Author: djh $ $Date: 1994/02/05 03:34:35 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/abversion.c,v 2.90 1994/02/05 03:34:35 djh Rel djh $ ! * $Revision: 2.90 $ * */ --- 1,7 ---- /* ! * $Author: djh $ $Date: 1994/02/16 05:13:39 $ ! * $Header: /mac/src/cap60/lib/cap/RCS/abversion.c,v 2.91 1994/02/16 05:13:39 djh Rel djh $ ! * $Revision: 2.91 $ * */ *************** *** 32,38 **** myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 190; myversion.cv_rmonth = "February"; myversion.cv_ryear = "1994"; switch (lap_proto) { --- 32,38 ---- myversion.cv_name = "CAP"; myversion.cv_version = 6; myversion.cv_subversion = 0; ! myversion.cv_patchlevel = 191; myversion.cv_rmonth = "February"; myversion.cv_ryear = "1994"; switch (lap_proto) { *** README.orig Sat Feb 5 14:35:35 1994 --- README Wed Feb 16 16:14:24 1994 *************** *** 2,8 **** CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 190, February 1994 Notice ------ --- 2,8 ---- CAP - Columbia AppleTalk Package for UNIX o RELEASE NOTES ! o CAP Distribution 6.0, Patch Level 191, February 1994 Notice ------