diff options
| author | Alistair Popple <apopple@nvidia.com> | 2026-09-09 16:44:59 +1000 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2026-09-27 14:10:32 +0200 |
| commit | b40f5ed85c5f162dfb61fe12d3c58a1d5420e3dc (patch) | |
| tree | 0f93de2c1b724c81ac4d69bbdb3ce7c01c4dea94 /tools/lib/python | |
| parent | a1678ed1f8a344f1d2e4fc9362226555372d76d4 (diff) | |
rust: uaccess: add UserSliceWriter::write_truncated()
Add a helper that writes as much of an AsBytes value as fits in the
remaining userspace buffer and returns the number of bytes copied. This
avoids requiring callers of versioned UAPIs to convert values to byte
slices and truncate them manually.
Suggested-by: Danilo Krummrich <dakr@kernel.org>
Link: https://lore.kernel.org/nova-gpu/DKC6T1DQX2L3.HTHPB2L167TC@kernel.org/
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Acked-by: Miguel Ojeda <ojeda@kernel.org>
Link: https://patch.msgid.link/20260909064506.910162-7-apopple@nvidia.com
[ Inline write_slice_partial() and use it to simplify write_truncated().
- Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
