From c60a90b73971706f525fc7e3289291636f50caa5 Mon Sep 17 00:00:00 2001 From: Giulio Benetti Date: Thu, 6 Apr 2023 13:37:57 +0200 Subject: Fix MS_LAZYTIME not defined on uclibc and move all MS_* and UMOUNT_* (#753) as well as inclusion to new fuse_mount_compat.h file. Signed-off-by: Giulio Benetti --- include/fuse_mount_compat.h | 42 ++++++++++++++++++++++++++++++++++++++++++ lib/mount.c | 3 ++- lib/mount_bsd.c | 2 +- lib/mount_util.c | 5 ++++- util/fusermount.c | 24 +++--------------------- 5 files changed, 52 insertions(+), 24 deletions(-) create mode 100644 include/fuse_mount_compat.h diff --git a/include/fuse_mount_compat.h b/include/fuse_mount_compat.h new file mode 100644 index 0000000..0142b51 --- /dev/null +++ b/include/fuse_mount_compat.h @@ -0,0 +1,42 @@ +/* + FUSE: Filesystem in Userspace + Copyright (C) 2023 Giulio Benetti + + Logging API. + + This program can be distributed under the terms of the GNU LGPLv2. + See the file LICENSE +*/ + +#ifndef FUSE_MOUNT_COMPAT_H_ +#define FUSE_MOUNT_COMPAT_H_ + +#include + +/* Some libc don't define MS_*, so define them manually + * (values taken from https://elixir.bootlin.com/linux/v4.0.9/source/include/uapi/linux/fs.h#L68 on) + */ +#ifndef MS_DIRSYNC +#define MS_DIRSYNC 128 +#endif +#ifndef MS_REC +#define MS_REC 16384 +#endif +#ifndef MS_PRIVATE +#define MS_PRIVATE (1<<18) +#endif +#ifndef MS_LAZYTIME +#define MS_LAZYTIME (1<<25) +#endif + +#ifndef UMOUNT_DETACH +#define UMOUNT_DETACH 0x00000002 /* Just detach from the tree */ +#endif +#ifndef UMOUNT_NOFOLLOW +#define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */ +#endif +#ifndef UMOUNT_UNUSED +#define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */ +#endif + +#endif /* FUSE_MOUNT_COMPAT_H_ */ diff --git a/lib/mount.c b/lib/mount.c index 1f1ee86..3990243 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -25,7 +25,8 @@ #include #include #include -#include + +#include "fuse_mount_compat.h" #ifdef __NetBSD__ #include diff --git a/lib/mount_bsd.c b/lib/mount_bsd.c index 35f3634..73abc67 100644 --- a/lib/mount_bsd.c +++ b/lib/mount_bsd.c @@ -14,7 +14,7 @@ #include "fuse_opt.h" #include -#include +#include "fuse_mount_compat.h" #include #include diff --git a/lib/mount_util.c b/lib/mount_util.c index daf7b5e..8027a2e 100644 --- a/lib/mount_util.c +++ b/lib/mount_util.c @@ -10,6 +10,7 @@ #include "fuse_config.h" #include "mount_util.h" + #include #include #include @@ -27,7 +28,9 @@ #endif #include #include -#include + +#include "fuse_mount_compat.h" + #include #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) diff --git a/util/fusermount.c b/util/fusermount.c index 7a6bc24..850cf6b 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -24,7 +24,9 @@ #include #include #include -#include + +#include "fuse_mount_compat.h" + #include #include #include @@ -36,26 +38,6 @@ #define FUSE_DEV "/dev/fuse" -#ifndef MS_DIRSYNC -#define MS_DIRSYNC 128 -#endif -#ifndef MS_REC -#define MS_REC 16384 -#endif -#ifndef MS_PRIVATE -#define MS_PRIVATE (1<<18) -#endif - -#ifndef UMOUNT_DETACH -#define UMOUNT_DETACH 0x00000002 /* Just detach from the tree */ -#endif -#ifndef UMOUNT_NOFOLLOW -#define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */ -#endif -#ifndef UMOUNT_UNUSED -#define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */ -#endif - static const char *progname; static int user_allow_other = 0; -- cgit v1.2.1