[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v15 02/21] block: Define BLK_PERM_MAX
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v15 02/21] block: Define BLK_PERM_MAX |
Date: |
Wed, 26 Apr 2017 11:36:22 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 26.04.2017 um 05:33 hat Fam Zheng geschrieben:
> This is the order of the largest possible permission.
>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> include/block/block.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/block/block.h b/include/block/block.h
> index eb0565d..a798f10 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -224,6 +224,8 @@ enum {
> BLK_PERM_ALL = 0x1f,
> };
>
> +#define BLK_PERM_MAX (64 - clz64((uint64_t)BLK_PERM_ALL))
Contrary to the commit message, this is the number of permission bits in
use (i.e. one more than the largest possible permission). You're using
it correctly, though, because your loop condition is i < BLK_PERM_MAX.
This could use an updated commit message and a comment at the #define at
least. Ideally a less ambiguous name instead of the commit (because _MAX
seems to imply what the commit message currently says, not what it
really is), but I can't think of one.
Kevin
- [Qemu-devel] [PATCH v15 00/21] block: Image locking series, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 01/21] block: Make bdrv_perm_names public, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 02/21] block: Define BLK_PERM_MAX, Fam Zheng, 2017/04/25
- Re: [Qemu-devel] [PATCH v15 02/21] block: Define BLK_PERM_MAX,
Kevin Wolf <=
- [Qemu-devel] [PATCH v15 04/21] block: Respect "force-share" in perm propagating, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 03/21] block: Add, parse and store "force-share" option, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 05/21] qemu-img: Add --force-share option to subcommands, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 06/21] qemu-img: Update documentation for -U, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 08/21] iotests: 030: Prepare for image locking, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 07/21] qemu-io: Add --force-share option, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 09/21] iotests: 046: Prepare for image locking, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 10/21] iotests: 055: Don't attach the target image already for drive-backup, Fam Zheng, 2017/04/25
- [Qemu-devel] [PATCH v15 11/21] iotests: 085: Avoid image locking conflict, Fam Zheng, 2017/04/25