Subversion Repositories QNX 8.QNX8 IFS tool

Rev

Rev 11 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#include "standard-types.hsl"

#pragma displayname("QNX Neutrino IFS in-kernel filesystem structures")
#pragma byteorder(little_endian)


// startup header (256 bytes)
typedef struct startup_header_s
{
                           // I - used by the QNX IPL
                           // S - used by the startup program
   unsigned __int8 signature[4];      // [I ] Header signature, "\xeb\x7e\xff\x00"
#pragma verify match_var_int("signature[0]", "0xeb")
#pragma verify match_var_int("signature[1]", "0x7e")
#pragma verify match_var_int("signature[2]", "0xff")
#pragma verify match_var_int("signature[3]", "0x00")
   unsigned __int16 version;       // [I ] Header version, i.e. 1
   unsigned __int8 flags1;         // [IS] Misc flags, 0x21 (= 0x20 | STARTUP_HDR_FLAGS1_VIRTUAL)
   unsigned __int8 flags2;         // [  ] No flags defined yet (0)
   unsigned __int16 header_size;   // [ S] sizeof(struct startup_header), i.e. 256
#pragma verify match_var_int("header_size", "256")
   unsigned __int16 machine;       // [IS] Machine type from elfdefinitions.h, i.e. 0x003E --> _ELF_DEFINE_EM(EM_X86_64, 62, "AMD x86-64 architecture")
   unsigned __int32 startup_vaddr; // [I ] Virtual Address to transfer to after IPL is done, here 0x01403008 (appears in "Entry" column for "startup.*")
   unsigned __int32 paddr_bias;    // [ S] Value to add to physical address to get a value to put into a pointer and indirected through, here 0 (no indirections)
   unsigned __int32 image_paddr;   // [IS] Physical address of image, here 0x01400f30 (appears in "Offset" column for "startup-header" which is the first entry/start of file)
   unsigned __int32 ram_paddr;     // [IS] Physical address of RAM to copy image to (startup_size bytes copied), here 0x01400f30 (same as above)
   unsigned __int32 ram_size;      // [ S] Amount of RAM used by the startup program and executables contained in the file system, here 0x00cd6128 i.e. 13 459 752 dec. which is 13 Mb. i.e. IFS file size minus 0x9eee
   unsigned __int32 startup_size;  // [I ] Size of startup (never compressed), here 0x02f148 or 192 840 bytes
   unsigned __int32 stored_size;   // [I ] Size of entire image, here 0x00cd6128 (same as ram_size)
   unsigned __int32 imagefs_paddr; // [IS] Set by IPL to where the imagefs is when startup runs (0)
   unsigned __int32 imagefs_size;  // [ S] Size of uncompressed imagefs, here 0x00ca6fe0 or 13 266 912 bytes
   unsigned __int16 preboot_size;  // [I ] Size of loaded before header, here 0xf30 or 3888 bytes (size of "bios.boot" file))
   unsigned __int16 zero0;         // [  ] Zeros
   unsigned __int32 zero[1];       // [  ] Zeros
   unsigned __int64 addr_off;      // [ S] Offset to add to startup_vaddr, image_paddr, ram_paddr, and imagefs_paddr members, here zero (0)
   unsigned __int32 info[48];      // [IS] Array of startup_info* structures (zero filled)
} startup_header;


// image header (92 bytes)
typedef struct image_header_s
{
   unsigned __int8 signature[7]; // image filesystem signature, i.e. "imagefs"
#pragma verify match_var_int("signature[0]", "0x69")
#pragma verify match_var_int("signature[1]", "0x6d")
#pragma verify match_var_int("signature[2]", "0x61")
#pragma verify match_var_int("signature[3]", "0x67")
#pragma verify match_var_int("signature[4]", "0x65")
#pragma verify match_var_int("signature[5]", "0x66")
#pragma verify match_var_int("signature[6]", "0x73")
   unsigned __int8 flags; // endian neutral flags, 0x1c
   unsigned __int32 image_size; // size from header to end of trailer (here 0xca6fe0 or 13 266 912)
   unsigned __int32 hdr_dir_size; // size from header to last dirent (here 0x12b8 or 4792)
   unsigned __int32 dir_offset; // offset from header to first dirent (here 0x5c or 92)
#pragma verify match_var_int("dir_offset", "92")
   unsigned __int32 boot_ino[4]; // inode of files for bootstrap pgms (here 0xa0000002, 0, 0, 0)
   unsigned __int32 script_ino; // inode of file for script (here 3)
   unsigned __int32 chain_paddr; // offset to next filesystem signature (0)
   unsigned __int32 spare[10]; // zerofill
   unsigned __int32 mountflags; // default _MOUNT_* from sys/iomsg.h (0)
   char mountpoint[4]; // default mountpoint for image ("/" + "\0\0\0")
} image_header_t;


#pragma hide()
typedef struct fsentry_header_s
{
   unsigned __int16 size; // size of dirent
   unsigned __int16 extattr_offset; // if zero, no extattr data
   unsigned __int32 ino; // if zero, skip entry
   unsigned __int32 mode; // mode and perms of entry
   unsigned __int32 gid;
   unsigned __int32 uid;
   unsigned __int32 mtime;
} fsentry_header_t;
#pragma show()


typedef struct fsentry_dir_s // when (mode & S_IFMT) == S_IFDIR
{
   fsentry_header_t header;
__verify(((header.mode & 0x4000) == 0x4000) && ((header.mode & 0xa000) != 0xa000));
   char path[header.size - 24]; // null terminated path (no leading slash)
} fsentry_dir_t;


typedef struct fsentry_file_s // when (mode & S_IFMT) == S_IFREG
{
   fsentry_header_t header;
__verify(((header.mode & 0x8000) == 0x8000) && ((header.mode & 0xa000) != 0xa000));
   unsigned __int32 offset; // offset from header
   unsigned __int32 size;
   char path[header.size - 24 - 8]; // null terminated path (no leading slash)
} fsentry_file_t;


typedef struct fsentry_symlink_s // when (mode & S_IFMT) == S_IFLNK
{
   fsentry_header_t header;
__verify((header.mode & 0xa000) == 0xa000);
   unsigned __int16 sym_offset;
   unsigned __int16 sym_size;
   char path_and_symlink[header.size - 24 - 4]; // null terminated path (no leading slash)
} fsentry_symlink_t;


typedef struct fsentry_device_s // when (mode & S_IFMT) == S_IF<CHR|BLK|FIFO|NAM|SOCK>
{
   fsentry_header_t header;
__verify(((header.mode & 0x4000) != 0x4000) && ((header.mode & 0x8000) != 0x8000) && ((header.mode & 0xa000) != 0xa000));
   unsigned __int32 dev;
   unsigned __int32 rdev;
   char path[header.size - 24 - 8]; // null terminated path (no leading slash)
} fsentry_device_t;


typedef struct image_trailer_s
{
   unsigned __int32 cksum; // checksum from start of header to start of trailer
} image_trailer_t;