Re: [PATCH rust-next 1/2] rust: miscdevice: add llseek support
From: Ryosuke Yasuoka
Date: Tue Aug 19 2025 - 01:10:46 EST
On Mon, Aug 18, 2025 at 04:17:40PM +0200, Greg KH wrote:
> On Mon, Aug 18, 2025 at 10:58:38PM +0900, Ryosuke Yasuoka wrote:
> > Add the ability to write a file_operations->llseek hook in Rust when
> > using the miscdevice abstraction.
> >
> > Signed-off-by: Ryosuke Yasuoka <ryasuoka@xxxxxxxxxx>
> > ---
> > rust/kernel/miscdevice.rs | 36 ++++++++++++++++++++++++++++++++++++
> > 1 file changed, 36 insertions(+)
>
> What misc device driver needs any real llseek function? The ones I see
> in the tree are only using generic_llseek or noop_llseek.
>
> Do you have a specific misc driver that you want to write in rust that
> needs this call?
No, I'm not actually writing a practical misc driver. I'm just creating
a toy misc driver to use for testing.
In my toy driver, I need read, write, lseek, and ioctl to verify the
basic functionality of the device driver. I saw the Jones and Alice were
already working on read/write functions [1] and I believe they will
propose their patch soon. So I propose implementing lseek which
anyone does not work on currently. This is the background of my patch.
As you mentioned, lseek by itself probably doesn't have much meaning.
Should I wait for their read/write implementation to be finalized before
proceeding this?
[1] https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/.E2.9C.94.20Miscdevice.20read.2Fwrite.20abstraction.3F/with/497953296
Thank you very much for your comment.
Ryosuke
>
> thanks,
>
> greg k-h
>