]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: convert RUI log formats to use variable length arrays
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 25 Oct 2016 00:26:50 +0000 (11:26 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 25 Oct 2016 00:26:50 +0000 (11:26 +1100)
Source kernel commit: cd00158ce34d6e2c42d8892e8499779b8ac1d2bf

Use variable length array declarations for RUI log items,
and replace the open coded sizeof formulae with a single function.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
libxfs/xfs_log_format.h

index 96c701070292335ff937a5d5ba3f6d6feaa54dfb..770f16aee6fe0dbf62644038c6a9a647c1c95fab 100644 (file)
@@ -647,9 +647,17 @@ struct xfs_rui_log_format {
        __uint16_t              rui_size;       /* size of this item */
        __uint32_t              rui_nextents;   /* # extents to free */
        __uint64_t              rui_id;         /* rui identifier */
-       struct xfs_map_extent   rui_extents[1]; /* array of extents to rmap */
+       struct xfs_map_extent   rui_extents[];  /* array of extents to rmap */
 };
 
+static inline size_t
+xfs_rui_log_format_sizeof(
+       unsigned int            nr)
+{
+       return sizeof(struct xfs_rui_log_format) +
+                       nr * sizeof(struct xfs_map_extent);
+}
+
 /*
  * This is the structure used to lay out an rud log item in the
  * log.  The rud_extents array is a variable size array whose