From d2c33f43a62e6c5d71288e2895b9668c76c06f9b Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Mon, 25 Jan 2016 15:17:26 +0300 Subject: [PATCH] LU-7704 utils: check LOOP_CTL_GET_FREE aginst target kernel instead of a building host. Change-Id: I838d4c6a8ed076013aaba7bc0aa8eb434fa10be8 Signed-off-by: Alex Zhuravlev Reviewed-on: http://review.whamcloud.com/18121 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 27 +++++++++++++++++++++++++++ lustre/utils/mount_utils.c | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index b8285d0..6ccbfc7 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1948,6 +1948,32 @@ bio_endio, [ ]) # LC_BIO_ENDIO_USES_ONE_ARG # +# LC_HAVE_LOOP_CTL_GET_FREE +# +# 4.x kernel have moved userspace APIs to +# the separate directory and all of them +# support LOOP_CTL_GET_FREE +# +AC_DEFUN([LC_HAVE_LOOP_CTL_GET_FREE], [ +LB_CHECK_FILE([$LINUX/include/linux/loop.h], [ + LB_CHECK_COMPILE([if have 'HAVE_LOOP_CTL_GET_FREE'], + LOOP_CTL_GET_FREE, [ + #include + ],[ + int i; + + i = LOOP_CTL_GET_FREE; + ],[ + AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1, + [LOOP_CTL_GET_FREE exist]) + ]) +],[ + AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1, + [kernel has LOOP_CTL_GET_FREE]) +]) +]) # LC_HAVE_LOOP_CTL_GET_FREE + +# # LC_PROG_LINUX # # Lustre linux kernel checks @@ -2012,6 +2038,7 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_FILE_LLSEEK_SIZE LC_INODE_PERMISION_2ARGS LC_RADIX_EXCEPTION_ENTRY + LC_HAVE_LOOP_CTL_GET_FREE # 3.2 LC_HAVE_VOID_MAKE_REQUEST_FN diff --git a/lustre/utils/mount_utils.c b/lustre/utils/mount_utils.c index 9d8e232..2289b72 100644 --- a/lustre/utils/mount_utils.c +++ b/lustre/utils/mount_utils.c @@ -365,7 +365,7 @@ int loop_setup(struct mkfs_opts *mop) char cmd[PATH_MAX]; int cmdsz = sizeof(cmd); -#ifdef LOOP_CTL_GET_FREE +#ifdef HAVE_LOOP_CTL_GET_FREE ret = open("/dev/loop-control", O_RDWR); if (ret < 0) { fprintf(stderr, "%s: can't access loop control\n", progname); -- 1.8.3.1