15 Commits
Author SHA1 Message Date
Ernesto A. Fernández 628b6810e4 0.3.20
This quick release adds support for the fsconfig() syscall, otherwise
newer versions of the mount tool won't accept any options.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-25 16:28:02 -03:00
Ernesto A. Fernández 7aca589f9e Use ->parse_param(), not ->parse_monolithic()
SergDL reports that mounts seem broken for the 7.0 kernel:

  https://github.com/linux-apfs/linux-apfs-rw/issues/119

I never encountered this problem during testing, probably because my
version of the mount tool is older. It seems that mount options are now
set one by one using the fsconfig() syscall, and that's not possible if
we parse them all at once with ->parse_monolithic().

Implement ->parse_param() instead, at least for the latest kernel. I do
wonder if this issue won't pop up with older kernels though, since the
fsconfig() syscall has been around since 5.2. I guess I'll wait to see
if somebody complains about it.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-24 17:10:07 -03:00
Ernesto A. Fernández 36df7e0b35 Set default mount options as soon as possible
Instead of setting the default mount options right before parsing the
actual options, set them on the superblock as soon as it gets allocated.
This will allow the parsing code to be called more than once by the new
mount api.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-24 14:56:03 -03:00
Ernesto A. Fernández ae381fbc3d Move default mount options into separate function
The new mount api forces me to make one function call for each option to
parse. This change means that the default options will need to get set
elsewhere, otherwise each new call would reset to default.

As a first step, move that code from parse_options() into a new
apfs_set_default_opts().

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-24 14:48:27 -03:00
Ernesto A. Fernández f95bcc94c9 0.3.19
This release adds support for the upcoming 7.0 kernel version, with a
patch by Alessio Faina. Aditya Garg also contributes a fix for a build
issue caused by the makefile.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-10 17:55:21 -03:00
Ernesto A. Fernández 911bbe1743 Simplify cleanup labels in mount/get_tree()
Reorganize the version check in the out_free_sbi label to better match
the simpler one at out_unmap_super.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-03 21:01:11 -03:00
Ernesto A. Fernández 6d54029be9 Unify parse_options() and preparse_options()
Following the previous patch, which made parse_options() always run
right after preparse_options(), merge both functions into one.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-03 20:58:00 -03:00
Ernesto A. Fernández 88b36a788e Run parse_options() earlier for kernels < 7.0
Since the mount api conversion, kernel version 7.0 and above parse all
the options at once before moving on to the rest of the mount process.
There is no reason that other kernel versions can't do the same; in fact
that was originally my intention, as explained in the commit message for
af2ee526c0 ("Avoid double parsing of mount options"). So always call
parse_options() right after preparse_options(). The plan is to unify
these functions next.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-03 20:26:01 -03:00
Ernesto A. Fernández ef79bb1bee Always call parse_options() with the sb info
Inside parse_options(), some kernel versions retrieve the superblock
info from the vfs superblock, while others retrieve it from the
filesystem context. Instead just pass the info as an argument and
simplify the version checks.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-03 20:06:10 -03:00
Ernesto A. Fernández 67eb48bb34 Fix whitespace issues from mount api conversion
I seem to have missed a few whitespace issues during my review of the
recent mount api conversion. Fix them now.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-03 19:47:39 -03:00
Ernesto A. Fernández 9aadac614c Get rid of nx_flags variable from parse_options()
At this point, the nx_flags variable only exists to get copied into
s_mount_opt of the superblock. Just work with s_mount_opt directly and
get rid of the goto label.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-03 19:44:47 -03:00
Ernesto A. Fernández 1158bd03a6 Use s_mount_opt for all kernel versions
I'm trying to unify mount option processing across kernel versions as
much as possible. Instead of calling parse_options_set_flags() directly
from parse_options() whenever possible, always set the new s_mount_opt
and use it to call parse_options_set_flags() later.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-03 19:26:43 -03:00
Ernesto A. Fernández 351c7cf826 Always init s_uid/s_gid inside parse_options()
Move s_uid/s_gid initialization inside parse_options() for all kernel
versions, getting rid of a version check for kernels 7.0 and above.

Signed-off-by: Ernesto A. Fernández <ernesto@corellium.com>
2026-04-03 19:09:40 -03:00
Alessio Faina 61672f2caf Add support to kernel 7.0 fs new mount APIs (LP: #2142837) (#114)
As all the in-tree modules has been ported to the new Kernel 7
fs mount API, the old API has been removed.

This patch add the support for the new set of APIs, while
keeping previous kernel support intact.

The code is in review on the Canonical Launchpad bug
https://launchpad.net/bugs/2142837 as well

Signed-off-by: Alessio Faina <alessio.faina@canonical.com>
2026-03-17 13:12:50 -03:00
Aditya Garg 0459ba0998 Rename $(CONFIG) to $(APFS_CONFIG) (#116) 2026-03-12 13:08:09 -03:00
5 changed files with 270 additions and 127 deletions

No files matched your search

+2 -2
View File
@@ -14,9 +14,9 @@ apfs-y := btree.o compress.o dir.o extents.o file.o inode.o key.o libzbitmap.o \
spaceman.o super.o symlink.o transaction.o unicode.o xattr.o xfield.o
# If you want mounts to be writable by default, run the build as:
# make CONFIG=-DCONFIG_APFS_RW_ALWAYS
# make APFS_CONFIG=-DCONFIG_APFS_RW_ALWAYS
# This is risky and not generally recommended.
ccflags-y += $(CONFIG)
ccflags-y += $(APFS_CONFIG)
default:
./genver.sh
+4 -1
View File
@@ -380,6 +380,7 @@ struct apfs_sb_info {
unsigned int s_vol_nr; /* Index of the volume in the sb list */
kuid_t s_uid; /* uid to override on-disk uid */
kgid_t s_gid; /* gid to override on-disk gid */
unsigned int s_mount_opt;
struct apfs_crypto_state_val *s_dflt_pfk; /* default per-file key */
@@ -1040,7 +1041,9 @@ extern int apfs_setattr(struct mnt_idmap *idmap,
struct dentry *dentry, struct iattr *iattr);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 0, 0)
extern int apfs_update_time(struct inode *inode, enum fs_update_time time, unsigned int flags);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)
extern int apfs_update_time(struct inode *inode, struct timespec64 *time, int flags);
#else
extern int apfs_update_time(struct inode *inode, int flags);
+1 -1
View File
@@ -1,5 +1,5 @@
PACKAGE_NAME="linux-apfs-rw"
PACKAGE_VERSION="0.3.18"
PACKAGE_VERSION="0.3.20"
BUILT_MODULE_NAME[0]="apfs"
DEST_MODULE_LOCATION[0]="/extra"
+6 -2
View File
@@ -2109,7 +2109,9 @@ fail:
}
/* TODO: this only seems to be necessary because ->write_inode() isn't firing */
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 0, 0)
int apfs_update_time(struct inode *inode, enum fs_update_time time, unsigned int flags)
#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)
int apfs_update_time(struct inode *inode, struct timespec64 *time, int flags)
#else
int apfs_update_time(struct inode *inode, int flags)
@@ -2123,7 +2125,9 @@ int apfs_update_time(struct inode *inode, int flags)
return err;
apfs_inode_join_transaction(sb, inode);
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && !RHEL_VERSION_GE(9, 6)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 0, 0)
generic_update_time(inode, time, flags);
#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0) && !RHEL_VERSION_GE(9, 6)
generic_update_time(inode, time, flags);
#else
generic_update_time(inode, flags);
+257 -121
View File
File diff suppressed because it is too large. Load diff