www.riscos.com Technical Support:
RISC OS uses filing systems to organise and access data held on external storage media. Several complete filing systems are provided as standard:
Other modules provide extra filing systems:
A module called FileSwitch is at the centre of all filing system operation in RISC OS.
FileSwitch provides a common core of functions used by all filing systems. It only provides the parts of these services that are device independent.
Obviously, FileSwitch cannot know how to control every single piece of hardware that gets added to the system. The device dependent services that control hardware are provided by separate modules, which are the actual filing systems.
One of the main tasks that FileSwitch handles is keeping track of what filing systems are active, and switching between them as necessary. Much of the housekeeping part of the task is done for you; you just have to tell FileSwitch what to do.
When filing systems initialise, they tell FileSwitch their name, where to find their routines for controlling the hardware, and any special actions they are capable of.
Some calls you make to FileSwitch don't need to access hardware, and it deals with these itself. Other calls do need to access hardware; FileSwitch does the portion of the work that is independent of this, and calls a filing system module to access the hardware.
For full details of FileSwitch, see the chapter entitled FileSwitch.
You can add filing system modules to the system, just as you can add any other module. They have to conform to the standards for modules, set out in the Modules; they also have to meet certain other standards to function correctly with FileSwitch as a filing system.
Because FileSwitch is already doing a lot of the work for you, you will have less work to do when you add a filing system than would otherwise be the case. Full details of how to add a filing system to FileSwitch are set out in the Writing a filing system.
FileSwitch does not lay down the format in which data must be laid out on a filing system, but it does specify what the user interface should look like.
One of the filing system modules that RISC OS provides is FileCore. It takes the normal calls that FileSwitch sends to a filing system module, and converts them to a simpler set of calls to modules that control the hardware. So, like FileSwitch, it provides a common core of functions that are device independent, and it communicates with secondary FileCore modules that access the hardware. Unlike FileSwitch, it creates a fresh instantiation of itself for each module it supports.
For full details of FileCore, see the chapter entitled FileCore.
You can, of course, add FileCore modules to the system. Using FileCore to build part of your filing system imposes a more rigid structure on it, as more of the filing system is predefined than if you do not use it. The filing system will appear very similar to ADFS or RamFS, both of which use FileCore. Of course, if you use FileCore to write a filing system it will be even less work for you, as even more of the system is already written.
For full details of using FileCore to implement a filing system, see the chapter entitled Writing a FileCore module.
DeviceFS is another filing system module that takes the normal calls that FileSwitch sends to a filing system module, and converts them to a simpler set of calls to modules that control the hardware. It is intended for stream-based I/O. The secondary modules with which it communicates are known as device drivers: examples of these are the serial and parallel ports. Only a single instantiation of DeviceFS is needed.
DeviceFS is not included in RISC OS 2, and in RISC OS 3 will only support character devices. Support for block devices may be added to a future release.
For full details of DeviceFS, see the chapter entitled DeviceFS.
As you'd expect, you can also add device drivers to RISC OS. For full details of using DeviceFS to implement a device driver, see the chapter entitled Writing a device driver.
As well as standard filing systems, FileSwitch supports image filing systems. These provide facilities for RISC OS to handle media in foreign formats, and to support image files (or partitions) in those formats. They differ from standard filing systems in that they do not themselves access hardware; instead they rely on standard RISC OS filing systems to do so. DOSFS is an example of an image filing system, used to handle DOS format discs.
Image filing systems are not available in RISC OS 2.
There are three parts to an image filing system:
Image filing systems provide these facilities in a manner that is transparent to the end user; image files appear to be the same as any other file on the host filing system. The host filing system need not be aware of image filing systems to support this functionality.
To do so it communicates with a filing system using a service call. The host filing system needs to be aware of image filing systems (ie must support the service call) to provide this functionality. Currently FileCore is the only standard filing system that does so.
For full details of DOSFS (a typical image filing system), see the chapter entitled DOSFS.
You can add image filing systems to the system. For full details, see the chapter entitled Writing a filing system.
The Filer module provides the facilities needed to display files and directories on the desktop, and to interact with them. It does so for all filing systems.
For full details of the Filer, see the chapter entitled The Filer.
Filer_Action performs file manipulation operations for the Filer without the desktop hanging whilst they are under way.
For full details of Filer_Action, see the chapter entitled Filer_Action and FilerSWIs.
Each filing system that provides an icon on the icon bar has a Filer module to do this, and to provide any associated services: for example, the ADFSFiler module. A Filer module can use service calls to interact with image filing systems, and add their formats to its menu of those it already supports.
The diagram below summarises the structure described above:
Structure of RISC OS filing systems