Device Operations
The ultimate purpose of a file system device is to hold data. Consequently, two major operations that can occur on a device are the reading and writing of individual sectors. Five additional operations can be performed which affect not just individual sectors, but the whole device:
A device can be opened. During the opening of a device, it is initialized and its characteristics are determined (sector size, number of sectors, vendor).
A device can be partitioned. Partitioning divides the final unallocated portion of the device into two parts, so that a volume could be located on each (see section 5-5 “Partitions” on page 73).
A device can be low-level formatted. Some device must be low-level formatted before being used.
A device can be (high-level) formatted. (High-level) formatting writes the control information for a file system to a device so that a volume on it can be mounted. Essentially, (high-level) formatting is the process of creating a volume on an empty device or partition.
A device can be closed. During the closing of a device, it is uninitialized (if necessary) and associated structures are freed.
These operations and the corresponding API functions are discussed in this section. For information about using device names, see section 4-2 “μC/FS Device and Volume Names” on page 61.
Function |
Description |
FSDev_AccessLock() |
Acquire exclusive access to a device. |
FSDev_AccessUnlock() |
Release exclusive access to a device. |
FSDev_Close() |
Remove device from file system. |
FSDev_GetNbrPartitions() |
Get number of partitions on a device. |
FSDev_Invalidate() |
Invalidate files and volumes open on a device. |
FSDev_IO_Ctrl() |
Perform device I/O control operation. |
FSDev_Open() |
Add device to file system. |
FSDev_PartitionAdd() |
Add partition to device. |
FSDev_PartitionFind() |
Find partition on device and get information about partition. |
FSDev_PartitionInit() |
Initialize partition on device. |
FSDev_Query() |
Get device information. |
FSDev_Rd() |
Read sector on device. |
FSDev_Refresh() |
Refresh device in file system. |
FSDev_Wr() |
Write sector on device. |
-
- Device API functions