Re: [PATCH v3 1/2] rust: uapi: add zerocopy/zerocopy_derive

From: Danilo Krummrich

Date: Sat Sep 26 2026 - 17:38:48 EST


On Sat Sep 26, 2026 at 10:59 PM CEST, Gary Guo wrote:
> On Sat Sep 26, 2026 at 5:26 PM BST, Danilo Krummrich wrote:
>> On Sat Sep 26, 2026 at 5:50 PM CEST, Gary Guo wrote:
>>> On Sat Sep 26, 2026 at 1:26 AM BST, Deborah Brouwer wrote:
>>>> @@ -71,3 +71,6 @@
>>>> # Structs should implement `Zeroable` when all of their fields do.
>>>> --with-derive-custom-struct .*=MaybeZeroable
>>>> --with-derive-custom-union .*=MaybeZeroable
>>>> +
>>>> +# `drm_panthor_gpu_info` is copied byte-for-byte to userspace.
>>>> +--with-derive-custom-struct '^drm_panthor_gpu_info$'=zerocopy_derive::most_traits
>>>
>>> This is Tyr specific change and should be in patch 2.
>>
>> Why list all of them separately? Can't we apply this to all uAPI structs?
>
> There are types with paddings which cannot derive `IntoBytes`.

We have some existing uAPI structs without explicit padding; new ones should use
explicit padding though.

But isn’t most_traits intended to handle this through best-effort derivation,
leaving IntoBytes unavailable for types with implicit padding?