Welcome, Guest. Please login or register.

Author Topic: Question about FFS extension blocks on floppy disks  (Read 1528 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline PanterHZTopic starter

  • Sr. Member
  • ****
  • Join Date: Jul 2009
  • Posts: 295
    • Show only replies by PanterHZ
    • http://www.rhz1.com
Question about FFS extension blocks on floppy disks
« on: July 15, 2010, 12:57:29 AM »
When a file is saved to a FFS formatted floppy disk, it will in addition to the blocks used by the actual file data also use an extra block for the file information. If this information can't fit into a single block, several extension blocks might be used as well.

My question: Is there an easy way to calculate how many extension blocks any given file will use before it is copied to a floppy disk?
 

Offline ncafferkey

  • Sr. Member
  • ****
  • Join Date: Feb 2003
  • Posts: 388
    • Show only replies by ncafferkey
Re: Question about FFS extension blocks on floppy disks
« Reply #1 on: July 15, 2010, 02:16:11 AM »
Assuming 512-byte blocks, and FFS rather than OFS, this C code should give it:

extblocks = (filesize / 512 - 1) / 72;
 

Offline PanterHZTopic starter

  • Sr. Member
  • ****
  • Join Date: Jul 2009
  • Posts: 295
    • Show only replies by PanterHZ
    • http://www.rhz1.com
Re: Question about FFS extension blocks on floppy disks
« Reply #2 on: August 05, 2010, 01:39:11 AM »
I finally got around to check this out, and yes this seems to work. So thanks a lot ncafferkey :-)

BTW. I wondered about where 72 came from, and after searching a bit on the net, I discovered this:

Quote
Files are composed of a file header block, which contains information  about the file (size, last access time, data block pointers, etc), and  the data blocks, which contain the actual data. The file header block  contains up to BSIZE/4-56 data block pointers (which amounts to 72  entries with the usual 512 byte blocks). If a file is larger than that,  file extension blocks will be allocated to hold the data block pointers.  File extension blocks are organised in a linked list, which starts in  the File header block ('extension' field).
Source: http://en.wikipedia.org/wiki/Amiga_Old_File_System


So I guess that with OFS and 488 byte blocks, the following would then be true:

extblocks = (filesize / 488 - 1) / 66;
 

Offline ncafferkey

  • Sr. Member
  • ****
  • Join Date: Feb 2003
  • Posts: 388
    • Show only replies by ncafferkey
Re: Question about FFS extension blocks on floppy disks
« Reply #3 on: August 10, 2010, 01:06:44 PM »
Quote from: PanterHZ;573482

So I guess that with OFS and 488 byte blocks, the following would then be true:

extblocks = (filesize / 488 - 1) / 66;


I think it would still be 72 rather than 66. The 488 vs 512 bytes issue only applies to data blocks AFAIK.