RE: [PATCH 1/7] rust: file: add Rust abstraction for `struct file`

From: David Laight
Date: Fri Dec 01 2023 - 12:33:20 EST


From: Benno Lossin
> Sent: 01 December 2023 15:14
>
> On 12/1/23 16:04, Theodore Ts'o wrote:
> > On Fri, Dec 01, 2023 at 12:27:40PM +0000, Alice Ryhl wrote:
> >>
> >> You can import it with a use statement. For example:
> >>
> >> use kernel::file::flags::O_RDONLY;
> >> // use as O_RDONLY
> >
> > That's good to hear,

Except that the examples here seem to imply you can't import
all of the values without listing them all.

From what I've seen of the rust patches the language seems
to have a lower SNR than ADA or VHDL.
Too much syntatic 'goop' makes it difficult to see what code
is actually doing.

....
> Alternatively if we end up with multiple flags modules you can do this
> (the sixth option from Alice):
>
> use kernel::file::flags as file_flags;
> use kernel::foo::flags as foo_flags;
>
> // usage:
>
> file_flags::O_RDONLY
>
> foo_flags::O_RDONLY

That looks useful for the 'obfuscated rust' competition.
Consider:
use kernel::file::flags as foo_flags;
use kernel::foo::flags as file_flags;

It's probably fortunate that I' old enough retire before anyone forces
me to write any of this stuff :-)

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)