🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #4316

Re: when is a block not a block?

#4316
From: Mike (Real Amigas have keyboard ...
Date: Wed, 11 Jul 1990 16:00
45 lines
2933 bytes
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.

	<mike
--
All around my hat, I will wear the green willow.	Mike Meyer
And all around my hat, for a twelve-month and a day.	mwm@relay.pa.dec.com
And if anyone should ask me, the reason why I'm wearing it,	decwrl!mwm
It's all for my true love, who's far far away.
Technical Details
Message-ID: <MWM.90Jul11120019@raven.pa.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!decwrl!bacchus.pa.dec.com!granite.pa.dec.com!mwm
References: <6498.269a4527@vax1.tcd.ie>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <MWM.90Jul11120019@raven.pa.dec.com>
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