diff --git a/fs/cromfs/README.txt b/fs/cromfs/README.txt index 2beb37f6e6..35b4bb81bd 100644 --- a/fs/cromfs/README.txt +++ b/fs/cromfs/README.txt @@ -249,6 +249,8 @@ configuration: Or the apps/examples/elf example if you like: + CONFIG_ELF=y + # CONFIG_BINFMT_DISABLE is not set CONFIG_EXAMPLES_ELF=y CONFIG_EXAMPLES_ELF_CROMFS=y diff --git a/fs/cromfs/cromfs.h b/fs/cromfs/cromfs.h index f94f64b21c..3266882900 100644 --- a/fs/cromfs/cromfs.h +++ b/fs/cromfs/cromfs.h @@ -120,6 +120,7 @@ struct cromfs_volume_s struct cromfs_node_s { uint16_t cn_mode; /* File type, attributes, and access mode bits */ + uint16_t cn_pad; /* Not used */ uint32_t cn_name; /* Offset from the beginning of the volume header to the * node name string. NUL-terminated. */ uint32_t cn_size; /* Size of the uncompressed data (in bytes) */ diff --git a/fs/cromfs/fs_cromfs.c b/fs/cromfs/fs_cromfs.c index 3a186af8c9..09002b022f 100644 --- a/fs/cromfs/fs_cromfs.c +++ b/fs/cromfs/fs_cromfs.c @@ -71,9 +71,9 @@ struct cromfs_file_s { FAR const struct cromfs_node_s *ff_node; /* The open file node */ - uint32_t ff_offset; /* Cached offset (zero means none) */ - uint32_t ff_ulen; /* Length of uncompressed data in cache */ - FAR uint8_t *ff_buffer; /* Decompression buffer */ + uint32_t ff_offset; /* Cached block offset (zero means none) */ + uint16_t ff_ulen; /* Length of decompressed data in cache */ + FAR uint8_t *ff_buffer; /* Cached, decompressed data */ }; /* This is the form of the callback from cromfs_foreach_node(): */ diff --git a/tools/gencromfs.c b/tools/gencromfs.c index c6801fdfe2..6c5f916f49 100644 --- a/tools/gencromfs.c +++ b/tools/gencromfs.c @@ -160,6 +160,7 @@ struct cromfs_volume_s struct cromfs_node_s { uint16_t cn_mode; /* File type, attributes, and access mode bits */ + uint16_t cn_pad; /* Not used */ uint32_t cn_name; /* Offset from the beginning of the volume header to the * node name string. NUL-terminated. */ uint32_t cn_size; /* Size of the uncompressed data (in bytes) */ @@ -920,6 +921,7 @@ static void gen_dirlink(const char *name, uint32_t tgtoffs, bool dirempty) (unsigned long)g_offset, name); node.cn_mode = TGT_UINT16(DIRLINK_MODEFLAGS); + node.cn_pad = 0; g_offset += sizeof(struct cromfs_node_s); node.cn_name = TGT_UINT32(g_offset); @@ -954,17 +956,17 @@ static void gen_directory(const char *path, const char *name, mode_t mode, subtree_stream = open_tmpfile(); g_tmpstream = subtree_stream; - /* Update offsets for the subdirectory */ - - g_parent_offset = g_diroffset; /* New offset for '..' */ - g_diroffset = g_offset; /* New offset for '.' */ - /* Update the offset to account for the file node which we have not yet * written (we can't, we don't have enough information yet) */ g_offset += sizeof(struct cromfs_node_s) + namlen; + /* Update offsets for the subdirectory */ + + g_parent_offset = g_diroffset; /* New offset for '..' */ + g_diroffset = g_offset; /* New offset for '.' */ + /* We are going to traverse the new directory twice; the first time just * see if the directory is empty. The second time is the real thing. */ @@ -1002,6 +1004,7 @@ static void gen_directory(const char *path, const char *name, mode_t mode, (unsigned long)save_offset, path); node.cn_mode = TGT_UINT16(NUTTX_IFDIR | get_mode(mode)); + node.cn_pad = 0; save_offset += sizeof(struct cromfs_node_s); node.cn_name = TGT_UINT32(save_offset); @@ -1118,6 +1121,7 @@ static void gen_file(const char *path, const char *name, mode_t mode, (unsigned long)blktotal); node.cn_mode = TGT_UINT16(NUTTX_IFREG | get_mode(mode)); + node.cn_pad = 0; nodeoffs += sizeof(struct cromfs_node_s); node.cn_name = TGT_UINT32(nodeoffs);