apache / apache/nuttx

gencromfs hardlink improvement

Open
#1,557 0 comments 0 reactions 0 assignees View on GitHub
Type: Enhancement
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

A directory in the CROMFS file system is a simple, singly linked list of "node" structures. Each node in the list may represent either a directory, a file, or a hard link. For the case of the directory, it simply refers to the first node in the link list that defines that directory. The first entry of that list is always the "." hard link node.

The CROMFS "." entry and ".." refer to the first entry in the directory list, ".", instead of to the directory entry itself. Hence, we cannot traverse "." or ".." to determine the type of the link target. In this case the link target should be to the directory entry to detect the directory node type. NOTE also that there is no root directory entry for the top "." to refer to.

There is currently a kludge in fs/cromfs to work around this behavior but that kludge should not be necessary.

Another problem is that the gencromfs tools will not generate any user hard links. It, of course, should ignore soft links and hard links are probably not detectable with stat() so the target link would probably be duplicated in full.

I think we should add a command line argument like the following to apply hardlinks:

-ln

gencromfs should also support commands in a file so that an image with lots of hard links would not be result in a long command line.

Or, perhaps we should not ignore soft links? Perhaps we should (1) test if the soft link lies in the CROMFS image, and if so, (2) replace it with a hard link?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.