summaryrefslogtreecommitdiff
path: root/tools/memory-model
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2023-04-03 18:48:12 +0900
committerMiguel Ojeda <ojeda@kernel.org>2023-04-12 18:41:04 +0200
commit6551a7fe0acbbc816802350414b37d9b42daccc8 (patch)
tree5d627ad52c08ea2d43f28b85bbffcc20f2d4f34c /tools/memory-model
parentc7e20faa5fcad7a177cf6c306138010343dd6d3e (diff)
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 <foxhlchen@gmail.com> Signed-off-by: Fox Chen <foxhlchen@gmail.com> Co-developed-by: Wedson Almeida Filho <wedsonaf@gmail.com> Signed-off-by: Wedson Almeida Filho <wedsonaf@gmail.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Andreas Hindborg <a.hindborg@samsung.com> Reviewed-by: Gary Guo <gary@garyguo.net> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Signed-off-by: Asahi Lina <lina@asahilina.net> Link: https://lore.kernel.org/r/20230224-rust-error-v3-3-03779bddc02b@asahilina.net [ Mark the new associated functions as `#[allow(dead_code)]`. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'tools/memory-model')
0 files changed, 0 insertions, 0 deletions