mbox series

[0/6] Enumerated bits in enum

Message ID cover.1665492943.git.dsterba@suse.com (mailing list archive)
Headers show
Series Enumerated bits in enum | expand

Message

David Sterba Oct. 11, 2022, 12:58 p.m. UTC
With some macro magic it's possible to let enum autoincrement define all
bits without manually specifying the value. How it's done is described
in the first patch, the rest are example conversions.

David Sterba (6):
  btrfs: add helper for bit enumeration
  btrfs: convert BTRFS_ILOCK-* defines to enum bit
  btrfs: convert extent_io page op defines to enum bits
  btrfs: convert EXTENT_* bits to enums
  btrfs: convert QGROUP_* defines to enum bits
  btrfs: convert __TRANS_* defines to enum bits

 fs/btrfs/ctree.h          |  9 +++--
 fs/btrfs/extent-io-tree.h | 71 +++++++++++++++++++++------------------
 fs/btrfs/extent_io.h      | 17 ++++++----
 fs/btrfs/misc.h           |  8 +++++
 fs/btrfs/qgroup.h         |  9 +++--
 fs/btrfs/transaction.h    | 18 +++++-----
 6 files changed, 78 insertions(+), 54 deletions(-)

Comments

Josef Bacik Oct. 14, 2022, 12:58 p.m. UTC | #1
On Tue, Oct 11, 2022 at 02:58:45PM +0200, David Sterba wrote:
> With some macro magic it's possible to let enum autoincrement define all
> bits without manually specifying the value. How it's done is described
> in the first patch, the rest are example conversions.
> 
> David Sterba (6):
>   btrfs: add helper for bit enumeration
>   btrfs: convert BTRFS_ILOCK-* defines to enum bit
>   btrfs: convert extent_io page op defines to enum bits
>   btrfs: convert EXTENT_* bits to enums
>   btrfs: convert QGROUP_* defines to enum bits
>   btrfs: convert __TRANS_* defines to enum bits
> 
>  fs/btrfs/ctree.h          |  9 +++--
>  fs/btrfs/extent-io-tree.h | 71 +++++++++++++++++++++------------------
>  fs/btrfs/extent_io.h      | 17 ++++++----
>  fs/btrfs/misc.h           |  8 +++++
>  fs/btrfs/qgroup.h         |  9 +++--
>  fs/btrfs/transaction.h    | 18 +++++-----
>  6 files changed, 78 insertions(+), 54 deletions(-)
> 
>

I love it,

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef