From 738a882ea4f42fad0cea78b917ed0020565dd84e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 23:40:39 +0000 Subject: [PATCH 1/3] Initial plan From 9a101741fab920c202dd579ac959d9d755ff5eaf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 23:46:14 +0000 Subject: [PATCH 2/3] Add fuse3 support for pfsfuse --- .github/workflows/ci.yml | 2 +- README.md | 2 +- meson.build | 11 +++++- src/iomanx_adapter.c | 79 ++++++++++++++++++++++++++++++++++++---- 4 files changed, 83 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a698d5c..0ded2ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ "steps": [ { "name": "Install build dependancies", - "run": "apt-get -y update\napt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install build-essential expect pkg-config fuse libfuse-dev git time p7zip-full\n" + "run": "apt-get -y update\napt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' install build-essential expect pkg-config fuse3 libfuse3-dev git time p7zip-full\n" }, { "uses": "actions/checkout@v3", diff --git a/README.md b/README.md index cf6f22b..ac62f32 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ Commands marked with DESTRUCTIVE could potentially wipe or remove important info `pfsfuse` provides an ability to mount partition into host filesystem (like network folder). `pfsfuse` supports physically connected drives, raw drive images as regular files, and an NBD network server from OPL. -Your system has to support fuse. For example, in the Linux `fuse` package should be installed, on the MacOS `macfuse` can be used. +Your system has to support fuse. For example, on Linux the `fuse3` package is recommended (with `fuse` as a fallback on older systems), while on macOS `macfuse` can be used. The Unix users can use the following command for mounting the partition: ```sh diff --git a/meson.build b/meson.build index d50618a..f1ea81f 100644 --- a/meson.build +++ b/meson.build @@ -59,9 +59,15 @@ if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang- libfuse_include = include_directories(['external/dokany/dokan_fuse/include']) libfuse_dep = cc.find_library('libdokanfuse2.dll', dirs : [meson.current_source_dir() +'/external/dokany/dokan_fuse/build']) + use_fuse3 = false else libfuse_include = [''] - libfuse_dep = dependency('fuse') + use_fuse3 = true + libfuse_dep = dependency('fuse3', required: false) + if not libfuse_dep.found() + use_fuse3 = false + libfuse_dep = dependency('fuse') + endif endif pfsfuse_src = [ @@ -71,6 +77,9 @@ pfsfuse_cflags = [] if host_system == 'linux' pfsfuse_cflags += ['-pthread'] endif +if use_fuse3 + pfsfuse_cflags += ['-DPFSFUSE_USE_FUSE3'] +endif pfsfuse_cflags += ['-D_FILE_OFFSET_BITS=64'] pfsfuse_ldflags = [] if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl' diff --git a/src/iomanx_adapter.c b/src/iomanx_adapter.c index 269dde9..f791b17 100644 --- a/src/iomanx_adapter.c +++ b/src/iomanx_adapter.c @@ -13,8 +13,13 @@ #define pfsfuse_stat stat #endif +#ifdef PFSFUSE_USE_FUSE3 +#define FUSE_USE_VERSION 30 +#include +#else #define FUSE_USE_VERSION 26 #include +#endif #include "iomanX_port.h" @@ -297,9 +302,17 @@ static void convert_stat_to_iomanx(iox_stat_t *iomanx_stat, const struct pfsfuse #endif } -static void *iomanx_adapter_init(struct fuse_conn_info *conn) +static void *iomanx_adapter_init(struct fuse_conn_info *conn +#if FUSE_USE_VERSION >= 30 + , + struct fuse_config *cfg +#endif +) { (void)conn; +#if FUSE_USE_VERSION >= 30 + (void)cfg; +#endif return NULL; } @@ -530,7 +543,12 @@ static int iomanx_adapter_rmdir(const char *path) } static int iomanx_adapter_readdir(const char *path, void *buf, fuse_fill_dir_t filler, - off_t offset, struct fuse_file_info *fi) + off_t offset, struct fuse_file_info *fi +#if FUSE_USE_VERSION >= 30 + , + enum fuse_readdir_flags flags +#endif +) { int dp; int res = 0; @@ -538,6 +556,9 @@ static int iomanx_adapter_readdir(const char *path, void *buf, fuse_fill_dir_t f (void)offset; (void)fi; +#if FUSE_USE_VERSION >= 30 + (void)flags; +#endif char translated_path[1024]; translate_path(translated_path, path, sizeof(translated_path)); @@ -550,7 +571,12 @@ static int iomanx_adapter_readdir(const char *path, void *buf, fuse_fill_dir_t f while ((res = iomanX_dread(dp, &de)) && (res != -1)) { struct pfsfuse_stat st; convert_stat_to_posix(&st, &(de.stat)); - if (filler(buf, de.name, &st, 0)) + if (filler(buf, de.name, &st, 0 +#if FUSE_USE_VERSION >= 30 + , + 0 +#endif + )) break; } @@ -559,10 +585,18 @@ static int iomanx_adapter_readdir(const char *path, void *buf, fuse_fill_dir_t f } -static int iomanx_adapter_getattr(const char *path, struct pfsfuse_stat *stbuf) +static int iomanx_adapter_getattr(const char *path, struct pfsfuse_stat *stbuf +#if FUSE_USE_VERSION >= 30 + , + struct fuse_file_info *fi +#endif +) { int res; iox_stat_t iomanx_stat; +#if FUSE_USE_VERSION >= 30 + (void)fi; +#endif char translated_path[1024]; translate_path(translated_path, path, sizeof(translated_path)); @@ -589,11 +623,19 @@ static int iomanx_adapter_ftruncate(const char *path, off_t offset, return 0; } -static int iomanx_adapter_chmod(const char *path, mode_t mode) +static int iomanx_adapter_chmod(const char *path, mode_t mode +#if FUSE_USE_VERSION >= 30 + , + struct fuse_file_info *fi +#endif +) { int res; iox_stat_t iomanx_stat; struct pfsfuse_stat posix_stat; +#if FUSE_USE_VERSION >= 30 + (void)fi; +#endif posix_stat.st_mode = mode; convert_stat_to_iomanx(&iomanx_stat, &posix_stat); @@ -608,10 +650,18 @@ static int iomanx_adapter_chmod(const char *path, mode_t mode) return 0; } -static int iomanx_adapter_utimens(const char *path, const struct timespec ts[2]) +static int iomanx_adapter_utimens(const char *path, const struct timespec ts[2] +#if FUSE_USE_VERSION >= 30 + , + struct fuse_file_info *fi +#endif +) { int res; iox_stat_t iomanx_stat; +#if FUSE_USE_VERSION >= 30 + (void)fi; +#endif convert_time_to_iomanx(iomanx_stat.atime, &(ts[0].tv_sec)); convert_time_to_iomanx(iomanx_stat.mtime, &(ts[1].tv_sec)); @@ -626,9 +676,19 @@ static int iomanx_adapter_utimens(const char *path, const struct timespec ts[2]) return 0; } -static int iomanx_adapter_rename(const char *from, const char *to) +static int iomanx_adapter_rename(const char *from, const char *to +#if FUSE_USE_VERSION >= 30 + , + unsigned int flags +#endif +) { int res; +#if FUSE_USE_VERSION >= 30 + if (flags != 0) { + return -EINVAL; + } +#endif char translated_from[1024]; translate_path(translated_from, from, sizeof(translated_from)); @@ -690,8 +750,11 @@ static const struct fuse_operations iomanx_adapter_operations = { // link .chmod = iomanx_adapter_chmod, // chown - // ftruncate renamed to truncate into later libfuse +#if FUSE_USE_VERSION >= 30 + .truncate = iomanx_adapter_ftruncate, +#else .ftruncate = iomanx_adapter_ftruncate, +#endif .open = iomanx_adapter_open, .read = iomanx_adapter_read, .write = iomanx_adapter_write, From 821899364a53894e001b30633e5ade08d2931283 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 3 Jun 2026 23:49:52 +0000 Subject: [PATCH 3/3] Document fuse3 filler flag use --- src/iomanx_adapter.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/iomanx_adapter.c b/src/iomanx_adapter.c index f791b17..c0a0ba6 100644 --- a/src/iomanx_adapter.c +++ b/src/iomanx_adapter.c @@ -573,6 +573,7 @@ static int iomanx_adapter_readdir(const char *path, void *buf, fuse_fill_dir_t f convert_stat_to_posix(&st, &(de.stat)); if (filler(buf, de.name, &st, 0 #if FUSE_USE_VERSION >= 30 + /* fuse_fill_dir_flags */ , 0 #endif