[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231029.010905.2203628525080155252.fujita.tomonori@gmail.com>
Date: Sun, 29 Oct 2023 01:09:05 +0900 (JST)
From: FUJITA Tomonori <fujita.tomonori@...il.com>
To: andrew@...n.ch
Cc: fujita.tomonori@...il.com, benno.lossin@...ton.me,
boqun.feng@...il.com, netdev@...r.kernel.org,
rust-for-linux@...r.kernel.org, tmgross@...ch.edu,
miguel.ojeda.sandonis@...il.com, wedsonaf@...il.com
Subject: Re: [PATCH net-next v7 1/5] rust: core abstractions for network
PHY drivers
On Sat, 28 Oct 2023 16:53:30 +0200
Andrew Lunn <andrew@...n.ch> wrote:
>> > We need to be careful here, since doing this creates a reference
>> > `&bindings::phy_device` which asserts that it is immutable. That is not
>> > the case, since the C side might change it at any point (this is the
>> > reason we wrap things in `Opaque`, since that allows mutatation even
>> > through sharde references).
>>
>> You meant that the C code might modify it independently anytime, not
>> the C code called the Rust abstractions might modify it, right?
>
> The whole locking model is base around that not happening. Things
> should only change with the lock held. I you make a call into the C
> side, then yes, it can and will change it. So you should not cache a
> value over a C call.
Yeah, I understand that. But if I understand Benno correctly, from
Rust perspective, such might happen.
Powered by blists - more mailing lists