Browse Source

support RHEL6. closes #29

pull/37/merge
Antonio SJ Musumeci 10 years ago
parent
commit
613b996296
  1. 67
      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

67
Makefile

@ -21,18 +21,19 @@
# THE SOFTWARE. # THE SOFTWARE.
PKGCONFIG = $(shell which pkg-config) PKGCONFIG = $(shell which pkg-config)
GIT = $(shell which git)
TAR = $(shell which tar)
MKDIR = $(shell which mkdir)
TOUCH = $(shell which touch)
CP = $(shell which cp)
RM = $(shell which rm)
FIND = $(shell which find)
INSTALL = $(shell which install)
MKTEMP = $(shell which mktemp)
STRIP = $(shell which strip)
PANDOC = $(shell which pandoc)
GIT = $(shell which git)
TAR = $(shell which tar)
MKDIR = $(shell which mkdir)
TOUCH = $(shell which touch)
CP = $(shell which cp)
RM = $(shell which rm)
FIND = $(shell which find)
INSTALL = $(shell which install)
MKTEMP = $(shell which mktemp)
STRIP = $(shell which strip)
PANDOC = $(shell which pandoc)
GIT2DEBCL = ./tools/git2debcl GIT2DEBCL = ./tools/git2debcl
CPPFIND = ./tools/cppfind
ifeq ($(PKGCONFIG),"") ifeq ($(PKGCONFIG),"")
$(error "pkg-config not installed" $(error "pkg-config not installed"
@ -54,23 +55,35 @@ ifeq ($(FUSE_AVAILABLE),0)
$(error "FUSE development package doesn't appear available") $(error "FUSE development package doesn't appear available")
endif endif
OPTS = -O2
SRC = $(wildcard src/*.cpp)
OBJ = $(SRC:src/%.cpp=obj/%.o)
DEPS = $(OBJ:obj/%.o=obj/%.d)
TARGET = mergerfs
MANPAGE = $(TARGET).1
CFLAGS = -g -Wall \
$(OPTS) \
$(shell $(PKGCONFIG) fuse --cflags) \
-DFUSE_USE_VERSION=26 \
-MMD
LDFLAGS = $(shell $(PKGCONFIG) fuse --libs)
BINDIR = $(PREFIX)/usr/bin
MANDIR = $(PREFIX)/usr/share/man/man1
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) \
$(FUSE_CFLAGS) \
-DFUSE_USE_VERSION=26 \
-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
MANDIR = $(PREFIX)/usr/share/man/man1
INSTALLTARGET = $(DESTDIR)/$(BINDIR)/$(TARGET) INSTALLTARGET = $(DESTDIR)/$(BINDIR)/$(TARGET)
MANTARGET = $(DESTDIR)/$(MANDIR)/$(MANPAGE)
MANTARGET = $(DESTDIR)/$(MANDIR)/$(MANPAGE)
ifeq ($(XATTR_AVAILABLE),0) ifeq ($(XATTR_AVAILABLE),0)
$(warning "xattr not available: disabling") $(warning "xattr not available: disabling")

4
src/fallocate.cpp

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

2
src/init.cpp

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

4
src/ioctl.cpp

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

12
src/mergerfs.cpp

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

4
src/read_buf.cpp

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

4
src/write_buf.cpp

@ -22,6 +22,8 @@
THE SOFTWARE. THE SOFTWARE.
*/ */
#if WRITE_BUF
#include <fuse.h> #include <fuse.h>
#include <stdlib.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