aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMattias Nissler <122288598+mnissler-rivos@users.noreply.github.com>2023-08-30 17:19:50 +0200
committerGitHub <noreply@github.com>2023-08-30 16:19:50 +0100
commitf981913abd9a5926d38a48c6ba9b1ba7dacb1c11 (patch)
treefd987030168cc14095322664e86feaefaa362582 /include
parent149aa845b11bd13fca41dcf65b51283f83ac5520 (diff)
downloadlibvfio-user-f981913abd9a5926d38a48c6ba9b1ba7dacb1c11.zip
libvfio-user-f981913abd9a5926d38a48c6ba9b1ba7dacb1c11.tar.gz
libvfio-user-f981913abd9a5926d38a48c6ba9b1ba7dacb1c11.tar.bz2
Replace protocol header flags bit field with mask (#773)
It turns out that the bit field will not yield the desired / specified bit layout on big-endian systems, see issue #768 for details. Thus, replace the bit field with constants for the individual fields and use bit masking when accessing the flags field. Signed-off-by: Mattias Nissler <mnissler@rivosinc.com> Reviewed-by: John Levon <john.levon@nutanix.com> Reviewed-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'include')
-rw-r--r--include/vfio-user.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/include/vfio-user.h b/include/vfio-user.h
index 52f0870..a749938 100644
--- a/include/vfio-user.h
+++ b/include/vfio-user.h
@@ -81,14 +81,12 @@ struct vfio_user_header {
uint16_t msg_id;
uint16_t cmd;
uint32_t msg_size;
- struct {
- uint32_t type : 4;
-#define VFIO_USER_F_TYPE_COMMAND 0
-#define VFIO_USER_F_TYPE_REPLY 1
- uint32_t no_reply : 1;
- uint32_t error : 1;
- uint32_t resvd : 26;
- } flags;
+ uint32_t flags;
+#define VFIO_USER_F_TYPE_MASK (0xf)
+#define VFIO_USER_F_TYPE_COMMAND (0x0)
+#define VFIO_USER_F_TYPE_REPLY (0x1)
+#define VFIO_USER_F_NO_REPLY (0x10)
+#define VFIO_USER_F_ERROR (0x20)
uint32_t error_no;
} __attribute__((packed));