GNU bug report logs -
#9077
coreutils-8.12: fiemap.h uses "struct fiemap_extent fm_extents[0];"
Previous Next
Full log
Message #20 received at 9077-done <at> debbugs.gnu.org (full text, mbox):
On 15/07/11 06:08, Paul Eggert wrote:
> On 07/14/11 18:11, Pádraig Brady wrote:
>> feel free to push that
>
> OK, thanks, done.
And now that I look at the code a little longer,
I think that the sizeof calculations need to be
adjusted in extent_scan_read() too.
But that's a step too far I think.
So I'm going to apply this.
cheers,
Pádraig.
commit 1ab94c86ca409c2800ce39e2934538c1eed2af10
Author: Pádraig Brady <P <at> draigBrady.com>
Date: Fri Jul 15 09:51:35 2011 +0100
build: avoid a fiemap compile failure on some systems
* 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.
diff --git a/src/extent-scan.c b/src/extent-scan.c
index 48dd564..37445b8 100644
--- a/src/extent-scan.c
+++ b/src/extent-scan.c
@@ -24,11 +24,9 @@
#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
diff --git a/src/fiemap.h b/src/fiemap.h
index e7243b4..3b35297 100644
--- a/src/fiemap.h
+++ b/src/fiemap.h
@@ -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. */
This bug report was last modified 14 years and 8 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.