Partition.h
Go to the documentation of this file.
156 template <typename T> constexpr FullType(T subType) : FullType(Type(T::partitionType), uint8_t(subType))
195 Info(const String& name, FullType fullType, storage_size_t offset, storage_size_t size, Flags flags = 0)
196 : name(name), offset(offset), size(size), type(fullType.type), subtype(fullType.subtype), flags(flags)
207 return (type == Type::any || type == this->type) && (subType == SubType::any || subType == this->subtype);
283 typename std::enable_if<std::is_pod<T>::value, bool>::type read(storage_size_t offset, T& value)
490 template <typename E> typename std::enable_if<bool(E::partitionType), String>::type toString(E subType)
495 template <typename E> typename std::enable_if<bool(E::partitionType), String>::type toLongString(E subType)
String toLongString(Storage::Partition::Type type, uint8_t subType)
String toString(Storage::Partition::Type type, uint8_t subType)
Class to manage a NUL-terminated C-style string When storing persistent strings in RAM the regular St...
Definition: CString.h:27
Base class template for linked items with type casting.
Definition: LinkedObject.h:62
Definition: Printable.h:43
Represents a storage device (e.g. flash memory)
Definition: Components/Storage/src/include/Storage/Device.h:34
bool getDeviceAddress(storage_size_t &address, storage_size_t size) const
Get corresponding storage device address for a given partition offset.
bool verify(uint8_t type, uint8_t subtype) const
Weak 'type' value.
Definition: Partition.h:245
std::enable_if< std::is_pod< T >::value, bool >::type read(storage_size_t offset, T &value)
Definition: Partition.h:283
Partition::Type type() const
Obtain partition type.
Definition: Partition.h:310
storage_size_t getSectorCount() const
Obtain total number of sectors in this partition.
Definition: Partition.h:455
uint8_t subType() const
Obtain partition sub-type.
Definition: Partition.h:318
FullType fullType() const
Obtain both type and subtype.
Definition: Partition.h:326
bool isReadOnly() const
Check state of partition readOnly flag.
Definition: Partition.h:385
String typeString() const
storage_size_t size() const
Obtain partition size.
Definition: Partition.h:353
static SubType::App apptypeOta(uint8_t i)
Convenience function to get SubType value for the i-th OTA partition.
Definition: Partition.h:261
uint16_t getSectorSize() const
Get sector size for block-addressable devices.
bool operator==(const Partition &other) const
Definition: Partition.h:421
const Disk::DiskPart * diskpart() const
If this is a disk partition, return pointer to the additional information.
Definition: Partition.h:469
bool write(storage_size_t offset, const void *src, size_t size)
Write data to the partition.
bool erase_range(storage_size_t offset, storage_size_t size)
Erase part of the partition.
bool isEncrypted() const
Check state of partition encrypted flag.
Definition: Partition.h:377
@ userMax
@ userMin
@ storage
@ invalid
@ encrypted
storage_size_t address() const
Obtain partition starting address.
Definition: Partition.h:335
storage_size_t lastAddress() const
Obtain address of last byte in this this partition.
Definition: Partition.h:344
bool read(storage_size_t offset, void *dst, size_t size)
Read data from the partition.
String longTypeString() const
bool contains(storage_size_t addr) const
Determine if given address contained within this partition.
Definition: Partition.h:416
size_t getBlockSize() const
Obtain smallest allocation unit for erase operations.
bool verify(T subType) const
Derive type from subtype, expressed as strong C++ enum.
Definition: Partition.h:251
String getDeviceName() const
Get name of storage device for this partition.
size_t printTo(Print &p) const
Definition: FileDevice.h:26
Adds information specific to MBR/GPT disk partitions.
Definition: PartInfo.h:85
Express both partition type and subtype together.
Definition: Partition.h:139
constexpr FullType(Type type, uint8_t subtype)
Definition: Partition.h:147
bool operator==(const FullType &other) const
Definition: Partition.h:160
bool operator!=(const FullType &other) const
Definition: Partition.h:165
size_t printTo(Print &p) const override
bool match(Type type, uint8_t subType) const
Definition: Partition.h:205
virtual const Disk::DiskPart * diskpart() const
Definition: Partition.h:210
Info(const String &name, FullType fullType, storage_size_t offset, storage_size_t size, Flags flags=0)
Definition: Partition.h:195
Definition: Partition.h:98
XX(type, value, desc)
@ partitionType
XX(subtype, value, desc)
@ partitionType
Internal structure describing the binary layout of a partition table entry.
Definition: partition.h:16