Re: [TECH TOPIC] Rust for Linux

Johannes Berg
2021-07-20T07:09:33Z

On Tue, 2021-07-20 at 03:46 +0200, Miguel Ojeda wrote:
> On Mon, Jul 19, 2021 at 11:33 PM Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > I'm worried that this makes things harder to grep for, and to document,
> > when the same structure is used in both Rust and C.
>
> For the former, by grepping you should find the Rust abstractions that
> use the C structures, because binding generation does not change the
> names or their case. Of course, the Rust abstractions on top of that
> is a different matter, but those do not exist in C anyway. So, at
> least for the use case of searching Rust abstractions that use a given
> C structure or API, it should be fine.

Keep in mind though that there are at least two different use cases for
grep:

1) I need to change the API here, need to find all the users - I agree
this is covered here.

2) I need to change the semantics (e.g. locking) and for this I need to
find all the users and analyse their use (e.g. locking-wise), which
now becomes an exercise in digging through the abstractions and doing
a kind of "indirect" grep for the next level.
Not that this doesn't exist today (e.g. some netlink APIs I changed
in the past have some abstractions in some subsystems), but it does
make it more complex.

johannes