Repository navigation
Keep a FUSE 2 code path for Windows - #578
Conversation
Dokany's FUSE wrapper implements FUSE 2.7 and there is no libFUSE 3 version of it, so the Windows build cannot use the FUSE 3 API. Its dokan_fuse/include/fuse_common.h hardcodes FUSE_MAJOR_VERSION 2 and FUSE_MINOR_VERSION 7, getattr has no fuse_file_info, rename has no flags, init has no fuse_config, readdir has no flags and a four argument filler, and there are no FUSE_CAP_* constants at all. dokan-dev/dokany#182, asking for a newer FUSE API, has been open since 2016. Since the sources became FUSE 3 only, every Windows job in CI fails at build: Fuse.cpp(1170): error C2039: 'want': is not a member of 'fuse_conn_info' Fuse.cpp(1170): error C2065: 'FUSE_CAP_POSIX_LOCKS': undeclared identifier This adds the compile-time switch issue #419 asks for, without duplicating the file system code. The fspp interface keeps its FUSE 3 shape on both APIs: Fuse::getattr always takes a fuse_file_info, Fuse::rename always takes flags, and so on. Only the wrappers that libfuse calls differ, and only where the two APIs actually disagree: - getattr and truncate split back into getattr/fgetattr and truncate/ftruncate, both pairs calling the same Fuse method with and without the handle. That is exactly the dispatch FUSE 3 asks for, written as two entry points. - rename, chmod, chown and utimens lose the parameter FUSE 3 added, and pass 0 or nullptr for it. FUSE 2 never implemented FUSE_RENAME2, so a flagged rename never reaches the file system there. - readdir loses the flags parameter and calls the four argument filler. - init has no fuse_config, and no capability negotiation, because Dokany has neither conn->want nor any FUSE_CAP_* constant. params.h picks the API and declares the two FUSE 3 types the fspp interface mentions, fuse_readdir_flags and fuse_config, when they are missing. Nothing outside the wrappers looks inside either: the config pointer is unused and the readdir flags are always FUSE_READDIR_DEFAULTS on FUSE 2. stat_compatibility.h now goes through params.h instead of including <fuse.h> directly, so FUSE_USE_VERSION is set no matter which header is included first. Windows cannot be built here, so this was verified by compiling the real src/fspp/fuse/Fuse.cpp against Dokany's own dokan_fuse headers with both GCC and Clang, which works because Dokany's fuse.h maps FUSE_STAT and FUSE_OFF_T to the platform types when _WIN32 isn't defined. Both compile it clean, as do Fuse.h and stat_compatibility.h on their own. The MSVC and Dokan API specific blocks are separately guarded on _MSC_VER and are unchanged. Linux is unaffected: fspp-test still passes 1007 tests. macOS is a separate change, see the macFUSE pull request. Both touch params.h, so whichever lands second needs a trivial merge there. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
|
The merge with #577 is trivial, and I have verified it rather than just asserting it. The two changes nest:
Note for whoever merges second: #577 adds an #577 also now carries the libFUSE version floor and the Generated by Claude Code |
…ndows-fuse2-path The base branch gained Capabilities.cpp, which uses FUSE_CAP_* constants that Dokany's FUSE 2.7 headers don't have. Guard it the same way as the rest of the FUSE 3 only code, and keep the capability negotiation in Fuse::init() inside the FUSE_MAJOR_VERSION check. Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
…s-fuse2-path Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
…s-fuse2-path #576 added the is_null_path() helper at the top of the anonymous namespace in Fuse.cpp, which is exactly where this branch opens its #if FUSE_MAJOR_VERSION >= 3 for the getattr/fgetattr split, so the two collided. Resolved by nesting rather than choosing: is_null_path() stays before the guard. It has to, because seven of its fifteen call sites (open, read, write, flush, release, fsync, readdir and friends) are in operations that are compiled on both the FUSE 2 and the FUSE 3 path, so defining it inside the guard would not compile on Windows. The FUSE 2 branches deliberately do not get the null-path guard. libfuse only passes a null path when the file system sets nullpath_ok, and Dokany's wrapper - FUSE_MAJOR_VERSION 2, FUSE_MINOR_VERSION 7 - has no such member: grepping its headers for nullpath_ok and flag_nullpath_ok finds nothing, while upstream libfuse 2.9.9 has flag_nullpath_ok and 3.9.0 has nullpath_ok. There is no way for a null path to arrive on the Dokany path, so guarding there would add dead code. Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
…support #578 landed first, so this is the params.h merge I said in the pull request I would do. Both changes rewrite the same few lines for opposite reasons: #578 selects the FUSE 2 API because Dokany's wrapper has no libFUSE 3 counterpart, this branch selects FUSE 3 and turns macFUSE's Darwin extensions off. They nest rather than compete. _MSC_VER picks the API on the outside; __APPLE__ picks the extensions inside the non-Windows branch, so the Darwin define can only be reached on a build that already chose FUSE 3. The second hunk keeps both guards as independent blocks instead of one chain, because they answer different questions: a FUSE 2 header off Windows is a misconfiguration and still gets the #error, while a FUSE 2 header on Windows is expected and gets the fuse_readdir_flags and fuse_config declarations. Verified by preprocessing the resolved header against real headers: Linux, libfuse 3.14 -> 39, no Darwin define, no error macOS, macFUSE 3.18 -> 39, FUSE_DARWIN_ENABLE_EXTENSIONS 0 non-MSVC + a FUSE 2 header -> #error fires MSVC + Dokany's headers -> 27, no error, both types declared Co-Authored-By: Claude <[email protected]> Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
Dokany's FUSE wrapper implements FUSE 2.7 and there is no libFUSE 3 version of it, so the Windows build cannot use the FUSE 3 API. Its dokan_fuse/include/fuse_common.h hardcodes FUSE_MAJOR_VERSION 2 and FUSE_MINOR_VERSION 7, getattr has no fuse_file_info, rename has no flags, init has no fuse_config, readdir has no flags and a four argument filler, and there are no FUSE_CAP_* constants at all. dokan-dev/dokany#182, asking for a newer FUSE API, has been open since 2016. Since the sources became FUSE 3 only, every Windows job in CI fails at build: Fuse.cpp(1170): error C2039: 'want': is not a member of 'fuse_conn_info' Fuse.cpp(1170): error C2065: 'FUSE_CAP_POSIX_LOCKS': undeclared identifier This adds the compile-time switch issue #419 asks for, without duplicating the file system code. The fspp interface keeps its FUSE 3 shape on both APIs: Fuse::getattr always takes a fuse_file_info, Fuse::rename always takes flags, and so on. Only the wrappers that libfuse calls differ, and only where the two APIs actually disagree: - getattr and truncate split back into getattr/fgetattr and truncate/ftruncate, both pairs calling the same Fuse method with and without the handle. That is exactly the dispatch FUSE 3 asks for, written as two entry points. - rename, chmod, chown and utimens lose the parameter FUSE 3 added, and pass 0 or nullptr for it. FUSE 2 never implemented FUSE_RENAME2, so a flagged rename never reaches the file system there. - readdir loses the flags parameter and calls the four argument filler. - init has no fuse_config, and no capability negotiation, because Dokany has neither conn->want nor any FUSE_CAP_* constant. params.h picks the API and declares the two FUSE 3 types the fspp interface mentions, fuse_readdir_flags and fuse_config, when they are missing. Nothing outside the wrappers looks inside either: the config pointer is unused and the readdir flags are always FUSE_READDIR_DEFAULTS on FUSE 2. stat_compatibility.h now goes through params.h instead of including <fuse.h> directly, so FUSE_USE_VERSION is set no matter which header is included first. Windows cannot be built here, so this was verified by compiling the real src/fspp/fuse/Fuse.cpp against Dokany's own dokan_fuse headers with both GCC and Clang, which works because Dokany's fuse.h maps FUSE_STAT and FUSE_OFF_T to the platform types when _WIN32 isn't defined. Both compile it clean, as do Fuse.h and stat_compatibility.h on their own. The MSVC and Dokan API specific blocks are separately guarded on _MSC_VER and are unchanged. Linux is unaffected: fspp-test still passes 1007 tests. macOS is a separate change, see the macFUSE pull request. Both touch params.h, so whichever lands second needs a trivial merge there. Claude-Session: https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP Co-authored-by: Claude <[email protected]>
This is the Windows half of the blocker from the review. The macOS half is a separate pull request; together they cover the platforms the migration broke.
Why Windows needs its own path
Dokany's FUSE wrapper implements FUSE 2.7 and there is no libFUSE 3 version of it. Its
dokan_fuse/include/fuse_common.hhardcodes:getattrhas nofuse_file_info,renamehas noflags,inithas nofuse_config,readdirhas no flags and a four-argument filler,fgetattrandftruncateare still separate operations, and there are noFUSE_CAP_*constants at all. dokany#182, asking for a newer FUSE API, has been open since February 2016 with no maintainer commitment, and the current release, v2.3.1.1000, still ships the 2.7 wrapper.So unlike macOS, Windows cannot simply move to FUSE 3. Since the sources became FUSE 3 only, every Windows job in the branch's CI fails at build:
This adds the compile-time switch issue #419 asks for, without duplicating any filesystem code.
How it is split
The
fsppinterface keeps its FUSE 3 shape on both APIs.Fuse::getattralways takes afuse_file_info,Fuse::renamealways takes flags, and so on. Only the wrappers libfuse calls differ, and only where the two APIs genuinely disagree:getattrfuse_file_infogetattrpassesnullptr,fgetattrpasses the handletruncatefuse_file_infotruncatepassesnullptr,ftruncatepasses the handlerenameflagsFUSE_RENAME2chmod,chown,utimensfuse_file_infonullptrreaddirFUSE_READDIR_DEFAULTS, four-arg fillerinitfuse_config, negotiates capabilitiesnullptr, negotiates nothingThe
getattr/truncatesplit is the interesting one. It is exactly thefi != NULLdispatch FUSE 3 asks for, written as two entry points instead of one, so both APIs end up calling the sameFusemethod with the same information.params.hpicks the API and declares the two FUSE 3 types thefsppinterface mentions,fuse_readdir_flagsandfuse_config, when they are missing. Nothing outside the wrappers ever looks inside either: the config pointer is unused, and the readdir flags are alwaysFUSE_READDIR_DEFAULTSon an API with no readdirplus.stat_compatibility.hnow goes throughparams.hinstead of including<fuse.h>directly, soFUSE_USE_VERSIONis set whichever of the two headers a translation unit includes first.Verification
Windows cannot be built here, so the real
src/fspp/fuse/Fuse.cppwas compiled against Dokany's owndokan_fuseheaders, fetched fromdokan-dev/dokanyatmaster. That works on Linux because Dokany'sfuse.hmapsFUSE_STATandFUSE_OFF_Tto the platform types when_WIN32is not defined:src/fspp/fuse/Fuse.cppagainst Dokany headersFuse.h+stat_compatibility.hagainst Dokany headersThis checks the whole FUSE 2 path, including the operations table, the wrapper signatures and the guarded filler and
initbodies. It does not check the MSVC-specific and Dokan-API-specific blocks, but those are separately guarded on_MSC_VERand are unchanged by this pull request.Linux is unaffected.
fspp-teststill passes 1007 tests.Note on overlap
The macOS pull request also rewrites
params.h, so whichever of the two lands second will need a trivial merge there. I am watching both and will do it.🤖 Generated with Claude Code
https://claude.ai/code/session_015ErTwCwE5TPLj5VL3PDKhP
Generated by Claude Code