]> git.ipfire.org Git - thirdparty/linux.git/commit
rust: uaccess: add UserSliceReader::read_slice_file()
authorDanilo Krummrich <dakr@kernel.org>
Wed, 22 Oct 2025 14:30:37 +0000 (16:30 +0200)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 4 Nov 2025 23:35:25 +0000 (00:35 +0100)
commit5829e330482b67a14c8c6d2d500431846d493d67
tree3574b36c268a9f14ee5c91a9c54f070abc5185f6
parentf2af7b01b05545fff1cea0768c14e2da552a56ee
rust: uaccess: add UserSliceReader::read_slice_file()

Add UserSliceReader::read_slice_file(), which is the same as
UserSliceReader::read_slice_partial() but updates the given file::Offset
by the number of bytes read.

This is equivalent to C's `simple_write_to_buffer()` and useful when
dealing with file offsets from file operations.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
[ Replace saturating_add() with the raw operator and a corresponding
  OVERFLOW comment. - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
rust/kernel/uaccess.rs