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

@ -17,6 +17,7 @@ BINDIR="@BINDIR@"
SBINDIR="@SBINDIR@"
KMODDIR="@KMODDIR@"
KERNDIR="@KERNDIR@"
ENABLE_MCOVERLAYFS="@ENABLE_MCOVERLAYFS@"
INTERVAL=1
LOGMODE=0
@ -59,7 +60,7 @@ cpus=""
ihk_ikc_irq_core=0
kernel_release=`uname -r`
enable_mcoverlay=`if [[ ${kernel_release} =~ ^4.* ]]; then echo "yes"; fi`
enable_mcoverlay=`if [[ ${kernel_release} =~ ^4.* && "${ENABLE_MCOVERLAYFS}" == "yes" ]]; then echo "yes"; fi`
if [ "$cpus" == "" ]; then

23
configure vendored
View File

@ -628,6 +628,7 @@ IHK_RELEASE_DATE
DCFA_VERSION
MCKERNEL_VERSION
IHK_VERSION
ENABLE_MCOVERLAYFS
MANDIR
KERNDIR
KMODDIR
@ -693,6 +694,7 @@ with_target
with_system_map
enable_dcfa
enable_memdump
enable_mcoverlayfs
'
ac_precious_vars='build_alias
host_alias
@ -1314,6 +1316,7 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-dcfa Enable DCFA modules
--enable-memdump enable dumping memory and analyzing a dump
--enable-mcoverlayfs enable mcoverlayfs implementation
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -2100,6 +2103,14 @@ else
fi
# Check whether --enable-mcoverlayfs was given.
if test "${enable_mcoverlayfs+set}" = set; then :
enableval=$enable_mcoverlayfs; ENABLE_MCOVERLAYFS=$enableval
else
ENABLE_MCOVERLAYFS=yes
fi
case "X$WITH_KERNELSRC" in
Xyes | Xno | X)
WITH_KERNELSRC='/lib/modules/`uname -r`/build'
@ -3817,6 +3828,18 @@ $as_echo "$as_me: memdump feature is disabled" >&6;}
uncomment_if_ENABLE_MEMDUMP='#'
fi
if test "x$ENABLE_MCOVERLAYFS" = "xyes" ; then
$as_echo "#define ENABLE_MCOVERLAYFS 1" >>confdefs.h
{ $as_echo "$as_me:${as_lineno-$LINENO}: mcoverlayfs is enabled" >&5
$as_echo "$as_me: mcoverlayfs is enabled" >&6;}
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: mcoverlayfs is disabled" >&5
$as_echo "$as_me: mcoverlayfs is disabled" >&6;}
fi

View File

@ -42,6 +42,12 @@ AC_ARG_ENABLE([memdump],
[ENABLE_MEMDUMP=$enableval],
[ENABLE_MEMDUMP=default])
AC_ARG_ENABLE([mcoverlayfs],
AC_HELP_STRING([--enable-mcoverlayfs],
[enable mcoverlayfs implementation]),
[ENABLE_MCOVERLAYFS=$enableval],
[ENABLE_MCOVERLAYFS=yes])
case "X$WITH_KERNELSRC" in
Xyes | Xno | X)
WITH_KERNELSRC='/lib/modules/`uname -r`/build'
@ -257,6 +263,13 @@ else
uncomment_if_ENABLE_MEMDUMP='#'
fi
if test "x$ENABLE_MCOVERLAYFS" = "xyes" ; then
AC_DEFINE([ENABLE_MCOVERLAYFS],[1],[whether mcoverlayfs is enabled])
AC_MSG_NOTICE([mcoverlayfs is enabled])
else
AC_MSG_NOTICE([mcoverlayfs is disabled])
fi
AC_SUBST(CC)
AC_SUBST(XCC)
AC_SUBST(ARCH)
@ -267,6 +280,7 @@ AC_SUBST(SBINDIR)
AC_SUBST(KMODDIR)
AC_SUBST(KERNDIR)
AC_SUBST(MANDIR)
AC_SUBST(ENABLE_MCOVERLAYFS)
AC_SUBST(IHK_VERSION)
AC_SUBST(MCKERNEL_VERSION)

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]);