The io_devctl() function

Updated: April 19, 2023

In normal (i.e., nonfilesystem) resource managers, the io_devctl() function is used to implement device control functions. We used this in the ADIOS data acquisition driver to, for example, get the configuration of the device.

In a filesystem resource manager, io_devctl() is used to get various information about the filesystem.

A large number of the commands aren't used for anything other than block I/O filesystems; a few are reserved for internal use only.

Here's a summary of the commands:

DCMD_BLK_PARTENTRY
Used by x86 disk partitions with harddisk-based filesystems.
DCMD_BLK_PART_DESCRIPTION
Get extended partition description details.
DCMD_BLK_FORCE_RELEARN
Triggers a media reversioning and cache invalidation (for removable media). This command is also used to sync-up the filesystem if utilities play with it “behind its back.”
DCMD_FSYS_STATISTICS and DCMD_FSYS_STATISTICS_CLR
Returns struct fs_stats (see <sys/fs_stats.h>). The “_CLR” version resets the counters to zero after returning their values. The fsysinfo utility is a front end for DCMD_FSYS_STATISTICS.
DCMD_FSYS_STATVFS
Returns struct __msg_statvfs (see below for more details).
DCMD_FSYS_MOUNTED_ON, DCMD_FSYS_MOUNTED_AT and DCMD_FSYS_MOUNTED_BY
Each returns 256 bytes of character data, giving information about their relationship to other filesystems. See the discussion below.
DCMD_FSYS_OPTIONS
Returns 256 bytes of character data. This can be used to return the command-line options that the filesystem was mounted with.