xfsdump doesn't compile: undefined reference to 'min'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> commit 5a2985233c390d59d2a9757b119cb0e001c87a96
> Author: Dave Chinner <dchinner@xxxxxxxxxx>
> Date:   Fri Jul 18 08:02:26 2014 +1000
>
>     dump: don't redefine min() or max()
>
>     They are included from other header files.
The message doesn't say from which header and configure doesn't test
for it.
If I compile it (cross-compilation, gcc, uclibc, xfsprogs 3.1.11,
xfsdump 3.1.4), I get lots of errors:
warning: implicit declaration of function 'max'
undefined reference to 'min'

Attached is a pragmatic patch.

  Detlef

PS: I'm not on the list.
diff --git a/common/util.h b/common/util.h
index 86ea8d2..460aea5 100644
--- a/common/util.h
+++ b/common/util.h
@@ -66,6 +66,12 @@ extern intgen_t read_buf( char *bufp,
 			  rrbfp_t return_read_buf_funcp,
 			  intgen_t *statp );
 
+#ifndef min
+#define min( a, b )	( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
+#endif
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
 
 
 /* strncpyterm - like strncpy, but guarantees the destination is null-terminated
diff --git a/restore/dirattr.c b/restore/dirattr.c
index fcfa0c8..6413c15 100644
--- a/restore/dirattr.c
+++ b/restore/dirattr.c
@@ -51,6 +51,10 @@
 
 /* structure definitions used locally ****************************************/
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 /* node handle limits
  */
 #ifdef DIRATTRCHK
diff --git a/restore/namreg.c b/restore/namreg.c
index 41362d1..4630605 100644
--- a/restore/namreg.c
+++ b/restore/namreg.c
@@ -34,6 +34,10 @@
 
 /* structure definitions used locally ****************************************/
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 #define NAMREG_AVGLEN	10
 
 /* persistent context for a namreg - placed in first page
diff --git a/restore/node.c b/restore/node.c
index 4cc8fb0..97d46e1 100644
--- a/restore/node.c
+++ b/restore/node.c
@@ -30,6 +30,13 @@
 #include "node.h"
 #include "mmap.h"
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+#ifndef min
+#define min( a, b )	( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 extern size_t pgsz;
 extern size_t pgmask;
 
_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs

[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux