All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Hindborg <a.hindborg@kernel.org>
To: "Daniel Almeida" <daniel.almeida@collabora.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
	"Waiman Long" <longman@redhat.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Joel Becker" <jlbec@evilplan.org>,
	"Christoph Hellwig" <hch@lst.de>, "Fiona Behrens" <me@kloenk.dev>,
	"Charalampos Mitrodimas" <charmitro@posteo.net>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/4] rust: configfs abstractions
Date: Sat, 22 Feb 2025 10:36:01 +0100	[thread overview]
Message-ID: <87seo6coe6.fsf@kernel.org> (raw)
In-Reply-To: <50E0963F-2CFA-462E-9767-626F0D18C77F@collabora.com> (Daniel Almeida's message of "Fri, 21 Feb 2025 12:18:24 -0300")

"Daniel Almeida" <daniel.almeida@collabora.com> writes:

> Hi Andreas,
>
>> On 18 Feb 2025, at 09:57, Andreas Hindborg <a.hindborg@kernel.org> wrote:
>>
>> This series adds a safe Rust API that allows Rust modules to interface
>> the `configfs` machinery.
>>
>> The series contains an example for the samples folder to demonstrate
>> usage of the API. As such, there is no inline example in the
>> documentation.
>>
>> The last patch adds a maintainer entry for the Rust configfs
>> abstractions, to make it absolutely clear that I will commit to maintain
>> these abstractions, if required. Feel free to drop this patch if this is
>> not required.
>>
>> The series is a dependency of `rnull`, the Rust null block driver.
>> Please see [1] for initial `configfs` support in `rnull`.
>>
>> [1] https://github.com/metaspace/linux/tree/9ac53130f5fb05b9b3074fa261b445b8fde547dd/drivers/block/rnull
>>
>
> I am trying to test this before reviewing, but I get this error:
>
>
> ```
> error[E0308]: mismatched types
>    --> linux/rust/kernel/miscdevice.rs:300:62
>     |
> 300 |     let device = unsafe { <T::Ptr as ForeignOwnable>::borrow(private) };
>     |                           ---------------------------------- ^^^^^^^ expected `*mut <... as ForeignOwnable>::PointedTo`, found `*mut c_void`
>     |                           |
>     |                           arguments to this function are incorrect
>     |
>     = note: expected raw pointer `*mut <<T as miscdevice::MiscDevice>::Ptr as types::ForeignOwnable>::PointedTo`
>                found raw pointer `*mut ffi::c_void`
>     = help: consider constraining the associated type `<<T as miscdevice::MiscDevice>::Ptr as types::ForeignOwnable>::PointedTo` to `ffi::c_void` or calling a method that returns `<<T as miscdevice::MiscDevice>::Ptr as types::ForeignOwnable>::PointedTo`
>     = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
> note: associated function defined here
>    --> /home/dwls/dev/linux/rust/kernel/types.rs:98:15
>     |
> 98  |     unsafe fn borrow<'a>(ptr: *mut Self::PointedTo) -> Self::Borrowed<'a>;
>     |               ^^^^^^
>
> error: aborting due to 1 previous error
> ```

Thanks for testing! It seems there is a bug in the patch "rust: sync:
change `<Arc<T> as ForeignOwnable>::PointedTo` to `T`". If you would
like to test now, could you either:

- add `.cast()` on `private` in miscdevice.rs:300
- or drop patch 1/4 and pick [1] as a dependency instead
- or build with `CONFIG_COMPAT=n`

Or wait for me to send a new version where I add a dependency on the
fixed patch.


Best regards,
Andreas Hindborg



[1] https://lore.kernel.org/all/20250218-rust-xarray-bindings-v17-0-f3a99196e538@gmail.com/


      reply	other threads:[~2025-02-22  9:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-18 12:57 [PATCH v3 0/4] rust: configfs abstractions Andreas Hindborg
2025-02-18 12:57 ` [PATCH v3 1/4] rust: sync: change `<Arc<T> as ForeignOwnable>::PointedTo` to `T` Andreas Hindborg
2025-02-18 12:57 ` [PATCH v3 2/4] rust: configfs: introduce rust support for configfs Andreas Hindborg
2025-02-18 12:57 ` [PATCH v3 3/4] rust: configfs: add a sample demonstrating configfs usage Andreas Hindborg
2025-02-18 12:57 ` [PATCH v3 4/4] MAINTAINERS: add entry for configfs Rust abstractions Andreas Hindborg
2025-02-21 15:18 ` [PATCH v3 0/4] rust: configfs abstractions Daniel Almeida
2025-02-22  9:36   ` Andreas Hindborg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87seo6coe6.fsf@kernel.org \
    --to=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=charmitro@posteo.net \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=hch@lst.de \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=me@kloenk.dev \
    --cc=mingo@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.