commit: 031b61d7138cc1b50ddffffca76ed9e5bbc5d044
parent 7fc1b2256b046713245e6f29927c8039e8c16767
Author: Michael Forney <mforney@mforney.org>
Date: Mon, 6 Sep 2021 23:23:17 -0700
fuse: Various portability fixes
Diffstat:
12 files changed, 212 insertions(+), 10 deletions(-)
diff --git a/pkg/fuse/config.h b/pkg/fuse/config.h
@@ -17,7 +17,6 @@
#define HAVE_SPLICE
#define HAVE_STRUCT_STAT_ST_ATIM
#undef HAVE_STRUCT_STAT_ST_ATIMESPEC
-#define HAVE_SYMVER_ATTRIBUTE 1
#define HAVE_UTIMENSAT
#define HAVE_VMSPLICE
#define PACKAGE_VERSION "3.10.5"
diff --git a/pkg/fuse/gen.lua b/pkg/fuse/gen.lua
@@ -1,4 +1,7 @@
cflags{
+ '-std=c11', '-Wall', '-Wpedantic',
+ '-Wno-overflow', -- ioctl opcode conversion
+ '-D _POSIX_C_SOURCE=200809L',
'-I $dir',
'-I $srcdir/include',
'-I $srcdir/lib',
diff --git a/pkg/fuse/patch/0001-Avoid-statement-expressions-in-container_of-macro.patch b/pkg/fuse/patch/0001-Avoid-statement-expressions-in-container_of-macro.patch
@@ -1,4 +1,4 @@
-From 9883408010640daaabd57934e5e4211f48d50362 Mon Sep 17 00:00:00 2001
+From 374d50ca9322cefef0e2405c0189fb8e13838a3a Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Mon, 17 Jun 2019 23:21:39 -0700
Subject: [PATCH] Avoid statement expressions in container_of macro
@@ -9,7 +9,7 @@ Subject: [PATCH] Avoid statement expressions in container_of macro
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/fuse.c b/lib/fuse.c
-index e75efcd..d8859ab 100755
+index a95d7c1..1c7ddbe 100644
--- a/lib/fuse.c
+++ b/lib/fuse.c
@@ -93,9 +93,8 @@ struct node_table {
@@ -25,7 +25,7 @@ index e75efcd..d8859ab 100755
#define list_entry(ptr, type, member) \
container_of(ptr, type, member)
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
-index 3684b8b..b9a488c 100644
+index d227688..ccf52d0 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -39,9 +39,8 @@
@@ -41,5 +41,5 @@ index 3684b8b..b9a488c 100644
struct fuse_pollhandle {
uint64_t kh;
--
-2.20.1
+2.32.0
diff --git a/pkg/fuse/patch/0002-Use-__typeof__-instead-of-typeof.patch b/pkg/fuse/patch/0002-Use-__typeof__-instead-of-typeof.patch
@@ -1,4 +1,4 @@
-From f654bcf1919c011d16a73ff76d6fc517ce7ffef8 Mon Sep 17 00:00:00 2001
+From ad9777cc43ac13f591a08fd7a222efd89009a18d Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Mon, 1 Jul 2019 22:45:12 -0700
Subject: [PATCH] Use __typeof__ instead of typeof
@@ -22,5 +22,5 @@ index ed62ea9..c497891 100644
0x00000187 /* AUTOFS_SUPER_MAGIC */,
0xCA451A4E /* BCACHEFS_STATFS_MAGIC */,
--
-2.30.0
+2.32.0
diff --git a/pkg/fuse/patch/0003-Fix-build-without-symbol-versioning.patch b/pkg/fuse/patch/0003-Fix-build-without-symbol-versioning.patch
@@ -1,4 +1,4 @@
-From 9619dc770866c4b0185c058d3187f9ad70dbc9de Mon Sep 17 00:00:00 2001
+From 71ff6ec2055f486f2fe7578d5b3baeebee747e4d Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Wed, 3 Jul 2019 00:52:16 -0700
Subject: [PATCH] Fix build without symbol versioning
@@ -25,5 +25,5 @@ index 9e6c633..f584a54 100644
size_t op_size, void *private_data);
#define fuse_new(args, op, size, data) fuse_new_30(args, op, size, data)
--
-2.31.1
+2.32.0
diff --git a/pkg/fuse/patch/0004-Avoid-invalid-use-of-flexible-array-members.patch b/pkg/fuse/patch/0004-Avoid-invalid-use-of-flexible-array-members.patch
@@ -0,0 +1,57 @@
+From 4526a08c6e97ab0260c2c7ae963626d7f7e18ca2 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 6 Sep 2021 23:08:22 -0700
+Subject: [PATCH] Avoid invalid use of flexible array members
+
+---
+ include/fuse_kernel.h | 10 +++++++---
+ lib/fuse_lowlevel.c | 7 +++----
+ 2 files changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
+index 018a00a..939af6a 100644
+--- a/include/fuse_kernel.h
++++ b/include/fuse_kernel.h
+@@ -769,13 +769,17 @@ struct fuse_dirent {
+
+ struct fuse_direntplus {
+ struct fuse_entry_out entry_out;
+- struct fuse_dirent dirent;
++ uint64_t ino;
++ uint64_t off;
++ uint32_t namelen;
++ uint32_t type;
++ char name[];
+ };
+
+ #define FUSE_NAME_OFFSET_DIRENTPLUS \
+- offsetof(struct fuse_direntplus, dirent.name)
++ offsetof(struct fuse_direntplus, name)
+ #define FUSE_DIRENTPLUS_SIZE(d) \
+- FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->dirent.namelen)
++ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET_DIRENTPLUS + (d)->namelen)
+
+ struct fuse_notify_inval_inode_out {
+ uint64_t ino;
+diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
+index ccf52d0..a12f5cc 100644
+--- a/lib/fuse_lowlevel.c
++++ b/lib/fuse_lowlevel.c
+@@ -367,11 +367,10 @@ size_t fuse_add_direntry_plus(fuse_req_t req, char *buf, size_t bufsize,
+ if ((buf == NULL) || (entlen_padded > bufsize))
+ return entlen_padded;
+
+- struct fuse_direntplus *dp = (struct fuse_direntplus *) buf;
+- memset(&dp->entry_out, 0, sizeof(dp->entry_out));
+- fill_entry(&dp->entry_out, e);
++ struct fuse_direntplus *dirent = (struct fuse_direntplus *) buf;
++ memset(&dirent->entry_out, 0, sizeof(dirent->entry_out));
++ fill_entry(&dirent->entry_out, e);
+
+- struct fuse_dirent *dirent = &dp->dirent;
+ dirent->ino = e->attr.st_ino;
+ dirent->off = off;
+ dirent->namelen = namelen;
+--
+2.32.0
+
diff --git a/pkg/fuse/patch/0005-Prevent-unused-label-warning-with-IGNORE_MTAB.patch b/pkg/fuse/patch/0005-Prevent-unused-label-warning-with-IGNORE_MTAB.patch
@@ -0,0 +1,27 @@
+From 92210452ee8f336c6121ee2a4d6ffae8a085db15 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 6 Sep 2021 23:22:16 -0700
+Subject: [PATCH] Prevent unused-label warning with IGNORE_MTAB
+
+---
+ lib/mount.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/lib/mount.c b/lib/mount.c
+index 979f8d9..a51731f 100644
+--- a/lib/mount.c
++++ b/lib/mount.c
+@@ -500,8 +500,10 @@ static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
+
+ return fd;
+
++#ifndef IGNORE_MTAB
+ out_umount:
+ umount2(mnt, 2); /* lazy umount */
++#endif
+ out_close:
+ free(type);
+ free(source);
+--
+2.32.0
+
diff --git a/pkg/fuse/patch/0006-Fix-sscanf-format-specifier.patch b/pkg/fuse/patch/0006-Fix-sscanf-format-specifier.patch
@@ -0,0 +1,25 @@
+From b556d59ad2ffa73e4baa4c8345210c70a255296a Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 6 Sep 2021 23:26:54 -0700
+Subject: [PATCH] Fix sscanf format specifier
+
+---
+ lib/mount_util.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/mount_util.c b/lib/mount_util.c
+index 35e9948..85ab119 100644
+--- a/lib/mount_util.c
++++ b/lib/mount_util.c
+@@ -360,7 +360,7 @@ int fuse_mnt_parse_fuse_fd(const char *mountpoint)
+ int fd = -1;
+ int len = 0;
+
+- if (sscanf(mountpoint, "/dev/fd/%u%n", &fd, &len) == 1 &&
++ if (sscanf(mountpoint, "/dev/fd/%d%n", &fd, &len) == 1 &&
+ len == strlen(mountpoint)) {
+ return fd;
+ }
+--
+2.32.0
+
diff --git a/pkg/fuse/patch/0007-Avoid-conversion-between-function-and-object-pointer.patch b/pkg/fuse/patch/0007-Avoid-conversion-between-function-and-object-pointer.patch
@@ -0,0 +1,25 @@
+From 31a2af8891c0d460942f0c182442615618248388 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 6 Sep 2021 23:27:23 -0700
+Subject: [PATCH] Avoid conversion between function and object pointer
+
+---
+ lib/fuse_lowlevel.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
+index a12f5cc..b864d90 100644
+--- a/lib/fuse_lowlevel.c
++++ b/lib/fuse_lowlevel.c
+@@ -2496,7 +2496,7 @@ static struct {
+ [FUSE_POLL] = { do_poll, "POLL" },
+ [FUSE_FALLOCATE] = { do_fallocate, "FALLOCATE" },
+ [FUSE_DESTROY] = { do_destroy, "DESTROY" },
+- [FUSE_NOTIFY_REPLY] = { (void *) 1, "NOTIFY_REPLY" },
++ [FUSE_NOTIFY_REPLY] = { (void (*)()) 1, "NOTIFY_REPLY" },
+ [FUSE_BATCH_FORGET] = { do_batch_forget, "BATCH_FORGET" },
+ [FUSE_READDIRPLUS] = { do_readdirplus, "READDIRPLUS"},
+ [FUSE_RENAME2] = { do_rename2, "RENAME2" },
+--
+2.32.0
+
diff --git a/pkg/fuse/patch/0008-Define-_GNU_SOURCE-for-realpath.patch b/pkg/fuse/patch/0008-Define-_GNU_SOURCE-for-realpath.patch
@@ -0,0 +1,41 @@
+From f66ab008acda13411c1de0c7a3b5d6faeca2df43 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 6 Sep 2021 23:30:18 -0700
+Subject: [PATCH] Define _GNU_SOURCE for realpath()
+
+---
+ lib/helper.c | 3 +++
+ lib/mount_util.c | 3 +++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/lib/helper.c b/lib/helper.c
+index 64ff7ad..a291fa2 100644
+--- a/lib/helper.c
++++ b/lib/helper.c
+@@ -10,6 +10,9 @@
+ See the file COPYING.LIB.
+ */
+
++/* For realpath() */
++#define _GNU_SOURCE
++
+ #include "config.h"
+ #include "fuse_i.h"
+ #include "fuse_misc.h"
+diff --git a/lib/mount_util.c b/lib/mount_util.c
+index 85ab119..d242cc2 100644
+--- a/lib/mount_util.c
++++ b/lib/mount_util.c
+@@ -8,6 +8,9 @@
+ See the file COPYING.LIB.
+ */
+
++/* For realpath() */
++#define _GNU_SOURCE
++
+ #include "config.h"
+ #include "mount_util.h"
+ #include <stdio.h>
+--
+2.32.0
+
diff --git a/pkg/fuse/patch/0009-Only-use-symbol-versioning-on-GNU-compatible-compile.patch b/pkg/fuse/patch/0009-Only-use-symbol-versioning-on-GNU-compatible-compile.patch
@@ -0,0 +1,25 @@
+From f738d8ef399b4eda78a521ced66b626cc7a3a02b Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Mon, 6 Sep 2021 23:36:31 -0700
+Subject: [PATCH] Only use symbol versioning on GNU-compatible compilers
+
+---
+ lib/fuse_misc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/fuse_misc.h b/lib/fuse_misc.h
+index f956ab7..a86717c 100644
+--- a/lib/fuse_misc.h
++++ b/lib/fuse_misc.h
+@@ -12,7 +12,7 @@
+ Versioned symbols cannot be used in some cases because it
+ - not supported on MacOSX (in MachO binary format)
+ */
+-#ifndef __APPLE__
++#if !defined(__APPLE__) && defined(__GNUC__)
+ # if HAVE_SYMVER_ATTRIBUTE
+ # define FUSE_SYMVER(sym1, sym2) __attribute__ ((symver (sym2)))
+ # else
+--
+2.32.0
+
diff --git a/pkg/fuse/ver b/pkg/fuse/ver
@@ -1 +1 @@
-3.10.5 r0
+3.10.5 r1