[libvirt] [PATCH] locking: Use bit shift for flag values not constant values.

So far it hasn't bitten us, but if the next value wasn't 4, then the logic used to check flag bits would have issues. Signed-off-by: John Ferlan <jferlan@redhat.com> --- Noted this while reviewing danpb's virtlogd as chardev series. src/locking/lock_driver_lockd.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locking/lock_driver_lockd.h b/src/locking/lock_driver_lockd.h index baf346a..6931fe7 100644 --- a/src/locking/lock_driver_lockd.h +++ b/src/locking/lock_driver_lockd.h @@ -23,8 +23,8 @@ # define __VIR_LOCK_DRIVER_LOCKD_H__ enum virLockSpaceProtocolAcquireResourceFlags { - VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1, - VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2, + VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = (1 << 0), + VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = (1 << 1), }; #endif /* __VIR_LOCK_DRIVER_LOCKD_H__ */ -- 2.5.0

On Fri, Mar 04, 2016 at 09:39:35 -0500, John Ferlan wrote:
So far it hasn't bitten us, but if the next value wasn't 4, then the logic used to check flag bits would have issues.
Signed-off-by: John Ferlan <jferlan@redhat.com> ---
ACK, the second power could be mistaken with a sequential numbering. After that it's again pretty obvious. Peter
participants (2)
-
John Ferlan
-
Peter Krempa