Commit graph

1504 commits

Author SHA1 Message Date
Antonio SJ Musumeci
396f6e8109 Move maintainence thread func take u64 rather than int
signed rollover is UB
2026-03-20 16:14:33 -05:00
Antonio SJ Musumeci
849a819545 replace raw C-strings with std::string in converted libfuse files
util/mount.mergerfs.cpp:
- Remove xstrdup/xrealloc wrappers entirely
- Convert type, source, options, command, setuid to std::string
- Replace add_arg() pointer-rewriting with shell_quote() returning std::string
- Replace add_option() with simple std::string += concatenation
- Fix const_cast UB on string literal assignment

lib/helper.cpp:
- Convert add_default_subtype local subtype_opt: malloc+snprintf+free -> std::string construction

lib/mount_generic.h:
- Convert fuse_mount_sys locals source/type: malloc+strcpy+strcat -> std::string
- Remove 4 unnecessary free() calls (RAII cleanup)
- .c_str() at mount() and fuse_mnt_add_mount() boundaries

lib/mount_util.h:
- Rewrite fuse_mnt_resolve_path internals using std::string: rfind/substr
  instead of manual pointer arithmetic, strrchr, strlen chains
2026-03-20 14:36:54 -05:00
Antonio SJ Musumeci
25d6447555 Convert vendored/libfuse C sources to C++17
Convert all C source files in vendored/libfuse/ to C++17:
- lib/crc32b.c    -> crc32b.cpp  (const void* cast)
- lib/fuse_opt.c -> fuse_opt.cpp (designated init, void* arithmetic)
- lib/fuse_signals.c -> fuse_signals.cpp
- lib/helper.c   -> helper.cpp  (void* data cast)
- lib/mount.c    -> mount.cpp  (thin wrapper)
- lib/mount_generic.c -> mount_generic.h (static inline, #pragma once)
- lib/mount_bsd.c -> mount_bsd.h    (static inline, #pragma once)
- lib/mount_util.c -> mount_util.h   (static inline, #pragma once)
- util/fusermount.c -> fusermount.cpp
- util/mount.mergerfs.c -> mount.mergerfs.cpp

Key changes:
- Replace C99 designated initializer in fuse_opt_parse with field-by-field init
- Fix void* pointer arithmetic via char* base + offset pattern
- All C-style (T*)voidptr casts replaced with static_cast/reinterpret_cast
- Remove redundant #define _GNU_SOURCE (already in FUSE_FLAGS)
- Wrap __clone2 declaration in extern "C" for ia64 path
- Update Makefile: empty SRC_C, build utils with $(CXX) instead of $(CC)
- Remove stale .c files now replaced by .cpp/.h counterparts

All binaries build cleanly: mergerfs, mergerfs-fusermount, mount.mergerfs
2026-03-20 14:08:19 -05:00
Antonio SJ Musumeci
311dbb07f1 Move fuse_session to C++ and make exit flag atomic 2026-03-20 11:48:31 -05:00
Antonio SJ Musumeci
c4754ff70f Fix null ptr handling issue in ioctl processing 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
36730694ec Fix error condition in fs_copyfile 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
6d96e55fff Fix readlink implementation, add more tests 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
89c2ada323 More aggressive error handing with pagesize queries 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
a86c508136 Auto-commit fuse_msgbuf.cpp 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
f565ccff74 Use fatal::abort() rather than assert in places 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
bedc31347c Move scope_guard to vendored/ 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
7cb80ce027 Cleanup procfs and abort on critical issues 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
1cf52cae1f Cleanup branches and add more unit tests 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
2cf92c92ad Cleanup config and add tests 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
15cfd1e2b8 fs_wait_for_mount cleanup 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
70a1d60cc7 fs_inode cleanup 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
be99dffc85 Fixup listxattr error handling 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
940e8637c6 Small improvements to fs::statvfs_cache 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
1eccfdcb8e Cleanup fuse_readlink 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
fcd0ca2982 Improve thread pool 2026-03-19 23:44:50 -05:00
Antonio SJ Musumeci
ec5287eeef Fix possible error handling issue with errno 2026-03-14 11:01:49 -05:00
Antonio SJ Musumeci
d9517a5def Make cfgfile depth calculation thread friendly 2026-03-14 11:01:49 -05:00
Antonio SJ Musumeci
ee7d88ee5b Improve error handling when querying pagesize 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
db2e948ca0 Misc fixes and improvements to thread pool 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
79d625382a Rework string utils, more test cases 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
188a111877 Better error handling in pagesize config type 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
e6399f1935 Check string is not empty before resize in Config::keys 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
dbb2932158 Fix error handling in fuse chmod, chown, setxattr, removexattr 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
27d561fc13 Ensure zero initialized timeouts structs 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
a384933c72 Fix incorrect type in fs_read and write 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
705674e28d Remove dead branch in fuse_reply_data 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
b54c1c2eaa Change session->exited to sig_atomic_t 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
58fb7bbbc3 Initialize stat buffer and add stat call in fuse_mount_sys 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
cc67e791bf Add NULL check for cmsg in receive_fd to prevent segfault 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
b768ba8ce1 Fix buffer overflow in readlink by reserving space for null terminator 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
24057f741b Use RND class for shrink_to_rand_elem and add assertions 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
1d32168022 fix objpool: add size tracking, improve allocation matching; fix msgbuf: clear pool on size change 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
07f496246a fix policy_eppfrd.cpp: return 0 when branchinfo found, -ENOENT only when empty 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
f347ac5818 fix str.cpp: use string_view::npos, fix erase() calls, remove extra whitespace 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
6bd4a76a26 Remove iterator methods from Branches class 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
ac9eb0b7ff Fix futimens bugs: stat pointer, variable names, and negation 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
f34bc166b1 Add null pointer checks for FileInfo/DirInfo 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
f67d087e58 Fix copydata_copy_file_range bug 2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
3226c7a7c3 Fix eplus search bug
Not that anyone would ever use this but it was noticed in a scan.
2026-03-14 10:41:01 -05:00
Antonio SJ Musumeci
6a6aa054cd Add support for Arch, btw
Some checks failed
mkdocs / deploy (push) Has been cancelled
2026-03-14 11:39:48 -04:00
Antonio SJ Musumeci
04939bbe72 No longer explicitly error out on broken mount point
Some checks failed
mkdocs / deploy (push) Has been cancelled
If ENOTCONN (broken FUSE mount) umount first and continue to mount.
2026-03-08 00:39:45 -05:00
Antonio SJ Musumeci
2ea6290e4b Update limiting drive spinup doc
Some checks failed
mkdocs / deploy (push) Has been cancelled
2026-03-04 11:05:55 -05:00
Antonio SJ Musumeci
c66c68b137 Misc cleanup
Some checks failed
mkdocs / deploy (push) Has been cancelled
2026-03-02 01:09:16 -05:00
Antonio SJ Musumeci
075a8a6548 Convert some push_back to emplace_back 2026-03-02 01:09:16 -05:00
Antonio SJ Musumeci
3c6d1b47f6 Remove unused "using"s 2026-03-02 01:09:16 -05:00