diff options
| author | Filipe Xavier <felipeaggger@gmail.com> | 2026-01-17 07:41:25 -0300 |
|---|---|---|
| committer | Miguel Ojeda <ojeda@kernel.org> | 2026-02-02 08:09:11 +0100 |
| commit | 0e62e4f3e56cf6c44926db2ee82ff29b4a28ac03 (patch) | |
| tree | 951bec16cfad5c0f86c3cd6fc20909855f2b3a0f /include/uapi/linux/sync_file.h | |
| parent | 08afcc38a64cec3d6065b90391afebfde686a69a (diff) | |
rust: add `impl_flags!` macro for defining common bitflag operations
We have seen a proliferation of `mod_whatever::foo::Flags` being
defined with essentially the same implementation for `BitAnd`, `BitOr`,
`.contains()` 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@collabora.com>
Suggested-by: Lyude Paul <lyude@redhat.com>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>
Signed-off-by: Filipe Xavier <felipeaggger@gmail.com>
Link: https://patch.msgid.link/20260117-feat-add-bitmask-macro-v9-1-45ea1f00f846@gmail.com
[ Implemented missing `BitXorAssign<$flag> for $flags`. Sorted
`impl`s. Removed prelude addition for now -- I asked the team and they
also felt it wasn't needed. We can always add it later on if needed.
Fixed intra-doc link (by removing the sentence since it was superfluous
anyway). Simplified `empty()` title. Reworded commit slightly. Added
docs to enum variants in example to avoid 'missing_docs' lint when used
in actual code. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'include/uapi/linux/sync_file.h')
0 files changed, 0 insertions, 0 deletions
