struct jffs2_unknown_node { jint16_t magic; /* A constant magic number. */ jint16_t nodetype; jint32_t totlen; /* Total length of this node (inc data, etc.) */ jint32_t hdr_crc; /* Crc checksum */ }; size = 12 bytesEvery type of node on flash starts with this common header. It contains a magic number (0x1985), which identifies the JFFS2 node. nodetype defines the type of the node. totlen shows the size of the node including node header and data. Finally, there is a CRC checksum (hdr_crc), which grants the correctness of the node header.
struct jffs2_raw_dirent { jint16_t magic; /* A constant magic number. */ jint16_t nodetype; /* == JFFS_NODETYPE_DIRENT */ jint32_t totlen; /* Total length of this node (inc data, etc.) */ jint32_t hdr_crc; /* CRC checksum */ jint32_t pino; jint32_t version; jint32_t ino; jint32_t mctime; uint8_t nsize; uint8_t type; uint8_t unused[2]; jint32_t node_crc; jint32_t name_crc; uint8_t name[0]; }; size = 40 + name length + 1 bytesjffs2_raw_dirent represents a directory entry on the flash. pino stores the inode number of the parent inode. Every dirent node has a version number. ino contains the inode number which belongs to the dirent. mctime time of the creation. nsize is the size of the dirent's name. type stores the type of the dirent (directory (DT_DIR), symlink (DT_LNK), etc.). node_crc is a CRC checksum of the node except node_crc, name_crc and data (name). name_crc is a CRC checksum of the dirent's name (name field). name stores the name of the dirent (name length + 1).
struct jffs2_raw_inode { jint16_t magic; /* A constant magic number. */ jint16_t nodetype; /* == JFFS_NODETYPE_INODE */ jint32_t totlen; /* Total length of this node (inc data, etc.) */ jint32_t hdr_crc; /* Crc checksum */ jint32_t ino; /* Inode number. */ jint32_t version; /* Version number. */ jmode_t mode; /* The file's type or mode. */ jint16_t uid; /* The file's owner. */ jint16_t gid; /* The file's group. */ jint32_t isize; /* Total resultant size of this inode (used for truncations) */ jint32_t atime; /* Last access time. */ jint32_t mtime; /* Last modification time. */ jint32_t ctime; /* Change time. */ jint32_t offset; /* Where to begin to write. */ jint32_t csize; /* (Compressed) data size */ jint32_t dsize; /* Size of the node's data. (after decompression) */ uint8_t compr; /* Compression algorithm used */ uint8_t usercompr; /* Compression algorithm requested by the user */ jint16_t flags; /* See JFFS2_INO_FLAG_* */ jint32_t data_crc; /* CRC for the (compressed) data. */ jint32_t node_crc; /* CRC for the raw inode (excluding data) */ uint8_t data[0]; }; size = 68 + compressed data length bytesjffs2_raw_inode represents a slice of data (file) on flash. ino stores the inode number. mode describes the file type or mode.
Havasi Ferenc 2005-12-22