From: Dmitry V. Levin Date: Wed, 2 May 2012 10:21:49 +0000 (+0000) Subject: Fix build with from 2.6.18 kernel headers X-Git-Tag: v4.7~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf050db3e88bd68f17464afdc48805186eb300f4;p=strace Fix build with from 2.6.18 kernel headers * configure.ac: Check for LO_FLAGS_AUTOCLEAR and LO_FLAGS_PARTSCAN declarations. * loop.c (loop_flags_options): Use LO_FLAGS_AUTOCLEAR and LO_FLAGS_PARTSCAN only when appropriate declarations are available. (loop_ioctl): Use LOOP_SET_CAPACITY only when it is defined. --- diff --git a/configure.ac b/configure.ac index ec8db2d1..82c8e876 100644 --- a/configure.ac +++ b/configure.ac @@ -254,6 +254,11 @@ AC_CHECK_DECLS(m4_normalize([ PTRACE_SETOPTIONS ]),,, [#include ]) +AC_CHECK_DECLS(m4_normalize([ + LO_FLAGS_AUTOCLEAR, + LO_FLAGS_PARTSCAN +]),,, [#include ]) + AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include diff --git a/loop.c b/loop.c index a3501354..83d91527 100644 --- a/loop.c +++ b/loop.c @@ -33,8 +33,10 @@ static const struct xlat loop_flags_options[] = { { LO_FLAGS_READ_ONLY, "LO_FLAGS_READ_ONLY" }, +#if HAVE_DECL_LO_FLAGS_AUTOCLEAR { LO_FLAGS_AUTOCLEAR, "LO_FLAGS_AUTOCLEAR" }, -#ifdef LO_FLAGS_PARTSCAN +#endif +#if HAVE_DECL_LO_FLAGS_PARTSCAN { LO_FLAGS_PARTSCAN, "LO_FLAGS_PARTSCAN" }, #endif { 0, NULL }, @@ -164,7 +166,9 @@ int loop_ioctl(struct tcb *tcp, long code, long arg) return 1; case LOOP_CLR_FD: +#ifdef LOOP_SET_CAPACITY case LOOP_SET_CAPACITY: +#endif #ifdef LOOP_CTL_GET_FREE /* newer loop-control stuff */ case LOOP_CTL_GET_FREE: