lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231108102802.524151-1-aliceryhl@google.com>
Date:   Wed,  8 Nov 2023 10:27:59 +0000
From:   Alice Ryhl <aliceryhl@...gle.com>
To:     finn@...enk.de
Cc:     a.hindborg@...sung.com, alex.gaynor@...il.com,
        aliceryhl@...gle.com, arve@...roid.com, benno.lossin@...ton.me,
        bjorn3_gh@...tonmail.com, boqun.feng@...il.com, brauner@...nel.org,
        cmllamas@...gle.com, gary@...yguo.net, gregkh@...uxfoundation.org,
        jeffv@...gle.com, joel@...lfernandes.org,
        linux-kernel@...r.kernel.org, maco@...roid.com,
        mattgilbride@...gle.com, mmaurer@...gle.com, ojeda@...nel.org,
        rust-for-linux@...r.kernel.org, surenb@...gle.com,
        tkjos@...roid.com, wedsonaf@...il.com
Subject: Re: [PATCH RFC 03/20] rust_binder: add threading support

Finn Behrens <finn@...enk.de> writes:
> On 1 Nov 2023, at 19:01, Alice Ryhl wrote:
>> diff --git a/drivers/android/error.rs b/drivers/android/error.rs
>> new file mode 100644
>> index 000000000000..41fc4347ab55
>> --- /dev/null
>> +++ b/drivers/android/error.rs
>> +
>> +impl core::fmt::Debug for BinderError {
>> +    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
>> +        match self.reply {
>> +            BR_FAILED_REPLY => match self.source.as_ref() {
>> +                Some(source) => f
>> +                    .debug_struct("BR_FAILED_REPLY")
>> +                    .field("source", source)
>> +                    .finish(),
>> +                None => f.pad("BR_FAILED_REPLY"),
>> +            },
>> +            BR_DEAD_REPLY => f.pad("BR_DEAD_REPLY"),
>> +            BR_TRANSACTION_COMPLETE => f.pad("BR_TRANSACTION_COMPLETE"),
>> +            _ => f
>> +                .debug_struct("BinderError")
>> +                .field("reply", &self.reply)
>> +                .finish(),
>> +        }
>> +    }
>> +}
> 
> Renaming the debug_struct itself feels like it will make it harder to
> find later, as I would expect that a debug implementation names the
> struct its from.
> 
> Also this has the fallback in CamelCase and all defined cases as
> SCREAMING_SNAKE_CASE. Maybe rather in the defined cases something like
> f.debug_struct(‘BinderError’).field(‘reply’, “name”)?

Yeah, you're right. I'll improve the debug formatting. Thanks for the
suggestion.

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ