make mcoverlayfs optional (default: enabled)

This commit is contained in:
Balazs Gerofi
2016-04-02 15:43:35 -04:00
parent 73de203c16
commit fb32120659
6 changed files with 54 additions and 4 deletions

View File

@@ -1,5 +1,8 @@
/* executer/config.h.in. Generated from configure.ac by autoheader. */
/* whether mcoverlayfs is enabled */
#undef ENABLE_MCOVERLAYFS
/* whether memdump feature is enabled */
#undef ENABLE_MEMDUMP

View File

@@ -2,9 +2,14 @@ KDIR ?= @KDIR@
ARCH ?= @ARCH@
KMODDIR=@KMODDIR@
src = @abs_srcdir@
ENABLE_MCOVERLAYFS=@ENABLE_MCOVERLAYFS@
RELEASE=$(shell uname -r)
ENABLE_BUILD=$(shell if [[ ${RELEASE} =~ ^4.* ]]; then echo "yes"; fi)
RELEASE=$(shell uname -r | cut -d"." -f1)
ifeq ($(ENABLE_MCOVERLAYFS),yes)
ENABLE_BUILD=$(shell if [ "${RELEASE}" == "4" ]; then echo "yes"; fi)
else
ENABLE_BUILD=no
endif
obj-m += mcoverlay.o

View File

@@ -1089,6 +1089,7 @@ void init_worker_threads(int fd)
pthread_barrier_wait(&init_ready);
}
#ifdef ENABLE_MCOVERLAYFS
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
#define READ_BUFSIZE 1024
static int isunshare(void)
@@ -1162,6 +1163,7 @@ static int isunshare(void)
return err;
}
#endif
#endif // ENABLE_MCOVERLAYFS
#define MCK_RLIMIT_AS 0
#define MCK_RLIMIT_CORE 1
@@ -1349,6 +1351,7 @@ int main(int argc, char **argv)
return 1;
}
#ifdef ENABLE_MCOVERLAYFS
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
__dprintf("mcoverlay enable\n");
char mcos_procdir[PATH_MAX];
@@ -1397,9 +1400,10 @@ int main(int argc, char **argv)
} else if (error == -1) {
return 1;
}
#endif // LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
#else
__dprintf("mcoverlay disable\n");
#endif
#endif // ENABLE_MCOVERLAYFS
if (lookup_exec_path(argv[optind], path, sizeof(path)) != 0) {
fprintf(stderr, "error: finding file: %s\n", argv[optind]);