]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
cp: port fiemap.h to C99
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 11 May 2019 20:09:39 +0000 (13:09 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 11 May 2019 20:55:54 +0000 (13:55 -0700)
* src/extent-scan.c (extent_scan_read): Adjust to change in
struct fiemap.
* src/fiemap.h (struct fiemap): Use FLEXIBLE_ARRAY_MEMBER
to port to C99.

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

index 2c9db4405a9f14f98d19396ef8dec80886541b2c..ae0d3914b8475dfd7195fbc536b56cd015cc79f3 100644 (file)
@@ -94,7 +94,8 @@ extent_scan_read (struct extent_scan *scan)
       union { struct fiemap f; char c[4096]; } fiemap_buf;
       struct fiemap *fiemap = &fiemap_buf.f;
       struct fiemap_extent *fm_extents = &fiemap->fm_extents[0];
-      enum { count = (sizeof fiemap_buf - sizeof *fiemap)/sizeof *fm_extents };
+      enum { headersize = offsetof (struct fiemap, fm_extents) };
+      enum { count = (sizeof fiemap_buf - headersize) / sizeof *fm_extents };
       verify (count > 1);
 
       /* This is required at least to initialize fiemap->fm_start,
index 88a9fa614478de1a81615329db7462cf3f1d56e6..bf5337381d3f2f1222843cba3afdcab1a9834e5f 100644 (file)
@@ -51,13 +51,8 @@ struct fiemap
 
   uint32_t fm_reserved;
 
-  /* Array of mapped extents(out).
-     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
+  /* Array of mapped extents(out).  */
+  struct fiemap_extent fm_extents[FLEXIBLE_ARRAY_MEMBER];
 };
 
 /* The maximum offset can be mapped for a file.  */