[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231201150442.GC509422@mit.edu>
Date: Fri, 1 Dec 2023 10:04:42 -0500
From: "Theodore Ts'o" <tytso@....edu>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: david.laight@...lab.com, a.hindborg@...sung.com,
alex.gaynor@...il.com, arve@...roid.com, benno.lossin@...ton.me,
bjorn3_gh@...tonmail.com, boqun.feng@...il.com, brauner@...nel.org,
cmllamas@...gle.com, dan.j.williams@...el.com, dxu@...uu.xyz,
gary@...yguo.net, gregkh@...uxfoundation.org,
joel@...lfernandes.org, keescook@...omium.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
maco@...roid.com, ojeda@...nel.org, peterz@...radead.org,
rust-for-linux@...r.kernel.org, surenb@...gle.com,
tglx@...utronix.de, tkjos@...roid.com, viro@...iv.linux.org.uk,
wedsonaf@...il.com, willy@...radead.org
Subject: Re: [PATCH 1/7] rust: file: add Rust abstraction for `struct file`
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, but it still means that we have to use the XYZ_*
prefix, because otherwise, after something like
use kernel::file::flags::RDONLY;
use kernel::uapi::rwf::RDONLY;
that will blow up. So that has to be
use kernel::file::flags::O_RDONLY;
use kernel::uapi::rwf::RWF_RDONLY;
Which is a bit more verbose, at least things won't blow up
spectacularly when you need to use both namespaces in the same
codepath.
Also note how we do things like this:
#define IOCB_APPEND (__force int) RWF_APPEND
In other words, the IOCB_* namespace and the RWF_* namespace partially
share code points, and so they *have* to be assigned to the same value
--- and note that since RWF_APPEND is defined as part of the UAPI, it
might not even be the same across different architectures....
Cheers,
- Ted
Powered by blists - more mailing lists