Showing changes from revision #1 to #2:
Added | Removed | Changed
Various calls are made by FileSwitch through these entry points to perform operations on whole files. Actions are specified by R0 as follows:
Save file
Entry | |
---|---|
R0 | 0 |
R1 | Pointer to filename |
R2 | Load address to associate with file |
R3 | Execution address to associate with file |
R4 | Pointer to start of buffer |
R5 | Pointer to byte after end of buffer |
R6 | Pointer to special field if present, otherwise 0 (FSEntry_File 0), or image filing system’s handle for image that contains the file (ImageEntry_File 0) |
Exit | |
---|---|
R0-R5 | ? |
R6 | Pointer to a leafname for printing *OPT 1 info |
Request the filing system saves data from a buffer held in memory to a file. FileSwitch has already validated the buffer and ensured that the leafname is not wildcarded. If the file currently exists and is not locked, the old file is first discarded. The new file should have the same access attributes as the one it is replacing, or some default access if the file doesn’t already exist.
Return an error such as “File locked” if the specified file could not be saved.
FileSwitch immediately copies the leafname returned in R6, so it need not have a long
lifetime – hold it in a small static buffer, for example.
Write catalogue information
Entry | |
---|---|
R0 | 1 |
R1 | Pointer to wildcarded filename |
R2 | Load address to associate with file |
R3 | Execution address to associate with file |
R5 | Attributes for file |
R6 | Pointer to special field if present, otherwise 0 (FSEntry_File 1), or image filing system’s handle for image that contains the file (ImageEntry_File 1) |
Exit | |
---|---|
? |
Request the filing system update the catalogue information for an object. If the object is a directory either write the information (FileCore-based filing systems do) or return an error.
Does not return an error if the object does not exist.
Write load address
Entry | |
---|---|
R0 | 2 |
R1 | Pointer to wildcarded filename |
R2 | Load address to associate with file |
R6 | Pointer to special field if present, otherwise 0 |
Exit | |
---|---|
? |
Sets the load address for a file. If the object is a directory either write the information
(FileCore-based filing systems do) or return an error.
Does not return an error if the object does not exist.
Write execution address
Entry | |
---|---|
R0 | 3 |
R1 | Pointer to wildcarded filename |
R3 | Execution address to associate with file |
R6 | Pointer to special field if present, otherwise 0 |
Exit | |
---|---|
? |
Sets the execution address for a file. If the object is a directory either write the
information (FileCore-based filing systems do) or return an error
Does not return an error if the object does not exist.
Write attributes
Entry | |
---|---|
R0 | 4 |
R1 | Pointer to wildcarded filename |
R5 | Attributes to associate with the file |
R6 | Pointer to special field if present, otherwise 0 |
Exit | |
---|---|
? |
Sets the attributes of an object.
Does not return an error if the object does not exist.
Read catalogue information
Entry | |
---|---|
R0 | 5 |
R1 | Pointer to pathname |
R6 | Pointer to special field if present, otherwise 0 (FSEntry_File 5), or image filing system’s handle for image that contains the file (ImageEntry_File 5) |
Exit | |
---|---|
R0 | Object type: |
0 – not found | |
1 – file | |
2 – directory | |
R2 | Load address |
R3 | Execution address |
R4 | File length |
R5 | File attributes |
R6 | preserved (ImageEntry_File 5) |
Returns the catalogue information for an object.
Return an error if:
Returns type 0 if:
Delete object
Entry | |
---|---|
R0 | 6 |
R1 | Pointer to pathname |
R6 | Pointer to special field if present, otherwise 0 (FSEntry_File 6), or image filing system’s handle for image that contains the file (ImageEntry_File 6) |
Exit | |
---|---|
R0 | Object type |
R2 | Load address |
R3 | Execution address |
R4 | File length |
R5 | File attributes |
Deletes an object. FileSwitch will already have ensured that the leafname is not wildcarded. No data need be transferred to the file.
Returns an error if the object is locked against deletion, but not if the object does not exist. The results refer to the object that was deleted.
Create file
Entry | |
---|---|
R0 | 7 |
R1 | Pointer to pathname |
R2 | Load address to associate with file |
R3 | Execution address to associate with file |
R4 | Start address in memory of data |
R5 | End address in memory plus one |
R6 | Pointer to special field if present, otherwise 0 (FSEntry_File 7), or image filing system’s handle for image that contains the file (ImageEntry_File 7) |
Exit | |
---|---|
R6 | Pointer to a filename for printing OPT 1 info (FSEntry_File 7* only) |
Creates a file with a given name. R4 and R5 are used only to calculate the length of the file to be created. If the file currently exists and is not locked, the old file is first discarded. The new file should have the same access attributes as the one it is replacing, or some default access if the file doesn’t already exist.
Returns an error if the file could not be created
Create directory
Entry | |
---|---|
R0 | 8 |
R1 | Pointer to directory name |
R2 | Load address |
R3 | Execution address |
R4 | Number of entries (0 for default) |
R5 | End address in memory plus one |
R6 | Pointer to special field if present, otherwise 0 (FSEntry_File 8), or image filing system’s handle for image that contains the file (ImageEntry_File 8) |
Exit | |
---|---|
? |
Create a directory. If the directory already exists then the filing system can:
If directories don’t support load and execute addresses (which will only be of the directory type/datestamp form) then no error should be returned.
FileSwitch will already have ensured that the leafname is not wildcarded.
Should return an error if the directory could not be created.
Read catalogue information (no length)
Entry | |
---|---|
R0 | 9 |
R1 | Pointer to filename |
R6 | Pointer to special field if present, otherwise 0 |
Exit | |
---|---|
R0 | Object type |
R2 | Load address |
R3 | Execution address |
R5 | File attributes |
Read the catalogue information for an object, save for the object length.
Does not return an error if the object does not exist.
Bit 26 of your Filing System Information Word must have been set when the filing system was initialised. Otherwise FileSwitch calls FSEntry_File 5 and the length returned in R4 is ignored.
Read block size
Entry | |
---|---|
R0 | 10 |
R1 | Pointer to filename |
R6 | Pointer to special field if present, otherwise 0 (FSEntry_File 8), or image filing system’s handle for image that contains the file (ImageEntry_File 8) |
Exit | |
---|---|
R2 | Natural block size of the file in bytes |
Read the natural block size for a file (see FSEntry_Open and ImageEntry_Open)
Load file
Entry | |
---|---|
R0 | 9 |
R1 | Pointer to wildcarded filename |
R2 | Address to load file |
R6 | Pointer to special field if present, otherwise 0 |
Exit | |
---|---|
R0 | Corrupted |
R2 | Load address |
R3 | Execution address |
R4 | File length |
R5 | File attributes |
R6 | Pointer to a filename for printing *OPT 1 info |
Load a file into memory.
FileSwitch will already have called FSEntry_File 5 and validated the client’s load request. If FSEntry_File 5 returned with object type 0 then the user will have been returned the “File ‘xyz’ not found” error; type 2 will have returned the “‘xyz’ is a directory” error; types 1 with corresponding load actions will have had them executed (which may recurse back down to load again), those with no read access will have returned ‘Access violation’, and those being partially or wholly loaded into invalid memory will have returned ‘No writeable memory at this address’.
Therefore unless the filing system is accessing data stored on a multi-user server such as NetFS/FileStore, the object will still be the one whose info was read earlier.
The filename pointed to by R6 on exit should be the non-wildcarded ‘leaf’ name of the file. That is, if the filename given on entry was “$.!b*”, and the file accessed was the “!Boot” file, R6 should point to the string “!Boot”.