Browse Source

Merge pull request #31 from trapexit/compat

support RHEL6. closes #29
pull/37/merge
Antonio SJ Musumeci 10 years ago
parent
commit
19051925db
  1. 17
      Makefile
  2. 4
      src/fallocate.cpp
  3. 2
      src/init.cpp
  4. 4
      src/ioctl.cpp
  5. 12
      src/mergerfs.cpp
  6. 4
      src/read_buf.cpp
  7. 4
      src/write_buf.cpp
  8. 7
      tools/cppfind

17
Makefile

@ -33,6 +33,7 @@ MKTEMP = $(shell which mktemp)
STRIP = $(shell which strip)
PANDOC = $(shell which pandoc)
GIT2DEBCL = ./tools/git2debcl
CPPFIND = ./tools/cppfind
ifeq ($(PKGCONFIG),"")
$(error "pkg-config not installed"
@ -54,17 +55,29 @@ ifeq ($(FUSE_AVAILABLE),0)
$(error "FUSE development package doesn't appear available")
endif
FLAG_NOPATH = $(shell $(CPPFIND) "flag_nopath")
FALLOCATE = $(shell $(CPPFIND) "fuse_fs_fallocate")
FLOCK = $(shell $(CPPFIND) "fuse_fs_flock")
READ_BUF = $(shell $(CPPFIND) "fuse_fs_read_buf")
WRITE_BUF = $(shell $(CPPFIND) "fuse_fs_write_buf")
OPTS = -O2
SRC = $(wildcard src/*.cpp)
OBJ = $(SRC:src/%.cpp=obj/%.o)
DEPS = $(OBJ:obj/%.o=obj/%.d)
TARGET = mergerfs
MANPAGE = $(TARGET).1
FUSE_CFLAGS = $(shell $(PKGCONFIG) --cflags fuse)
CFLAGS = -g -Wall \
$(OPTS) \
$(shell $(PKGCONFIG) fuse --cflags) \
$(FUSE_CFLAGS) \
-DFUSE_USE_VERSION=26 \
-MMD
-MMD \
-DFLAG_NOPATH=$(FLAG_NOPATH) \
-DFALLOCATE=$(FALLOCATE) \
-DFLOCK=$(FLOCK) \
-DREAD_BUF=$(READ_BUF) \
-DWRITE_BUF=$(WRITE_BUF)
LDFLAGS = $(shell $(PKGCONFIG) fuse --libs)
BINDIR = $(PREFIX)/usr/bin

4
src/fallocate.cpp

@ -22,6 +22,8 @@
THE SOFTWARE.
*/
#if FALLOCATE
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
@ -82,3 +84,5 @@ namespace mergerfs
}
}
}
#endif

2
src/init.cpp

@ -33,7 +33,9 @@ namespace mergerfs
void *
init(struct fuse_conn_info *conn)
{
#ifdef FUSE_CAP_IOCTL_DIR
conn->want |= FUSE_CAP_IOCTL_DIR;
#endif
return &config::get_writable();
}

4
src/ioctl.cpp

@ -80,6 +80,7 @@ _ioctl(const int fd,
return ((rv == -1) ? -errno : rv);
}
#ifdef FUSE_IOCTL_DIR
static
int
_ioctl_dir_base(const fs::SearchFunc searchFunc,
@ -130,6 +131,7 @@ _ioctl_dir(const string fusepath,
flags,
data);
}
#endif
namespace mergerfs
{
@ -145,12 +147,14 @@ namespace mergerfs
{
const FileInfo *fileinfo = (FileInfo*)ffi->fh;
#ifdef FUSE_IOCTL_DIR
if(flags & FUSE_IOCTL_DIR)
return _ioctl_dir(fusepath,
cmd,
arg,
flags,
data);
#endif
return _ioctl(fileinfo->fd,
cmd,

12
src/mergerfs.cpp

@ -76,9 +76,11 @@ static
struct fuse_operations
get_fuse_operations()
{
struct fuse_operations ops = {};
struct fuse_operations ops = {0};
#if FLAG_NOPATH
ops.flag_nopath = false;
#endif
ops.flag_nullpath_ok = false;
ops.access = mergerfs::access::access;
@ -87,9 +89,13 @@ get_fuse_operations()
ops.chown = mergerfs::chown::chown;
ops.create = mergerfs::create::create;
ops.destroy = mergerfs::destroy::destroy;
#if FALLOCATE
ops.fallocate = mergerfs::fallocate::fallocate;
#endif
ops.fgetattr = mergerfs::fgetattr::fgetattr;
#if FLOCK
ops.flock = NULL;
#endif
ops.flush = mergerfs::flush::flush;
ops.fsync = mergerfs::fsync::fsync;
ops.fsyncdir = NULL;
@ -108,7 +114,9 @@ get_fuse_operations()
ops.opendir = mergerfs::opendir::opendir;
ops.poll = NULL;
ops.read = mergerfs::read::read;
#if READ_BUF
ops.read_buf = mergerfs::read_buf::read_buf;
#endif
ops.readdir = mergerfs::readdir::readdir;
ops.readlink = mergerfs::readlink::readlink;
ops.release = mergerfs::release::release;
@ -124,7 +132,9 @@ get_fuse_operations()
ops.utime = NULL; /* deprecated; use utimens() */
ops.utimens = mergerfs::utimens::utimens;
ops.write = mergerfs::write::write;
#if WRITE_BUF
ops.write_buf = mergerfs::write_buf::write_buf;
#endif
return ops;
}

4
src/read_buf.cpp

@ -22,6 +22,8 @@
THE SOFTWARE.
*/
#if READ_BUF
#include <fuse.h>
#include <stdlib.h>
@ -72,3 +74,5 @@ namespace mergerfs
}
}
}
#endif

4
src/write_buf.cpp

@ -22,6 +22,8 @@
THE SOFTWARE.
*/
#if WRITE_BUF
#include <fuse.h>
#include <stdlib.h>
@ -63,3 +65,5 @@ namespace mergerfs
}
}
}
#endif

7
tools/cppfind

@ -0,0 +1,7 @@
#!/bin/bash
FUSE_CFLAGS=$(pkg-config --cflags fuse)
echo "#include <fuse.h>" | cpp ${FUSE_CFLAGS} | grep -q "${1}"
[ "$?" != "0" ]; echo $?
Loading…
Cancel
Save