From: Ryosuke Yasuoka <ryasuoka@redhat.com>
To: arnd@arndb.de, gregkh@linuxfoundation.org, ojeda@kernel.org,
alex.gaynor@gmail.com, boqun.feng@gmail.com, gary@garyguo.net,
bjorn3_gh@protonmail.com, lossin@kernel.org,
a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
dakr@kernel.org, viro@zeniv.linux.org.uk, brauner@kernel.org,
jack@suse.cz
Cc: Ryosuke Yasuoka <ryasuoka@redhat.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: [PATCH rust-next v2 0/3] rust: miscdevice: add llseek support
Date: Wed, 15 Oct 2025 13:02:40 +0900 [thread overview]
Message-ID: <20251015040246.151141-1-ryasuoka@redhat.com> (raw)
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
next reply other threads:[~2025-10-15 4:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 4:02 Ryosuke Yasuoka [this message]
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
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=20251015040246.151141-1-ryasuoka@redhat.com \
--to=ryasuoka@redhat.com \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=arnd@arndb.de \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=brauner@kernel.org \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®