This patch adds the block based dirent lookup support to pkg/erofs,
which will do the dirent lookup by doing binary search on disk data
directly. This is helpful for searching files in large directories
and also reduces the memory overhead.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
- Add more sanity checks on dirent name offset and length.
- Both of "super block" and "superblock" are used in comments and
strings now, let's convert all "super block" to "superblock".
- Add some comments that can add clarity.
- Refactor the code in tests to make it easier to add more tests.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
Currently, when we access the on-disk filesystem objects, the objects
will be copied to temporary buffers and will escape to heap. This patch
gets rid of these unnecessary copies and escapes by casting and using
the memory backed by the image file directly.
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
For each directory, _all_ the on-disk directory entries are _strictly_
recorded in alphabetical order. There is no special treatment of "." and
"..". Thanks to @hsiangkao for pointing out this bug.
Fixes: eca83ac68c ("Add initial support for EROFS")
Reported-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
This patch adds initial support for EROFS [1]. Below is a brief
summary of the supported features.
Both inode formats are supported:
- compact format (32 bytes);
- extended format (64 bytes);
Below data layouts are supported:
- flat file data without data inline (no extent);
- flat file data with tail packing data inline (no extent);
Below file types are supported:
- directory;
- regular file;
- symlink;
Special files (e.g. fifo) can be listed, but cannot be accessed.
With this patch, sentry will be able to mount the EROFS image
created with below command and access the files on it.
mkfs.erofs -E noinline_data <IMAGE FILE> <SOURCE DIRECTORY>
[1] https://docs.kernel.org/filesystems/erofs.html
Updates #8956
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>