diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2023-05-30 08:12:40 +0900 |
---|---|---|
committer | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2023-05-30 08:12:40 +0900 |
commit | fc2b52cf2e0e48938b65e20fae7099e54ef74c76 (patch) | |
tree | 5f18632b2e9cf0dd5346497b3174e72e82b2a4a4 /drivers/firewire/uapi-test.c | |
parent | 147e9d3af34a92ff567c58b0e89099d26787faba (diff) | |
download | linux-stable-fc2b52cf2e0e48938b65e20fae7099e54ef74c76.tar.gz linux-stable-fc2b52cf2e0e48938b65e20fae7099e54ef74c76.tar.bz2 linux-stable-fc2b52cf2e0e48938b65e20fae7099e54ef74c76.zip |
firewire: cdev: add new event to notify response subaction with time stamp
This commit adds new event to notify event of response subaction with
time stamp field.
Current compiler implementation of System V ABI selects one of structure
members which has the maximum alignment size in the structure to decide
the size of structure. In the case of fw_cdev_event_request3 structure,
it is closure member which has 8 byte storage. The size of alignment for
the type of 8 byte storage differs depending on architectures; 4 byte for
i386 architecture and 8 byte for the others including x32 architecture.
It is inconvenient to device driver developer to use structure layout
which varies between architectures since the developer takes care of ioctl
compat layer. This commit adds 32 bit member for padding to keep the
size of structure as multiples of 8.
Cc: kunit-dev@googlegroups.com
Link: https://lore.kernel.org/r/20230529113406.986289-9-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Diffstat (limited to 'drivers/firewire/uapi-test.c')
-rw-r--r-- | drivers/firewire/uapi-test.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/firewire/uapi-test.c b/drivers/firewire/uapi-test.c index dd95899de316..640e5c05415a 100644 --- a/drivers/firewire/uapi-test.c +++ b/drivers/firewire/uapi-test.c @@ -45,9 +45,24 @@ static void structure_layout_event_request3(struct kunit *test) KUNIT_EXPECT_EQ(test, 56, offsetof(struct fw_cdev_event_request3, data)); } +// Added at v6.5. +static void structure_layout_event_response2(struct kunit *test) +{ + KUNIT_EXPECT_EQ(test, 32, sizeof(struct fw_cdev_event_response2)); + + KUNIT_EXPECT_EQ(test, 0, offsetof(struct fw_cdev_event_response2, closure)); + KUNIT_EXPECT_EQ(test, 8, offsetof(struct fw_cdev_event_response2, type)); + KUNIT_EXPECT_EQ(test, 12, offsetof(struct fw_cdev_event_response2, rcode)); + KUNIT_EXPECT_EQ(test, 16, offsetof(struct fw_cdev_event_response2, length)); + KUNIT_EXPECT_EQ(test, 20, offsetof(struct fw_cdev_event_response2, request_tstamp)); + KUNIT_EXPECT_EQ(test, 24, offsetof(struct fw_cdev_event_response2, response_tstamp)); + KUNIT_EXPECT_EQ(test, 32, offsetof(struct fw_cdev_event_response2, data)); +} + static struct kunit_case structure_layout_test_cases[] = { KUNIT_CASE(structure_layout_event_response), KUNIT_CASE(structure_layout_event_request3), + KUNIT_CASE(structure_layout_event_response2), {} }; |