On Wed, Jan 15, 2025 at 05:41:57PM +0800, Celeste Liu wrote:
On 2025-01-15 17:14, Andrew Jones wrote:
On Wed, Jan 15, 2025 at 04:24:59AM +0800, Celeste Liu wrote:
...
+#ifndef sizeof_field +#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER)) +#endif +#ifndef offsetofend +#define offsetofend(TYPE, MEMBER) \
- (offsetof(TYPE, MEMBER) + sizeof_field(TYPE, MEMBER))
+#endif
I think this is the sixth test to define these. We should copy include/linux/stddef.h into tools/include. We already have tools/include/uapi/linux/stddef.h with __struct_group and __DECLARE_FLEX_ARRAY, so I think it should just work.
Agreed. But it may be better to be a separate patchset so we can change those definition in different selftests one pass.
I think a separate "copy stddef.h" patch could be in this series to avoid having to add the defines here. Then, another series can be sent with one patch for each conversion. That said, I'm OK with adding the defines for now and doing the conversion later. I just hope it will actually happen.
Thanks, drew