]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: fs: add file::Offset type alias
authorDanilo Krummrich <dakr@kernel.org>
Mon, 20 Oct 2025 22:26:13 +0000 (00:26 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 4 Nov 2025 23:05:38 +0000 (00:05 +0100)
Add a type alias for file offsets, i.e. bindings::loff_t. Trying to
avoid using raw bindings types, this seems to be the better alternative
compared to just using i64.

Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Link: https://patch.msgid.link/20251020222722.240473-2-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/fs/file.rs

index cd698785033219710caa35ab5b3fb723d6f0d2c7..23ee689bd2400565223181645157d832a836589f 100644 (file)
@@ -17,6 +17,11 @@ use crate::{
 };
 use core::ptr;
 
+/// Primitive type representing the offset within a [`File`].
+///
+/// Type alias for `bindings::loff_t`.
+pub type Offset = bindings::loff_t;
+
 /// Flags associated with a [`File`].
 pub mod flags {
     /// File is opened in append mode.