🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Calculating blocks used by file(s)

#1874
From: Colin Plumb
Date: Fri, 27 Oct 1989 16:51
26 lines
1637 bytes
In article <1989Oct26.190532.3479@uncecs.edu> utoddl@uncecs.edu (Todd M. Lewis) writes:
>    1) if the files will fit on a given floppy,
>    2) how many blocks will be used, and
>    3) how many blocks will be left.
>
>(Ok, so 3 should be easy if you know 1 and two.)  So how
>does one (or in our case, two) go about calculating such things.
>Your help is greatly appreciated.

This is easily drived from the information in the AmigaDOS Technical Reference
Manual, which you probably have.

To compute the number of blocks a file will take up, divide its size in
bytes by 488 (for OFS) or 512 (for FFS).  Then add 1/72 of this number
(round up, and there is always at least 1) blocks of overhead.  Files
from 0 to 72 blocks long have 1 block of overhead; files from 73 to 144
blocks long have two blocks of overhead, etc.

A directory is 1 block, period.

A floppy also usually contains two boot blocks and one block of bitmap.
On top of that, just count the root directory as a normal directory and
that should be all you need.  A blank floppy has 880*2 = 1760 blocks free.
1756 after allocating the boot blocks, bitmap block, and root directory.
-- 
	-Colin
Technical Details
Message-ID: <17603@watdragon.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!watmath!watdragon!rose!ccplumb
References: <1989Oct26.190532.3479@uncecs.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!watmath!watdragon!rose!ccplumb
From: ccplumb@rose.waterloo.edu (Colin Plumb)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Calculating blocks used by file(s)
Message-ID: <17603@watdragon.waterloo.edu>
Date: 27 Oct 89 16:51:31 GMT
References: <1989Oct26.190532.3479@uncecs.edu>
Sender: daemon@watdragon.waterloo.edu
Reply-To: ccplumb@rose.waterloo.edu (Colin Plumb)
Organization: U. of Waterloo, Ontario
Lines: 26