common = grub-core/disk/host.c;
common = grub-core/osdep/init.c;
+ cflags = '$(FUSE_CFLAGS)';
+
ldadd = libgrubmods.a;
ldadd = libgrubgcry.a;
ldadd = libgrubkern.a;
ldadd = grub-core/lib/gnulib/libgnu.a;
- ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM) -lfuse';
+ ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM) $(FUSE_LIBS)';
condition = COND_GRUB_MOUNT;
};
fi
if test x"$grub_mount_excuse" = x ; then
- AC_CHECK_LIB([fuse], [fuse_main_real], [],
- [grub_mount_excuse="need FUSE library"])
-fi
-
-if test x"$grub_mount_excuse" = x ; then
- # Check for fuse headers.
- SAVED_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS -DFUSE_USE_VERSION=26"
- AC_CHECK_HEADERS([fuse/fuse.h], [],
- [grub_mount_excuse=["need FUSE headers"]])
- CPPFLAGS="$SAVED_CPPFLAGS"
+ PKG_CHECK_MODULES([FUSE], [fuse3], [FUSE_CFLAGS="$FUSE_CFLAGS -DFUSE_USE_VERSION=32"], [
+ PKG_CHECK_MODULES([FUSE], [fuse], [FUSE_CFLAGS="$FUSE_CFLAGS -DFUSE_USE_VERSION=26"], [
+ grub_mount_excuse="need fuse or fuse3 libraries"
+ ])
+ ])
fi
if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
-#define FUSE_USE_VERSION 26
#include <config.h>
#include <grub/types.h>
#include <grub/emu/misc.h>
#include <grub/command.h>
#include <grub/zfs/zfs.h>
#include <grub/i18n.h>
-#include <fuse/fuse.h>
+#include <fuse.h>
#include <stdio.h>
#include <unistd.h>
return 0;
}
+#if FUSE_USE_VERSION < 30
static int
fuse_getattr (const char *path, struct stat *st)
+#else
+static int
+fuse_getattr (const char *path, struct stat *st,
+ struct fuse_file_info *fi __attribute__ ((unused)))
+#endif
{
struct fuse_getattr_ctx ctx;
char *pathname, *path2;
static int first_fd = 1;
static int
-fuse_open (const char *path, struct fuse_file_info *fi __attribute__ ((unused)))
+fuse_open (const char *path, struct fuse_file_info *fi)
{
+ if ((fi->flags & O_ACCMODE) != O_RDONLY)
+ return -EROFS;
+
grub_file_t file;
file = grub_file_open (path, GRUB_FILE_TYPE_MOUNT);
if (! file)
st.st_blocks = (st.st_size + 511) >> 9;
st.st_atime = st.st_mtime = st.st_ctime
= info->mtimeset ? info->mtime : 0;
+#if FUSE_USE_VERSION < 30
ctx->fill (ctx->buf, filename, &st, 0);
+#else
+ ctx->fill (ctx->buf, filename, &st, 0, 0);
+#endif
return 0;
}
+#if FUSE_USE_VERSION < 30
static int
fuse_readdir (const char *path, void *buf,
fuse_fill_dir_t fill, off_t off, struct fuse_file_info *fi)
+#else
+static int
+fuse_readdir (const char *path, void *buf,
+ fuse_fill_dir_t fill, off_t off, struct fuse_file_info *fi,
+ enum fuse_readdir_flags flags __attribute__ ((unused)))
+#endif
{
struct fuse_readdir_ctx ctx = {
.path = path,