Re: [PATCH v5 2/2] riscv: selftests: Add a ptrace test to verify a0 and orig_a0 access
From: Celeste Liu
Date: Wed Jan 15 2025 - 06:23:33 EST
On 2025-01-15 17:56, Andrew Jones wrote:
> 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.
v6 has been sent. The "copy stddef.h" patch has been included.
Once this patchset land, I will send another patchset to deal
with other usages.
https://lore.kernel.org/lkml/20250115-riscv-new-regset-v6-0-59bfddd33525@xxxxxxxxxxxxxxxxx/T/
>
> Thanks,
> drew