From fc0fca231b8cb607c5af1755f38ce0e1d6535ab0 Mon Sep 17 00:00:00 2001 From: Morning <391091+moonsoup@users.noreply.github.com> Date: Sun, 5 Jul 2026 15:43:43 -0500 Subject: [PATCH] Fix macOS build: adapt getxattr to the Darwin 5-arg signature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit macOS FUSE implementations (macFUSE, FUSE-T) declare the getxattr operation with an extra trailing `uint32_t position` argument — the Darwin resource-fork xattr convention. Assigning the shared 4-arg op_getxattr to .getxattr then fails to compile with an incompatible-function-pointer-type error (ref upstream issue #143). Add an __APPLE__-only shim that accepts and ignores `position` and defers to the existing op_getxattr. No behavior change on Linux/BSD; ext2 has no resource-fork concept, so dropping `position` is correct. The #ifdef keeps the non-Darwin build using the 4-arg op_getxattr unchanged. Tested: builds and mounts read-only on macOS 26.5.1 (Apple Silicon, Darwin 25.5.0), macFUSE 5.2, Apple clang; read-only verification passes on ext2/ext3/ext4 throwaway images. Single-environment test only; broader platform testing not yet done. Co-Authored-By: Claude Opus 4.8 --- fuse-ext2/fuse-ext2.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/fuse-ext2/fuse-ext2.c b/fuse-ext2/fuse-ext2.c index 249a389c..6f2351de 100644 --- a/fuse-ext2/fuse-ext2.c +++ b/fuse-ext2/fuse-ext2.c @@ -277,6 +277,19 @@ static char * parse_mount_options (const char *orig_opts, struct extfs_data *opt goto exit; } +#ifdef __APPLE__ +/* macOS FUSE (macFUSE / FUSE-T) declares getxattr with an extra trailing + * `position` argument, for the Darwin resource-fork xattr convention. ext2 has + * no such concept, so this shim drops `position` and defers to the shared + * Linux-style op_getxattr. Without it the build fails with an incompatible + * function-pointer-type error assigning op_getxattr to .getxattr. */ +static int op_getxattr_darwin(const char *path, const char *name, char *value, + size_t size, uint32_t position) { + (void) position; + return op_getxattr(path, name, value, size); +} +#endif + static const struct fuse_operations ext2fs_ops = { .getattr = op_getattr, .readlink = op_readlink, @@ -298,7 +311,11 @@ static const struct fuse_operations ext2fs_ops = { .release = op_release, .fsync = op_fsync, .setxattr = NULL, +#ifdef __APPLE__ + .getxattr = op_getxattr_darwin, +#else .getxattr = op_getxattr, +#endif .listxattr = NULL, .removexattr = NULL, .opendir = op_open,