]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: avoid a fiemap compile failure on some systems
authorPádraig Brady <P@draigBrady.com>
Fri, 15 Jul 2011 08:51:35 +0000 (09:51 +0100)
committerPádraig Brady <P@draigBrady.com>
Fri, 15 Jul 2011 09:55:04 +0000 (10:55 +0100)
* src/fiemap.h (struct fiemap): Adjust the previous change
to the fiemap_extents array, which would also require changes
to the sizeof calculations in extent_scan_read().
Instead, only declare the fiemap_extents zero length array
on linux, which is the only platform that references this member.
This avoids a compilation failure on systems that don't support
this non standard construct.  We don't use the equivalent C99
flexible array construct so as to have maximum portability.
* src/extent-scan.c: Cleanup. Remove a redundant #ifndef.

src/extent-scan.c
src/fiemap.h

index 48dd564e504aa74523ec1b3b64b43fa0846f7fd2..37445b84daf431905890c2dcf6a053535e55fe1e 100644 (file)
 
 #include "system.h"
 #include "extent-scan.h"
+#include "fiemap.h"
 #include "xstrtol.h"
 
-#ifndef HAVE_FIEMAP
-# include "fiemap.h"
-#endif
 
 /* Work around Linux kernel issues on BTRFS and EXT4 before 2.6.39.
    FIXME: remove in 2013, or whenever we're pretty confident
index e7243b41b5e5a3f60a4588c3ae150a7aec25c4ae..15ddff9a0b524b4fa0f5b8ac7f26d921fe838b5e 100644 (file)
@@ -52,8 +52,12 @@ struct fiemap
   uint32_t fm_reserved;
 
   /* Array of mapped extents(out).
-     The actual size is given by fm_extent_count.  */
-  struct fiemap_extent fm_extents[1];
+     This is protected by the ifdef because it uses non standard
+     zero length arrays.  Note C99 has the equivalent flexible arrays,
+     but we don't use those for maximum portability to older systems.  */
+# ifdef __linux__
+  struct fiemap_extent fm_extents[0];
+# endif
 };
 
 /* The maximum offset can be mapped for a file.  */