diff options
| author | Miguel Ojeda <[email protected]> | 2023-04-03 09:48:12 +0000 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2023-04-12 16:41:04 +0000 |
| commit | 6551a7fe0acbbc816802350414b37d9b42daccc8 (patch) | |
| tree | 5d627ad52c08ea2d43f28b85bbffcc20f2d4f34c /rust/helpers.c | |
| parent | rust: error: Add Error::to_ptr() (diff) | |
| download | kernel-6551a7fe0acbbc816802350414b37d9b42daccc8.tar.gz kernel-6551a7fe0acbbc816802350414b37d9b42daccc8.zip | |
rust: error: Add Error::from_errno{_unchecked}()
Add a function to create `Error` values out of a kernel error return,
which safely upholds the invariant that the error code is well-formed
(negative and greater than -MAX_ERRNO). If a malformed code is passed
in, it will be converted to EINVAL.
Lina: Imported from rust-for-linux/rust as authored by Miguel and Fox
with refactoring from Wedson, renamed from_kernel_errno() to
from_errno().
Co-developed-by: Fox Chen <[email protected]>
Signed-off-by: Fox Chen <[email protected]>
Co-developed-by: Wedson Almeida Filho <[email protected]>
Signed-off-by: Wedson Almeida Filho <[email protected]>
Signed-off-by: Miguel Ojeda <[email protected]>
Reviewed-by: Andreas Hindborg <[email protected]>
Reviewed-by: Gary Guo <[email protected]>
Reviewed-by: Martin Rodriguez Reboredo <[email protected]>
Signed-off-by: Asahi Lina <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Mark the new associated functions as `#[allow(dead_code)]`. ]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/helpers.c')
0 files changed, 0 insertions, 0 deletions
