As mentioned previously, mount table entries can be sourced from two
places. Static entries may be defined by using the
MTAB_ENTRY() macro. Such entries will be
automatically mounted on system startup. For each entry in the mount
table that has a non-null
name field the
filesystem table is searched for a match with the
fsname field. If a match is found the
mount entry is called and if
successful the mount table entry marked valid and the
fs field initialized. The
mount() function is responsible for initializing
The size of the mount table is defined by the configuration value CYGNUM_FILEIO_MTAB_MAX. Any entries that have not been statically defined are available for use by dynamic mounts.
A filesystem may be mounted dynamically by calling
function has the following prototype:
int mount( const char *devname, const char *dir, const char *fsname);
devname argument identifies a device that
will be used by this filesystem and will be assigned to the
devname field of the mount table entry.
dir argument is the mount point name, it
will be assigned to the
name field of the
mount table entry.
fsname argument is the name of the
implementing filesystem, it will be assigned to the
fsname entry of the mount table entry.
The process of mounting a filesystem dynamically is as follows. First
a search is made of the mount table for an entry with a NULL
name field to be used for the new mount
point. The filesystem table is then searched for an entry whose name
fsname. If this is successful then
the mount table entry is initialized and the filesystem's
mount() operation called. If this is successful,
the mount table entry is marked valid and the
fs field initialized.
Unmounting a filesystem is done by the
function. This can unmount filesystems whether they were mounted
statically or dynamically.
umount() function has the following prototype:
int umount( const char *name );
The mount table is searched for a match between the
name argument and the entry
name field. When a match is found the
umount() operation is called and if
successful, the mount table entry is invalidated by setting its
valid field false and the
name field to NULL.