diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-02-05 21:15:52 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-02-06 12:04:16 +0100 |
commit | da8587b24e64e566a68e547ff42cf44e22714bda (patch) | |
tree | f2fafa005868de3f794de3abba431412fdb7f567 /src/libsystemd/sd-journal/journal-def.h | |
parent | shared/linux: fix fake flexible array in struct autofs_dev_ioctl (diff) | |
download | systemd-da8587b24e64e566a68e547ff42cf44e22714bda.tar.xz systemd-da8587b24e64e566a68e547ff42cf44e22714bda.zip |
sd-journal: avoid use of fake flex arrays
I tried to use DECLARE_FLEX_ARRAY like the kernel does, but it does not work
for anonymous structs (they cannot be declared inline), so an open-coded
version is used.
Diffstat (limited to '')
-rw-r--r-- | src/libsystemd/sd-journal/journal-def.h | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/libsystemd/sd-journal/journal-def.h b/src/libsystemd/sd-journal/journal-def.h index ab4880761b..d35290d3c7 100644 --- a/src/libsystemd/sd-journal/journal-def.h +++ b/src/libsystemd/sd-journal/journal-def.h @@ -93,22 +93,28 @@ struct FieldObject FieldObject__contents; struct FieldObject__packed FieldObject__contents _packed_; assert_cc(sizeof(struct FieldObject) == sizeof(struct FieldObject__packed)); -#define EntryObject__contents { \ - ObjectHeader object; \ - le64_t seqnum; \ - le64_t realtime; \ - le64_t monotonic; \ - sd_id128_t boot_id; \ - le64_t xor_hash; \ - union { \ - struct { \ - le64_t object_offset; \ - le64_t hash; \ - } regular[0]; \ - struct { \ - le32_t object_offset; \ - } compact[0]; \ - } items; \ +#define EntryObject__contents { \ + ObjectHeader object; \ + le64_t seqnum; \ + le64_t realtime; \ + le64_t monotonic; \ + sd_id128_t boot_id; \ + le64_t xor_hash; \ + union { \ + struct { \ + dummy_t __empty__regular; \ + struct { \ + le64_t object_offset; \ + le64_t hash; \ + } regular[]; \ + }; \ + struct { \ + dummy_t __empty_compact; \ + struct { \ + le32_t object_offset; \ + } compact[]; \ + }; \ + } items; \ } struct EntryObject EntryObject__contents; @@ -129,8 +135,8 @@ struct EntryArrayObject { ObjectHeader object; le64_t next_entry_array_offset; union { - le64_t regular[0]; - le32_t compact[0]; + DECLARE_FLEX_ARRAY(le64_t, regular); + DECLARE_FLEX_ARRAY(le32_t, compact); } items; } _packed_; |