Alistair Popple
2025-Oct-17 04:45 UTC
[PATCH v5 04/14] gpu: nova-core: Add a slice-buffer (sbuffer) datastructure
On 2025-10-17 at 06:18 +1100, Miguel Ojeda <miguel.ojeda.sandonis at gmail.com> wrote...> On Thu, Oct 16, 2025 at 8:23?AM Alexandre Courbot <acourbot at nvidia.com> wrote: > > > > On Mon Oct 13, 2025 at 3:20 PM JST, Alistair Popple wrote: > > > > > > +/// # Example: > > > +/// > > > +/// ``` > > > +/// let mut buf1 = [0u8; 5]; > > > +/// let mut buf2 = [0u8; 5]; > > > +/// let mut sbuffer = SBufferIter::new_writer([&buf1, &buf2]); > > > +/// > > > +/// let data = b"hello"; > > > +/// let result = sbuffer.write_all(data); > > > +/// ``` > > > > This example doesn't build - there are several things wrong with it. It > > is also missing statements to confirm and show the expected result. Here > > is a fixed and slightly improved version:Argh, you're right. I cut and pasted then edited the wrong thing from my test build. How are you building these? The `rustdoc` target seems to ignore Nova (or I'm doing something wrong).> Yeah, I mentioned this one in a previous version -- the section header > is also still wrong too. > > Alistair, please check the link I gave:Will do. I thought Joel had addressed your comments in the fix patch I pulled in from him (he wrote most of this originally) but I can see the `/// # Example:` heading is wrong.> https://docs.kernel.org/rust/coding-guidelines.html#code-documentation > > or other code in the `kernel` crate for examples on how it is usually done. > > It is not critical today, of course, but the further it is from what > will be needed in a few months, the harder it will become to start > building the docs and running the examples as KUnit tests.No, I think it *is* critical :-) Much easier just to get this right from the beginning than deal with heaps of errors/warnings later. It's just my fingers that are still getting used to the subtle differences between C kernel code and Rust kernel code, so thanks for the guidance. - Alistair> > Thanks! > > Cheers, > Miguel
Alexandre Courbot
2025-Oct-17 07:38 UTC
[PATCH v5 04/14] gpu: nova-core: Add a slice-buffer (sbuffer) datastructure
On Fri Oct 17, 2025 at 1:45 PM JST, Alistair Popple wrote:> On 2025-10-17 at 06:18 +1100, Miguel Ojeda <miguel.ojeda.sandonis at gmail.com> wrote... >> On Thu, Oct 16, 2025 at 8:23?AM Alexandre Courbot <acourbot at nvidia.com> wrote: >> > >> > On Mon Oct 13, 2025 at 3:20 PM JST, Alistair Popple wrote: >> > > >> > > +/// # Example: >> > > +/// >> > > +/// ``` >> > > +/// let mut buf1 = [0u8; 5]; >> > > +/// let mut buf2 = [0u8; 5]; >> > > +/// let mut sbuffer = SBufferIter::new_writer([&buf1, &buf2]); >> > > +/// >> > > +/// let data = b"hello"; >> > > +/// let result = sbuffer.write_all(data); >> > > +/// ``` >> > >> > This example doesn't build - there are several things wrong with it. It >> > is also missing statements to confirm and show the expected result. Here >> > is a fixed and slightly improved version: > > Argh, you're right. I cut and pasted then edited the wrong thing from my test > build. How are you building these? The `rustdoc` target seems to ignore Nova (or > I'm doing something wrong).Indeed, rustdoc doesn't consider anything outside of the kernel crate for now, although this is scheduled to change so we need to be ready for it. For now, I just copy/paste the test code into some function elsewhere and try to build. ^_^;