Storage::Disk Namespace Reference
Namespaces | |
EXFAT | |
FAT | |
GPT | |
MBR | |
Classes | |
class | BlockDevice |
Base class for sector-addressable (block) devices. More... | |
struct | Buffer |
class | BufferList |
class | HostFileDevice |
Create custom storage device using backing file. More... | |
struct | DiskPart |
Adds information specific to MBR/GPT disk partitions. More... | |
struct | PartInfo |
In-memory partition information. More... | |
class | BasePartitionTable |
Common type for MBR/GPT partition table. More... | |
class | Scanner |
Class to iterate through disk partition tables. More... | |
class | SectorBuffer |
Buffer for working with disk sectors. More... | |
Typedefs | |
using | SysTypes = BitSet< uint8_t, SysType > |
Enumerations | |
enum class | Error { XX } |
enum class | SysType : uint8_t { unknown , fat12 , fat16 , fat32 , exfat } |
Identifies exact disk volume type. More... | |
enum | SysIndicator { SI_FAT12 = 0x01 , SI_FAT16 = 0x04 , SI_FAT16B = 0x06 , SI_IFS = 0x07 , SI_EXFAT = 0x07 , SI_FAT32X = 0x0c } |
MBR partition system type indicator values. More... | |
Functions | |
template<typename T > | |
T | align_up (T value, uint32_t align) |
template<typename T > | |
auto | getBlockCount (T byteCount, uint32_t blockSize) |
uint32_t | crc32_byte (uint32_t crc, uint8_t d) |
uint32_t | crc32 (uint32_t bcc, const void *data, size_t length) |
uint32_t | crc32 (const void *data, size_t length) |
bool | operator! (Error err) |
Error | formatDisk (BlockDevice &device, GPT::PartitionTable &table, const Uuid &diskGuid={}) |
Partition a device using the GPT scheme. More... | |
Error | formatDisk (BlockDevice &device, MBR::PartitionTable &table) |
Partition a device using the MBR scheme. More... | |
SysType | getSysTypeFromIndicator (SysIndicator si) |
Error | validate (BasePartitionTable &table, storage_size_t firstAvailableBlock, storage_size_t totalAvailableBlocks, uint32_t blockSize) |
Validate partition table entries. More... | |
bool | scanPartitions (Device &device) |
Variables | |
constexpr uint32_t | PARTITION_ALIGN {0x100000U} |
static constexpr SysTypes | fatTypes = SysType::fat12 | SysType::fat16 | SysType::fat32 | SysType::exfat |
Typedef Documentation
◆ SysTypes
using Storage::Disk::SysTypes = typedef BitSet<uint8_t, SysType> |
Enumeration Type Documentation
◆ Error
|
strong |
◆ SysIndicator
MBR partition system type indicator values.
Enumerator | |
---|---|
SI_FAT12 | |
SI_FAT16 | FAT16 with fewer than 65536 sectors. |
SI_FAT16B | FAT16B with 65536 or more sectors. |
SI_IFS | |
SI_EXFAT | |
SI_FAT32X | FAT32 with LBA. |
◆ SysType
|
strong |
Identifies exact disk volume type.
Enumerator | |
---|---|
unknown | Partition type not recognised. |
fat12 | |
fat16 | |
fat32 | |
exfat |
Function Documentation
◆ align_up()
template<typename T >
T Storage::Disk::align_up | ( | T | value, |
uint32_t | align | ||
) |
◆ crc32() [1/2]
|
inline |
◆ crc32() [2/2]
uint32_t Storage::Disk::crc32 | ( | uint32_t | bcc, |
const void * | data, | ||
size_t | length | ||
) |
◆ crc32_byte()
uint32_t Storage::Disk::crc32_byte | ( | uint32_t | crc, |
uint8_t | d | ||
) |
◆ formatDisk() [1/2]
Error Storage::Disk::formatDisk | ( | BlockDevice & | device, |
GPT::PartitionTable & | table, | ||
const Uuid & | diskGuid = {} |
||
) |
◆ formatDisk() [2/2]
Error Storage::Disk::formatDisk | ( | BlockDevice & | device, |
MBR::PartitionTable & | table | ||
) |
◆ getBlockCount()
template<typename T >
auto Storage::Disk::getBlockCount | ( | T | byteCount, |
uint32_t | blockSize | ||
) |
◆ getSysTypeFromIndicator()
|
inline |
◆ operator!()
|
inline |
◆ scanPartitions()
bool Storage::Disk::scanPartitions | ( | Device & | device | ) |
◆ validate()
Error Storage::Disk::validate | ( | BasePartitionTable & | table, |
storage_size_t | firstAvailableBlock, | ||
storage_size_t | totalAvailableBlocks, | ||
uint32_t | blockSize | ||
) |
Validate partition table entries.
- Parameters
-
firstAvailableBlock First block number which may be allocated to a partition totalAvailableBlocks Number of blocks available for partition allocation blockSize Size of a block
- Return values
-
Error For each partition:
- If size <= 100 then the actual size is calculated as a percentage and updated
- If offset = 0 then a suitable location is found and the offset updated
On success, partition entries are ordered by position.
Variable Documentation
◆ fatTypes
|
staticconstexpr |
◆ PARTITION_ALIGN
|
constexpr |