linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH rust-next v2 0/3] rust: miscdevice: add llseek support
@ 2025-10-15  4:02 Ryosuke Yasuoka
  2025-10-15  4:02 ` [PATCH rust-next v2 1/3] rust: fs: add pos/pos_mut methods for LocalFile struct Ryosuke Yasuoka
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Ryosuke Yasuoka @ 2025-10-15  4:02 UTC (permalink / raw)
  To: arnd, gregkh, ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh,
	lossin, a.hindborg, aliceryhl, tmgross, dakr, viro, brauner, jack
  Cc: Ryosuke Yasuoka, rust-for-linux, linux-kernel, linux-fsdevel

Hi all,

This patch series add support for the llseek file operation to misc
devices written in Rust.

The first patch introduces pos()/pos_mut() methods to LocalFile and
File. These helpers allow to refer to the file's position, which is
required for implementing lseek in misc_device.

The second patch adds the llseek hook to the MiscDevice trait, enabling
Rust drivers to implement the seeking logic.

The last one updates the rust_misc_device sample to demonstrate the
usage of the new llseek hook, including a C test program that verifies
the functionality.

history of this patch:

v2:
- Introduce pos() and pos_mut() methods to get file positions,
and use them in sample programs.
- Add read, write and lseek in the userspace sample program. 
- Remove unsafe block from the sample program. 
- In this v2 patch, remove SEEK_END related codes from
a sample program because it needs inode->i_size which has not
implemented yet. The purpose of this patch is to introduce
lseek(). Since implementing an 'inode wrap' requires more
extensive discussion than adding llseek hook(), I just
exclude it from this patch series. I believe that whether
SEEK_END is supported or not has no impact on adding lseek()
to MiscDevice.

v1:
https://lore.kernel.org/rust-for-linux/20250818135846.133722-1-ryasuoka@redhat.com/


Ryosuke Yasuoka (3):
  rust: fs: add pos/pos_mut methods for LocalFile struct
  rust: miscdevice: add llseek support
  rust: samples: miscdevice: add lseek samples

 rust/kernel/fs/file.rs           | 61 ++++++++++++++++++++++++++++
 rust/kernel/miscdevice.rs        | 36 +++++++++++++++++
 samples/rust/rust_misc_device.rs | 68 ++++++++++++++++++++++++++++++++
 3 files changed, 165 insertions(+)


base-commit: 98906f9d850e4882004749eccb8920649dc98456
-- 
2.51.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-10-16 14:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-15  4:02 [PATCH rust-next v2 0/3] rust: miscdevice: add llseek support Ryosuke Yasuoka
2025-10-15  4:02 ` [PATCH rust-next v2 1/3] rust: fs: add pos/pos_mut methods for LocalFile struct Ryosuke Yasuoka
2025-10-15  4:02 ` [PATCH rust-next v2 2/3] rust: miscdevice: add llseek support Ryosuke Yasuoka
2025-10-15  4:02 ` [PATCH rust-next v2 3/3] rust: samples: miscdevice: add lseek samples Ryosuke Yasuoka
2025-10-15  5:40 ` [PATCH rust-next v2 0/3] rust: miscdevice: add llseek support Greg KH
2025-10-16 10:19   ` Ryosuke Yasuoka
2025-10-16 11:24     ` Greg KH
2025-10-16 14:39       ` Ryosuke Yasuoka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).