RISCOS.com

www.riscos.com Technical Support:
Programmer's Reference Manual

 

Writing a filing system


Introduction and Overview

New FSEntry_Func and ImageEntry_Func reason codes

In RISC OS 3.6 OS_FSControl has three new reason codes (see FileSwitch), each of which duplicates previously available functionality, but allows 64 bit values to be passed or returned instead of 32 bit values. For each of the new OS_FSControl reason codes, a corresponding new reason code has therefore been added to those that may be passed to a filing system's FSEntry_Func entry point and to an image filing system's ImageEntry_Func entry point:

OS_FSControl FS/ImageEntry_Func Name
55 35 ReadFreeSpace64
56 36 DefectList64
57 37 AddDefect64

These new reason codes are detailed in the next section.

Although ImageEntry_Func entry points have been defined, there is little point in an image filing system supporting them under RISC OS 3.6. Since an image filing system is restricted in size to the maximum file size of 4 GB, all quantities can be represented in 32 bits, and the old reason codes are therefore adequate. All programs calling the new 64 bit SWIs (and hence the new entry points) should revert to calling the old 32 bit SWIs (and hence the old entry points) if they get an error; so you shouldn't get problems with new software failing to work because you don't provide the new entry points.

Interfaces

FSEntry_Func 35 and ImageEntry_Func 35

Read free space
On entry

R0 = 35
R1 = pointer to pathname of any object on image (FSEntry_Func 35 only)
R6 = pointer to special field if present, otherwise 0 (FSEntry_Func 35); or image filing system's handle for image (ImageEntry_Func 35)

On exit

R0 = bits 0 - 31 of free space
R1 = bits 32 - 63 of free space
R2 = biggest object creatable
R3 = bits 0 - 31 of disc size
R4 = bits 32 - 63 of disc size

Details

This entry point is called by FileSwitch to read the free space for the image that holds the object specified by R1 (FSEntry_Func 35), or that is specified by the handle in R6 (ImageEntry_Func 35).

This entry point is not called by RISC OS 3.5 or earlier.

FSEntry_Func 36 and ImageEntry_Func 36

Read defect list
On entry

R0 = 36
R1 = pointer to name of image (FSEntry_Func 36 only)
R2 = pointer to buffer
R5 = length of buffer
R6 = pointer to special field if present, otherwise 0 (FSEntry_Func 36); or image filing system's handle for image (ImageEntry_Func 36)

On exit

R0 preserved
R1 = number of defects placed in buffer
R2, R5, R6 preserved

Details

This entry point is called by FileSwitch to request that your filing system fills the given buffer with a defect list giving the byte offsets to the start of any defects in the specified image. Each entry in the list is a pair of words - with the least significant one first - giving the address of the defect as a 64 bit value.

It is an error if the specified image is not the root object in an image (eg it is an error to map out a defect from ADFS::HardDisc4.$.fred, but not an error to map it out from ADFS::HardDisc4.$).

This entry point is not called by RISC OS 3.5 or earlier.

FSEntry_Func 37 and ImageEntry_Func 37

Add a defect
On entry

R0 = 37
R1 = pointer to name of image (FSEntry_Func 37 only)
R2 = bits 0 - 31 of offset to start of defect
R3 = bits 32 - 63 of offset to start of defect
R6 = pointer to special field if present, otherwise 0 (FSEntry_Func 37); or image filing system's handle for image (ImageEntry_Func 37)

On exit

R0 - R2, R6 preserved

Details

This entry point is called by FileSwitch to request that your filing system maps out the given defect from the specified image.

It is an error if the specified image is not the root object in an image (eg it is an error to map out a defect from ADFS::HardDisc4.$.fred, but not an error to map it out from ADFS::HardDisc4.$). If the defect cannot be mapped out because it is not free, then you should return an error.

This entry point is not called by RISC OS 3.5 or earlier.

This edition Copyright © 3QD Developments Ltd 2015
Last Edit: Tue,03 Nov 2015