Skip to contentSkip to conversation

xfstests: clean up fallocate configuration tests

PATCH In review Eric Sandeen 3 participants 4 messages May 3, 2011 – May 4, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: clean up fallocate configuration tests

When I added fallocate support to fsx I inadvertently added a duplicate fallocate test.

Consolidate them both into one test (the link test, not the compile test) and make all tests use "true" rather than "yes" to be more consistent with other tests.

---

aclocal.m4 +4 -17
index 70ea0f3..168eb59 100644
@@ -18,27 +18,14 @@ AC_DEFUN([AC_PACKAGE_WANT_LINUX_FIEMAP_H],
 
 AC_DEFUN([AC_PACKAGE_WANT_FALLOCATE],
   [ AC_MSG_CHECKING([for fallocate])
-    AC_TRY_COMPILE([
-#include <linux/falloc.h>
-    ], [
-         fallocate(0, 0, 0, 0);
-    ], have_fallocate=true
-       AC_MSG_RESULT(true),
-       AC_MSG_RESULT(false))
-    AC_SUBST(have_fallocate)
-  ])
-AC_DEFUN([AC_PACKAGE_WANT_FALLOCATE],
-  [ AC_MSG_CHECKING([for fallocate])
     AC_TRY_LINK([
 #define _GNU_SOURCE
 #define _FILE_OFFSET_BITS 64
 #include <fcntl.h>
-#include <linux/falloc.h>
-    ], [
-         fallocate(0, 0, 0, 0);
-    ], have_fallocate=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
+#include <linux/falloc.h> ],
+      [ fallocate(0, 0, 0, 0); ],
+      [ have_fallocate=true; AC_MSG_RESULT(yes) ],
+      [ have_fallocate=false; AC_MSG_RESULT(no) ])
     AC_SUBST(have_fallocate)
   ])
 m4_include([m4/multilib.m4])
src/Makefile +1 -1
index 1162ee0..91088bf 100644
@@ -31,7 +31,7 @@ ifeq ($(HAVE_FIEMAP), true)
 LINUX_TARGETS += fiemap-tester
 endif
 
-ifeq ($(HAVE_FALLOCATE),yes)
+ifeq ($(HAVE_FALLOCATE), true)
 LCFLAGS += -DHAVE_FALLOCATE
 endif
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Eric Sandeen

When I added fallocate support to fsx I inadvertently added a duplicate fallocate test.

Consolidate them both into one test (the link test, not the compile test) and make all tests use "true" rather than "yes" to be more consistent with other tests.

Looks reasonable to me. I learned a little something about autoconf while looking at this. Glad you're an expert :)

I do see that AC_TRY_COMPILE() is now considered obsolete so at some point maybe we should update to use the suggested alternatives (AC_COMPILE_IFELSE() in this example).

Quoted 1 line

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
In reply to Eric Sandeen
Quoted 60 lines · Eric Sandeen

When I added fallocate support to fsx I inadvertently added a duplicate fallocate test.

Consolidate them both into one test (the link test, not the compile test) and make all tests use "true" rather than "yes" to be more consistent with other tests.

---

aclocal.m4 +4 -17
index 70ea0f3..168eb59 100644
@@ -18,27 +18,14 @@ AC_DEFUN([AC_PACKAGE_WANT_LINUX_FIEMAP_H],
 
  AC_DEFUN([AC_PACKAGE_WANT_FALLOCATE],
    [ AC_MSG_CHECKING([for fallocate])
-    AC_TRY_COMPILE([
-#include<linux/falloc.h>
-    ], [
-         fallocate(0, 0, 0, 0);
-    ], have_fallocate=true
-       AC_MSG_RESULT(true),
-       AC_MSG_RESULT(false))
-    AC_SUBST(have_fallocate)
-  ])
-AC_DEFUN([AC_PACKAGE_WANT_FALLOCATE],
-  [ AC_MSG_CHECKING([for fallocate])
      AC_TRY_LINK([
  #define _GNU_SOURCE
  #define _FILE_OFFSET_BITS 64
  #include<fcntl.h>
-#include<linux/falloc.h>
-    ], [
-         fallocate(0, 0, 0, 0);
-    ], have_fallocate=yes
-       AC_MSG_RESULT(yes),
-       AC_MSG_RESULT(no))
+#include<linux/falloc.h>  ],
+      [ fallocate(0, 0, 0, 0); ],
+      [ have_fallocate=true; AC_MSG_RESULT(yes) ],
+      [ have_fallocate=false; AC_MSG_RESULT(no) ])
      AC_SUBST(have_fallocate)
    ])
  m4_include([m4/multilib.m4])
src/Makefile +1 -1
index 1162ee0..91088bf 100644
@@ -31,7 +31,7 @@ ifeq ($(HAVE_FIEMAP), true)
  LINUX_TARGETS += fiemap-tester
  endif
 
-ifeq ($(HAVE_FALLOCATE),yes)
+ifeq ($(HAVE_FALLOCATE), true)
  LCFLAGS += -DHAVE_FALLOCATE
  endif
 
Quoted 4 lines

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Thanks Eric,

I tried it out and it looks like it works great. I will back out the changes to the Makefile in my fsx patch.

Allison Henderson

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 6 lines · Allison Henderson

Thanks Eric,

I tried it out and it looks like it works great. I will back out the changes to the Makefile in my fsx patch.

Allison Henderson

Thanks; I pushed it to the xfstests-dev git tree, you should be able to pull it and rebase your patches in a few minutes.

-Eric

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs