The FILEIO infrastructure provides a synchronization mechanism for controlling concurrent access to filesystems. This allows existing filesystems to be ported to eCos, even if they do not have their own synchronization mechanisms. It also allows new filesystems to be implemented easily without having to consider the synchronization issues.
The infrastructure maintains a mutex for each entry in each of the main tables: filesystem table, mount table and file table. For each class of operation each of these mutexes may be locked before the corresponding filesystem operation is invoked.
The synchronization protocol required by a filesystem is described
by the syncmode
field of the filesystem
table entry. This is a combination of the following flags:
Lock the filesystem table entry mutex during all filesystem level operations.
Lock the mount table entry mutex during all filesystem level operations.
Lock the file table entry mutex during all I/O operations.
Lock the filesystem table entry mutex during all I/O operations.
Lock the mount table entry mutex during all I/O operations.
Lock the file table entry mutex during all socket operations.
Lock the network stack table entry mutex during all socket operations.
Perform no locking at all during any operations.
The value of the syncmode
field in the
filesystem table entry will be copied by the infrastructure to the
open file object after a successful open()
operation.