Please enable JavaScript to view this site.

ASQL Reference

Navigation: » No topics above this level «

BLOCKS

Scroll Prev Top Next More

Reviewed and revised April 2024

xcall BLOCKS, device, blks, cblks {,tblks} {,unitscale}

BLOCKS allows a program to check how much disk space is free on the specified device and, optionally, the total space on the device.

Parameters

device  (String)  [in]

must be specified without the trailing colon (e.g. DSK0 or EXT1) and must be a device defined in miame.ini.

blcks, cblks  (Signed Int)  [out]

returns the number of free blocks (512 bytes per block) on the device. If the device cannot be accessed, the block count will be returned as –1.

tblks  (F,6)  [out]

returns the total number of blocks (both free and used) on the device.

unitscale (Num)  [in]

specifies a scale factor for the returned "block" units:

Value

Size of "block"

0 or not specified

512 bytes

1

1 KB

11

1 MB

21

1 GB

 

Note that the values for unitscale are actually powers of 2 to be used relative to the number of 512-byte blocks.

Comments

There are a few idiosyncrasies to note about BLOCKS:

Under A-Shell, there is no particular significance to contiguous blocks, since there is no particular significance to them under Windows or Unix. This is why it is always equal to the number of free blocks. You do not need contiguous blocks to allocate random files like you did under some older systems.
512-byte blocks have no particular significance to the host operating system. Under Windows and Unix, the minimum allocation unit is related to something other than physical disk blocks (i.e. clusters or inodes) and for that matter, the physical disk block size may or may not be 512.
Since A-Shell does not impose any kind of partitioning on the devices, it is really the free space on the logical host disk that is being measured. For example, DSK0 may be mapped to /vm/miame/dsk0 and DSK1 to /vm/miame/dsk1, but both of those are part of the same Unix file system. So they will both show the same amount of free space. Do not get fooled into thinking that that much free space is separately available on both devices, since it is really only one device from the host operating system's point of view.

Despite these quirks, it is still a useful approximation to the amount of free space available.  

History

2014 May, A-Shell 6.1.1386:  Add unitscale