summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2012-05-02 10:21:49 +0000
committerDmitry V. Levin <ldv@altlinux.org>2012-05-02 10:21:49 +0000
commitcf050db3e88bd68f17464afdc48805186eb300f4 (patch)
treedb195c7fe807e81b542a730c743c4d20ec70cb90
parenta5fd66b7b94b88c7d9fe1fe1f47c3faabb7b3191 (diff)
downloadstrace-cf050db3e88bd68f17464afdc48805186eb300f4.tar.gz
strace-cf050db3e88bd68f17464afdc48805186eb300f4.tar.bz2
strace-cf050db3e88bd68f17464afdc48805186eb300f4.tar.xz
Fix build with <linux/loop.h> 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.
-rw-r--r--configure.ac5
-rw-r--r--loop.c6
2 files changed, 10 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index ec8db2d..82c8e87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,6 +254,11 @@ AC_CHECK_DECLS(m4_normalize([
PTRACE_SETOPTIONS
]),,, [#include <sys/ptrace.h>])
+AC_CHECK_DECLS(m4_normalize([
+ LO_FLAGS_AUTOCLEAR,
+ LO_FLAGS_PARTSCAN
+]),,, [#include <linux/loop.h>])
+
AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
diff --git a/loop.c b/loop.c
index a350135..83d9152 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: