<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Mon, 19 Dec 1983 06:16:52-PST (Mon)
From   : decvax!ittvax!dcdwest!sdcsvax!sdccsu3!brian@ucb-vax
Subject: Re: Computing free space on a disk

x <- destroy all monsters

The easiest way to calculate the available space on a disk is to use the
allocation map - the bits turned off in the allocation map are available
allocation groups, so you just multiply the number of bits off by the
allocation size (available from factors in the disk parameter block) and
that is the room left on the disk.  You can get pointers to the disk
block from the BDOS, then use that to find the allocation vector,
maximum number of groups, and the allocation size.  See the DRI
incomprehensible manuals for the exact details, or take apart the code
in one of the public domain directory programs (like SD).

Note that using the DPB information makes the program relatively
independent of what hardware configuration its running on.

-- 
       -Brian Kantor, UC San Diego 
       {decvax,ucbvax} !sdcsvax!sdccsu3!brian
       Kantor@Nosc
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>