rust_binder: store Option<Error> in TransactionInfo

Store Option<Error> instead of a raw i32 errno in TransactionInfo so
that the Error value can be used directly when formatting transaction
failures without having to reconstruct it from the integer errno.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20261013-binder-consolidate-txn-prints-v2-2-cf78927dab23@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Alice Ryhl 2026-10-13 12:37:55 +00:00 committed by Greg Kroah-Hartman
parent aeef0f8a3a
commit dfc769a5cf
2 changed files with 9 additions and 5 deletions

View File

@ -1333,8 +1333,8 @@ fn transaction(self: &Arc<Self>, cmd: u32, reader: &mut UserSliceReader) -> Resu
if err.reply != BR_TRANSACTION_COMPLETE {
info.reply = err.reply;
info.error_line = Some(err.line);
if let Some(source) = &err.source {
info.errno = source.to_errno();
if let Some(source) = err.source {
info.errno = Some(source);
{
let mut inner = self.inner.lock();
@ -1476,7 +1476,7 @@ fn reply_inner(self: &Arc<Self>, info: &mut TransactionInfo) -> BinderResult {
orig.from
.deliver_reply(Err(BR_FAILED_REPLY), &orig, Some(ee));
info.reply = BR_FAILED_REPLY;
info.errno = param;
info.errno = err.source;
info.error_line = Some(err.line);
err.reply = BR_TRANSACTION_COMPLETE;
err

View File

@ -136,7 +136,11 @@ fn new(info: &TransactionInfo, ctx: &crate::Context) -> Self {
offsets_size: info.offsets_size,
return_error_line: if failed { info.error_line } else { None },
return_error: if failed { info.reply } else { 0 },
return_error_param: if failed { info.errno } else { 0 },
return_error_param: if failed {
info.errno.map_or(0, |e| e.to_errno())
} else {
0
},
context_name,
}
}
@ -254,7 +258,7 @@ pub(crate) struct TransactionInfo {
pub(crate) offsets_size: usize,
pub(crate) buffers_size: usize,
pub(crate) target_handle: u32,
pub(crate) errno: i32,
pub(crate) errno: Option<Error>,
pub(crate) reply: u32,
pub(crate) error_line: Option<ErrorLocation>,
pub(crate) oneway_spam_suspect: bool,