diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-02-16 13:44:04 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-02-16 13:44:04 -0500 |
commit | c749c11b04444ca40941dd2ddc5802faed148f6a (patch) | |
tree | cb293e353b84dc0c19cea3c1df7229312d711706 /src/ioq.h | |
parent | 60fb65a75147a0d703842b412effdf8ca6ae2169 (diff) | |
download | bfs-c749c11b04444ca40941dd2ddc5802faed148f6a.tar.xz |
ioq: Ensure ioq_ent is sufficiently aligned
The natural alignment of struct ioq_ent is only 2 on m68k, so over-align
it to at least 4 bytes on all platforms.
Link: https://buildd.debian.org/status/fetch.php?pkg=bfs&arch=m68k&ver=3.1-1&stamp=1707699583
Diffstat (limited to 'src/ioq.h')
-rw-r--r-- | src/ioq.h | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -33,11 +33,18 @@ enum ioq_op { }; /** + * The I/O queue implementation needs two tag bits in each pointer to a struct + * ioq_ent, so we need to ensure at least 4-byte alignment. The natural + * alignment is enough on most architectures, but not m68k, so over-align it. + */ +#define IOQ_ENT_ALIGN alignas(4) + +/** * An I/O queue entry. */ struct ioq_ent { /** The I/O operation. */ - enum ioq_op op; + IOQ_ENT_ALIGN enum ioq_op op; /** The return value (on success) or negative error code (on failure). */ int result; |