Commit Graph

23 Commits

Author SHA1 Message Date
Gregory Nutt
b256b2055f Add support to hard links to CROMFS
This will resolve numerous problems with the way that hard links, in particular "." and ".." are handled.  Instead of trying to fudge the stat flags, the correct implementation is to follow the hard link to the final link target node.  That is what must determine the attributes of the directory entry.
2020-08-11 07:48:08 -07:00
David Sidrane
562be9e4c7 gencromfs:Fix mode flags seperate code points for DIR LNK 2020-08-10 11:04:13 -06:00
Xiang Xiao
8807a52de6 tools/gencromfs: Change the generated code to Apache license
and ensure the code confirm the coding style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-09 14:43:56 +01:00
Xiang Xiao
4de69080d0 tools/gencromfs: Call dump_nextline immediately after dump_hexbuffer
to handle the temporary file switch correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-09 14:43:56 +01:00
David Sidrane
b6194bc0bf tools/gencromfs: partial fix coding standard violation
Remaining violation seem to be an issue with the
   tool parsing  outptr[- lit - 1] = lit - 1
2020-08-06 08:36:03 -05:00
David Sidrane
fbd5712761 Fix Breakage from 91ed14c6
PR 1372 vfs/stat: Make the flag defintion more confirm POSIX
   standard. Silently broke the cromfs. This was due to the
   necessary replication of the S_xxxx flags of the NuttX
   sys/stat.h. The unfortunate outcome was most likely caused by
   fact, that a grep of S_xxxx did not match the tools/gencromfs.c

   To insure this sort of thing does not happen again, comments
   have been added the will match search.
2020-08-06 08:36:03 -05:00
Xiang Xiao
bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Xiang Xiao
6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
David Sidrane
39ac045cff tools/gencromfs.c: Fix build on macOS 2018-12-26 14:35:20 -06:00
David Sidrane
7fef81ea94 gencromfs.c:1171:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result] 2018-12-13 12:40:40 -06:00
Gregory Nutt
3f5a3d0962 tools/gencromfs.c: Need to include stdint.h. 2018-07-14 17:06:47 -06:00
Jussi Kivilinna
214e9d923e Commit 0c963449d6, 'fs/vfs: Added support for checking if a descriptor is a socket in fstat().', changed sys/stat.h in way that breaks smartfs file-type stat flags. CROMFS is similarly broken, as tools/gencromfs.c was not updated to match the sys/stat.h changes. This commit fixes both issues. It probably is not a good idea to use NuttX sys/stat.h bit-field values directly in stored structure of filesystem. 2018-06-28 07:40:35 -06:00
Gregory Nutt
db3b507a41 tools/gencromfs.c: Was duplicating all mode bits in source directory in CROMFS directory. Some make no sense. In particular, all write-able bits are cleard unconditionally. Executable bits are still copying because there is really no way for the tool to know if the file is executable or not. 2018-03-24 15:05:22 -06:00
Gregory Nutt
67e0603b5a fs/cromfs: Block length only needs to be uint16_t, not uint32_t. Add pading to node structure to assue that alignment is the same on all platforms. tools/gencromfs.c: Fix the target offset of the '.' hard link. 2018-03-24 14:44:38 -06:00
Gregory Nutt
853c1234ac tools/gencromfs.c: Missing 'const'. CROMFS file system was ending up in data, not FLASH 2018-03-24 11:54:01 -06:00
Gregory Nutt
3ec02adee0 tools/genromfs.c: Improve check for empty directories. If the directory contains only unsupported, special files, then it is still empty. Fix some collection of statistics that was cause statfs() to return some incorrect values. Add logic to handle the case where the host and the target differ in endian-ness. fs/procfs: In show mountpoints, add support so that the CROMFS file system type is recognized. 2018-03-21 08:40:02 -06:00
Gregory Nutt
d41f308bf1 tools/gencromfs.c: Add logic to correctly handle empty directories. 2018-03-20 17:34:26 -06:00
Gregory Nutt
16d0a8c2d1 fs/cromfs: More directory traversal fixes. tools/gencromfs.c: Add ability use a callback with directory traversal. Not currently used but left in place in case it is needed in the future. 2018-03-20 16:20:31 -06:00
Gregory Nutt
aeeee54921 tools/gencromfs.c and fs/cromfs: More corrections to directory traversal logic. Still some bugs. 2018-03-20 14:30:05 -06:00
Gregory Nutt
22484386ee fs/cromfs and tools/gencromfs: Various fixes for traversal relative file paths. Biggest changes is in types used: Cannot use size_t or mode_t in common structures because they have different sizes on the (64-bit) host and the (32-bit) target. Use uint32_t instead of size_t for offsets. Use uint16_t instead of mode_t. 2018-03-20 12:37:01 -06:00
Gregory Nutt
87fd4e2916 fs/cromfs: Fix read logic. tools/genromfs.c: Last node in directory needs to have zero for peer offset. Still some issues with empty directories. 2018-03-20 10:37:42 -06:00
Gregory Nutt
d6b9802264 tools/gencromfs.c: Fix a mixconception about how nested directories should be traversed. 2018-03-20 08:50:59 -06:00
Gregory Nutt
eec44d1f01 This commit adds tools/gencromfs.c, a tool that can be used to generate CROMFS file system images.
Squashed commit of the following:

    tools/gencromfs.c:  Seems basically functional but has not has not yet been integrated with CROMFS.
    tools/gencromfs.c:  Revist previous commit.  Let's make no assumptions about the compatibility of the host system and NuttX.
    tools/gencromfs.c:  I think access mode bits are sufficiently standard that we can just copy them from the host.  This is don't mostly to pick up the executable bits and other conbinations of bits without doing a bit-for-bit decode.
    tools/gencromfs.c:  Code complete but only partially functional.
    tools/gencromfs.c:  type definitions must precede data definitions
    tools/gencromfs.c:  Adds a little more logic to gencromfs tools.  Still not complete but can traverse directories and generate directory and hard-link nodes.
    tools/gencromfs.c: Beginning of a genromfs tool that will eventually be used for generation of CROMFS file system images.
2018-03-20 07:31:13 -06:00