Showing changes from revision #2 to #3:
Added | Removed | Changed
Various calls are made by FileSwitch through these entry points to deal with controlling open files. Actions are specified by R0 as follows:
Read sequential file pointer
Entry | |
---|---|
R0 | 0 |
R1 | File handle used by your filing system |
Exit | |
---|---|
R0-R1 | ? |
R2 | Sequential file pointer |
Read the sequential file pointer for the given file. Only support this call if the filing system uses unbuffered files.
If the filing system does not support a pointer (as the concept is meaningless, kbd: for example) then it must return a pointer of 0, and not return an error.
Write sequential file pointer
Entry | |
---|---|
R0 | 1 |
R1 | File handle used by your filing system |
R2 | New sequential file pointer |
Exit | |
---|---|
R0-R2 | ? |
Alter the sequential file pointer for a given file. Only support this call if the filing system uses unbuffered files.
If the new pointer is greater than the current file extent extent, then:
If the file cannot be extended, return an error as soon as possible and certainly before the extent is updated.
If the filing system does not support a pointer (as the concept is meaningless, kbd: for example) then it must ignore the call and not return an error.
Read file extent
Entry | |
---|---|
R0 | 2 |
R1 | File handle used by your filing system |
Exit | |
---|---|
R0-R1 | ? |
R2 | File extent |
Read the extent of a given file. Only support this call if the filing system uses unbuffered files.
If the filing system does not support file extents (as the concept is meaningless, kbd: for example) then it must return an extent of 0, and not return an error.
Write file extent
Entry | |
---|---|
R0 | 3 |
R1 | File handle used by your filing system |
R2 | New file extent |
Exit | |
---|---|
R0-R2 | ? |
Changes the extent of a file.
The file handle is guaranteed by FileSwitch not to be a directory and to have had write access granted at the time it was opened.
If the filing system does not support file extents (as the concept is meaningless, kbd: for example) then it must ignore the call, and not return an error.
Buffered files
For buffered files, FileSwitch only calls this entry to set the real file extent just prior to closing an open file. The filing system should store the value of R2 in the file’s catalogue information as its new length.
Unbuffered files
For unbuffered files, FileSwitch calls this entry whenever requested to by its
client.
If the new extent is less than the current sequential pointer (the file is shrinking and the pointer would lie outside the file), then you must set the pointer to the new extent.
If the new extent is greater than the current one then you must extend the file with zeros.
If you cannot extend the file file, you should return an error as soon as possible and certainly before the extent is updated.
Read size allocated to file
Entry | |
---|---|
R0 | 4 |
R1 | File handle used by your filing system |
Exit | |
---|---|
R0-R1 | ? |
R2 | Size allocated to file by the filing system |
Read the size allocated to a given file. All filing systems must support this call.
EOF check
Entry | |
---|---|
R0 | 5 |
R1 | File handle used by your filing system |
Exit | |
---|---|
R0-R1 | ? |
R2 | -1 if sequential pointer is equal to the current extent. 0 otherwise |
Determine whether the sequential pointer for a given file is at the end of the file or not. Only support this call if the filing system uses unbuffered files.
If a filing system does not support a pointer and/or file extent (as the concept is meaningless, kbd: for example) then the treatment of the C bit (as returned to the client?) is dependent on that filing system. For example, kbd: gives EOF when Ctrl-D is read from the keyboard; null: always gives EOF; and vdu: never gives EOF.
Notify of a flush
Entry | |
---|---|
R0 | 6 |
R1 | File handle used by your filing system |
Exit | |
---|---|
R0-R1 | ? |
R2 | Load address of file, or 0 |
R3 | Execution address of file, or 0 |
Request that the filing system flushes any modified data that it is holding in buffers. Only support this call if the filing system does its own buffering in addition to that done by FileSwitch. For example, ADFS does its own buffering when doing read-ahead/write-behind and implements this entry.
Details specific to FSEntry_Args 6
The modified data should be flushed to the storage media.
This entry is only called if the filing system is buffered, and bit 27 of your Filing System Information Word was set when the filing system was initialised.
Details specific to ImageEntry_Args 6
The modified data should be flushed to the image. The image should subsequently be
flushed to the storage media to ensure the data’s integrity. This entry point is only called if bit 27 of the image Filing System Information Word was set when the filing system was initialised.
Ensure file size
Entry | |
---|---|
R0 | 7 |
R1 | File handle used by your filing system |
R2 | Size of file to ensure |
Exit | |
---|---|
R0-R1 | ? |
R2 | Size of file actually ensured |
Ensure that a file is of at least the given size. If the file is extended, any extra space does not need to be zeroed.
All filing systems must support this call.
Write zeros to file
Entry | |
---|---|
R0 | 8 |
R1 | File handle used by your filing system |
R2 | File offset at which to write |
R3 | Number of zero bytes to write |
Exit | |
---|---|
R0-R3 | ? |
Request the filing system writes a given number of zero bytes to a given offset within a file. Only support this call if the filing system uses buffered files.
The file handle is guaranteed by FileSwitch not to be a directory and to have had write access granted at the time the file was opened.
The number of bytes to write write, and the file offset at which to write data, are guaranteed to be a multiple of the buffer size for this file.
Read file datestamp
Entry | |
---|---|
R0 | 9 |
R1 | File handle used by your filing system |
Exit | |
---|---|
R0-R1 | ? |
R2 | Load address of file, or 0 |
R3 | Execution address of file, or 0 |
Read the date/time stamp for a given file. The bottom four bytes of the date/time stamp are stored in the execution address of the file. The most significant byte is stored in the least significant byte of the load address.
All filing systems must support this call. If the filing system cannot stamp an open file given its handle, then it should return R2 and R3 set to zero.
Inform of new image stamp
Entry | |
---|---|
R0 | 10 |
R1 | File handle used by your filing system |
R2 | New image stamp of image |
Exit | |
---|---|
All registers preserved |
This entry point is called by FileSwitch when an image filing system has changed an
image’s image stamp (its unique identification number). The purpose of the call is to inform the filing system of the change and to pass it the new image stamp.
If the filing system does not support the root object being an image, then it should ignore this call. Otherwise Otherwise, (as for example in the case of FileCore) update the filing system’s internal note of the image stamp, as it may be required to identify the disc at a later time.
This call is for information only and should not require any further action.