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: <87jyxjf56j.fsf@kernel.org>
Date: Thu, 15 Jan 2026 13:09:40 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: Filipe Xavier <felipeaggger@...il.com>, Miguel Ojeda <ojeda@...nel.org>,
 Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>,
 Gary Guo <gary@...yguo.net>, Björn Roy Baron
 <bjorn3_gh@...tonmail.com>,
 Benno Lossin <benno.lossin@...ton.me>, Alice Ryhl <aliceryhl@...gle.com>,
 Trevor Gross <tmgross@...ch.edu>, Danilo
 Krummrich <dakr@...nel.org>
Cc: daniel.almeida@...labora.com, rust-for-linux@...r.kernel.org,
 felipe_life@...e.com, linux-kernel@...r.kernel.org, Lyude Paul
 <lyude@...hat.com>, Filipe Xavier <felipeaggger@...il.com>
Subject: Re: [PATCH v8] rust: add new macro for common bitflag operations

"Filipe Xavier" <felipeaggger@...il.com> writes:

> We have seen a proliferation of mod_whatever::foo::Flags
> being defined with essentially the same implementation
> for BitAnd, BitOr, contains and etc.
>
> This macro aims to bring a solution for this,
> allowing to generate these methods for user-defined structs.
> With some use cases in KMS and upcoming GPU drivers.
>
> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/We.20really.20need.20a.20common.20.60Flags.60.20type
> Suggested-by: Daniel Almeida <daniel.almeida@...labora.com>
> Suggested-by: Lyude Paul <lyude@...hat.com>
> Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>
> Reviewed-by: Lyude Paul <lyude@...hat.com>
> Signed-off-by: Filipe Xavier <felipeaggger@...il.com>

Tested-by: Andreas Hindborg <a.hindborg@...nel.org>
Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>


I think it would be useful to add:

impl Flags {
     unsafe from_raw(value: Repr) -> {
     ...
     }
}

impl TryFrom<Repr> for Flag {
     // Succeed if `value` is a valid `Flag` enum bit pattern.
}

impl TryFrom<Repr> for Flags {
     // Succeed if `value` is the logical OR of valid enum bit patterns.
}



Best regards,
Andreas Hindborg



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ