diff options
author | Martin Pärtel <martin.partel@gmail.com> | 2023-06-03 10:54:17 +0300 |
---|---|---|
committer | Martin Pärtel <martin.partel@gmail.com> | 2023-06-03 10:54:17 +0300 |
commit | 8bc231315c7807026800c197734b37154e89c338 (patch) | |
tree | 5250ae79d6fc2ed658ae7ca7e75d80e758b85b98 | |
parent | dee2798b6acd29a3683ff9c5ab3401934b60125c (diff) | |
download | bindfs-8bc231315c7807026800c197734b37154e89c338.tar.gz |
Added statfs_x implementation for MacOS.
Fixes #130
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/bindfs.c | 25 |
2 files changed, 30 insertions, 0 deletions
@@ -1,3 +1,8 @@ +2023-06-03 Martin Pärtel <martin dot partel at gmail dot com> + + * Added MacOS statfs_x implementation (issue #130, + thanks @ohayetechnology) + 2023-02-08 Martin Pärtel <martin dot partel at gmail dot com> * Released 1.17.2 diff --git a/src/bindfs.c b/src/bindfs.c index b049679..00a7592 100644 --- a/src/bindfs.c +++ b/src/bindfs.c @@ -321,6 +321,9 @@ static int bindfs_ioctl(const char *path, int cmd, void *arg, void *data); #endif static int bindfs_statfs(const char *path, struct statvfs *stbuf); +#if __APPLE__ +static int bindfs_statfs_x(const char *path, struct statfs *stbuf); +#endif static int bindfs_release(const char *path, struct fuse_file_info *fi); static int bindfs_fsync(const char *path, int isdatasync, struct fuse_file_info *fi); @@ -1434,6 +1437,25 @@ static int bindfs_statfs(const char *path, struct statvfs *stbuf) return 0; } +#if __APPLE__ +static int bindfs_statfs_x(const char *path, struct statfs *stbuf) +{ + int res; + char *real_path; + + real_path = process_path(path, true); + if (real_path == NULL) + return -errno; + + res = statfs(real_path, stbuf); + free(real_path); + if (res == -1) + return -errno; + + return 0; +} +#endif + static int bindfs_release(const char *path, struct fuse_file_info *fi) { (void) path; @@ -1672,6 +1694,9 @@ static struct fuse_operations bindfs_oper = { .ioctl = bindfs_ioctl, #endif .statfs = bindfs_statfs, +#ifdef __APPLE__ + .statfs_x = bindfs_statfs_x, +#endif .release = bindfs_release, .fsync = bindfs_fsync, #ifdef HAVE_SETXATTR |