A single call to apfs_readdir() is not necessarily enough to list a
whole directory; ctx->pos tries to keep track of the last dentry found,
so that the next call can continue from the same spot.
Now that the module can create large numbers of files, it has become
obvious that this doesn't work: many files are missing from the ls
output for big directories. The bug is very simple: ctx->pos is being
incremented twice for each new record. Remove one of the increments.
This patch is a backport of commit 39e4474396cd ("apfs: fix reading of
large directories") from the development tree, so it will be dropped for
the next "release". From now on this branch can be considered stable.
Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>
Copy the code of the APFS module into its own repository, without the
rest of the kernel tree. Development will continue upstream, but the
intention is to make life easier for potential users.
To get the module to build independently, rewrite the Makefile and
add a definition for the APFS_SUPER_MAGIC macro. Since the intention is
to support a range of kernel versions, use preprocessor checks to handle
kernels without statx, without iversion, and without SB_RDONLY.
Provide a README file based on the upstream documentation, but with
additional build and mount instructions. Add a LICENSE file as well.
Signed-off-by: Ernesto A. Fernández <ernesto.mnd.fernandez@gmail.com>