Path: utzoo!attcan!uunet!decwrl!bacchus.pa.dec.com!granite.pa.dec.com!mwm From: mwm@raven.pa.dec.com (Mike (Real Amigas have keyboard garages) Meyer) Newsgroups: comp.sys.amiga.tech Subject: Re: when is a block not a block? Message-ID: Date: 11 Jul 90 16:00:19 GMT References: <6498.269a4527@vax1.tcd.ie> Sender: news@wrl.dec.com (News) Organization: Missionaria Phonibalonica Lines: 45 In-Reply-To: cpmurphy@vax1.tcd.ie's message of 10 Jul 90 21:14:15 GMT In article <6498.269a4527@vax1.tcd.ie> cpmurphy@vax1.tcd.ie writes: There I was alarmed to see that there is a bug in 1.3 to do with file blocks. Apparently using Examine() or ExNext() with a FileInfoBlock structure will not always give the correct number of blocks taken up by a file. The way to get around it, so it says, is to use Info(). There isn't a bug in 1.3 about the number of blocks a file uses. There's just a difference of opinion between OFS and FFS about how what that phrase means. One of them counts the number of data blocks, the other counts all the blocks used by the file, both data and overhead. (Question to CATS: Is this considered a bug? And is it fixed in 2.0?) Because of this, the block count field in the FileInfoBlock is pretty much useless if high accuracy is desired. Get the size of the file in characters (that only counts the data) and the # of bytes in a block for the device. From that, you can compute both the number of data blocks and the number of overhead blocks. I'm a little bit confused by all of this. Could someone please enlighten me. How do I get the "real" number of blocks taken up by a file so as to avoid this bug? Say I have a file on a HD and I want to copy it to a floppy. How do I ensure that there is enough space on the floppy for this file? Is it to convert it's size in bytes to "floppy blocks", then compare it to the Info() from the floppy? Or is there an overhead involved (some code I've seen implies there is). The easy way is to get Fish disk 352, and look in treewalk for the "willfit" program. That takes a device and a bunch directory, and tells you whether there are enough free blocks on the device to hold the directories and everything in them (modulo 1 block, which depends on where on the floppy the directory is going). What willfit does is uses the block size from the device to figure sizes for files in the tree. Since FFS puts more data in a block than OFS, copying a file from an HD with FFS to a floppy with OFS can cause the number of blocks to grow when you copy a file from the FFS to the OFS.