Re: [PATCH net-next v7 1/5] rust: core abstractions for network PHY drivers

Miguel Ojeda
2023-10-28T15:16:23Z

On Sat, Oct 28, 2023 at 12:40 AM Andrew Lunn <andrew@lunn.ch> wrote:
>
> After the discussion about mutability, i took a look at the C code,
> and started adding const to functions which take phydev, but don't
> modify it. Does bindgen look for such const attributes? Does it make a
> difference to be binding?

I think you are referring to the `const` type qualifier, not the
attribute (which the kernel uses too).

But yes, it makes a difference in the output it generates (if we are
talking about the pointed-to), e.g.

void f(struct S *); // *mut S
void f(const struct S *); // *const S

Being const-correct would be a good change for C in any case.

Cheers,
Miguel