86 template <
typename T>
static T
at_offset(
const void* current,
int offset)
88 auto p =
reinterpret_cast<const uint8_t*
>(current) + offset;
89 return reinterpret_cast<T
>(p);
92 template <
typename T>
static T
at_offset(
void* current,
int offset)
94 auto p =
reinterpret_cast<uint8_t*
>(current) + offset;
95 return reinterpret_cast<T
>(p);
99 #define FWFILESYS_START_MARKER 0x53465746 // "FWFS" 102 #define FWFILESYS_END_MARKER 0x46574653 // "SFWF" 114 #define FWFS_OBJTYPE_MAP(XX) \ 115 XX(0, End, "The system image footer") \ 116 XX(1, Data8, "Data, max 255 bytes") \ 117 XX(2, ID32, "32-bit identifier") \ 118 XX(3, ObjAttr, "Object attributes") \ 119 XX(4, Compression, "Compression descriptor") \ 120 XX(5, ReadACE, "minimum UserRole for read access") \ 121 XX(6, WriteACE, "minimum UserRole for write access") \ 122 XX(7, ObjectStore, "Identifier for object store") \ 123 XX(8, Md5Hash, "MD5 Hash Value") \ 124 XX(32, Data16, "Data, max 64K - 1") \ 125 XX(33, Volume, "Volume, top-level container object") \ 126 XX(34, MountPoint, "Root for another filesystem") \ 127 XX(35, Directory, "Directory entry") \ 128 XX(36, File, "File entry") \ 129 XX(64, Data24, "Data, max 16M - 1") 146 #define XX(value, tag, text) tag = value, 175 return static_cast<Type>(typeData & 0x7f);
185 return type() >= Type::Volume &&
type() < Type::Data24;
190 return type() == Type::Data8 ||
type() == Type::Data16 ||
type() == Type::Data24;
195 return type() == Type::Directory;
200 return type() == Type::MountPoint;
273 uint32_t
size()
const 293 unsigned nameOffset()
const 301 return nameOffset() +
ALIGNUP4(namelen);
324 void setContentSize(uint32_t
value)
326 _contentSize = value & 0xffff;
327 _contentSizeHigh = value >> 16;
330 uint32_t
size()
const 342 return data8.contentOffset();
343 }
else if(
type() < Type::Data24) {
344 return data16.contentOffset();
346 return data24.contentOffset();
357 return data8.contentSize();
358 }
else if(
type() < Type::Data24) {
359 return data16.contentSize();
361 return data24.contentSize();
368 return data16.contentOffset() +
data16.named.childTableOffset();
374 return data16.contentSize() -
data16.named.childTableOffset();
392 static_assert(
sizeof(
Object) == 8,
"Object alignment wrong!");
#define MAX(a, b)
Definition: spiffs_nucleus.h:541
uint32_t contentSize() const
return size of object content, excluding header and size fields
Definition: Object.h:354
Type
Definition: Compression.h:39
struct IFS::Object::@17::@19::@22::@24 ref
uint32_t checksum
Definition: Object.h:253
uint16_t _contentSize
Object size (excluding this header)
Definition: Object.h:260
#define FWFS_OBJTYPE_MAP(XX)
Object type identifiers.
Definition: Object.h:114
struct IFS::Object::@17::@19 data8
Compression::Type type
Definition: Object.h:237
Object structure.
Definition: Object.h:137
uint8_t attr
Definition: Object.h:232
uint32_t size() const
total size this object occupies in the image
Definition: Object.h:381
size_t contentOffset() const
return offset to start of object content
Definition: Object.h:339
bool isNamed() const
Definition: Object.h:183
bool isRef() const
Definition: Object.h:178
uint8_t typeData
Stored type plus flag.
Definition: Object.h:138
String toString(IFS::Object::Type obt)
Get descriptive String for an object type.
struct IFS::Object::@17::@20 data16
The String class.
Definition: WString.h:136
TimeStamp mtime
Definition: Object.h:288
ID id
Definition: Object.h:222
bool isData() const
Definition: Object.h:188
struct IFS::Object::@17::@19::@22::@26 objectAttributes
Definition: DirectoryTemplate.h:36
Manage IFS timestamps stored as an unsigned 32-bit value.
Definition: TimeStamp.h:35
uint8_t namelen
Length of object name.
Definition: Object.h:287
uint32_t childTableOffset() const
Definition: Object.h:365
uint8_t _contentSizeHigh
Allows data up to 16MByte.
Definition: Object.h:311
uint8_t storenum
Definition: Object.h:248
struct IFS::Object::@17::@19::@22::@27 compression
static constexpr uint8_t FWOBT_REF
Definition: Object.h:152
Attribute
Object attributes.
Definition: Object.h:158
struct IFS::Object::@17::@21 data24
UserRole
Definition: UserRole.h:36
UserRole role
Definition: Object.h:243
struct IFS::Object::@17::@19::@22::@28 ace
bool isDir() const
Definition: Object.h:193
struct IFS::Object::@17::@19::@22::@25 id32
uint32_t value
32-bit identifier, e.g. volume ID
Definition: Object.h:227
struct IFS::Object::@17::@19::@22::@29 objectStore
struct IFS::Object::@17::@20::@31::@33 named
static T at_offset(const void *current, int offset)
Definition: Object.h:86
struct IFS::Object::@17::@19::@22::@30 end
uint32_t childTableSize() const
Definition: Object.h:371
Type
Definition: Object.h:145
uint8_t _contentSize
Definition: Object.h:206
uint32_t sizeAligned() const
Definition: Object.h:386
Type type() const
Definition: Object.h:173
#define ALIGNUP4(n)
Align a size up to the nearest word boundary.
Definition: FakePgmSpace.h:39
uint32_t originalSize
Definition: Object.h:238
bool isMountPoint() const
Definition: Object.h:198