Skip to content

Commit

Permalink
bdev: make bdev_nvme_cdw12 and cdw13 packed
Browse files Browse the repository at this point in the history
spdk_bdev_ext_io_opts is packed, and its constituents have to be packed too.
Otherwise, Rust bindgen fails to properly apply align and pack attributes.

Signed-off-by: Dmitry Savitskiy <[email protected]>
  • Loading branch information
dsavitskiy committed May 28, 2024
1 parent 3b594a2 commit 975f663
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/spdk/bdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ SPDK_STATIC_ASSERT(sizeof(union spdk_bdev_nvme_ctratt) == 4, "Incorrect size");
* This is used to pass NVMe specific fields to bdevs, that reports support for them as indicated
* by \ref spdk_bdev_get_nvme_ctratt
*/
#pragma pack(push, 1)
union spdk_bdev_nvme_cdw12 {
uint32_t raw;

Expand All @@ -239,12 +240,14 @@ union spdk_bdev_nvme_cdw12 {
} write;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_bdev_nvme_cdw12) == 4, "Incorrect size");
#pragma pack(pop)

/**
* Union for command dword 13, which by convention matches the NVMe command dword 13 definition.
* This is used to pass NVMe specific fields to bdevs, that reports support for them as indicated
* by \ref spdk_bdev_get_nvme_ctratt
*/
#pragma pack(push, 1)
union spdk_bdev_nvme_cdw13 {
uint32_t raw;

Expand All @@ -255,6 +258,7 @@ union spdk_bdev_nvme_cdw13 {
} write;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_bdev_nvme_cdw13) == 4, "Incorrect size");
#pragma pack(pop)

/**
* Structure with optional IO request parameters
Expand Down

0 comments on commit 975f663

Please sign in to comment.