[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-aio
Subject:    Re: [PATCH 2/2] Add tests that test struct io_iocb_vector aio.
From:       Jeff Moyer <jmoyer () redhat ! com>
Date:       2021-09-23 19:40:49
Message-ID: x49tuib6pxa.fsf () segfault ! boston ! devel ! redhat ! com
[Download RAW message or body]

Hi, Brett,

So, the "problem" is that the test harness uses the helpers from
libaio.h to fill in the iocb, and those helpers use io_iocb_common no
matter the operation.  As a result, we don't test that the padding in
the other data structures (mainly io_iocb_vector and io_iocb_sockaddr)
is actually correct.

We could test that the structures are properly padded (or at least
similarly padded) using something like the following:

	static_assert(offsetof(struct iocb, u.v.nr) ==
		      offsetof(struct iocb, u.c.nbytes), "fail");
	static_assert(offsetof(struct iocb, u.v.offset) ==
		      offsetof(struct iocb, u.c.offset), "fail");
	static_assert(offsetof(struct iocb, u.saddr.len) ==
		      offsetof(struct iocb, u.c.nbytes), "fail");

And we could do that as part of building the library.  I think I prefer
that to duplicating the io_prep_ helpers.  What do you think?

Cheers,
Jeff


--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org.  For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic