[PATCH] util: fix off-by-1 in inhibitor constants

Daniel P. Berrangé posted 1 patch 1 week, 6 days ago
src/util/virinhibitor.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
[PATCH] util: fix off-by-1 in inhibitor constants
Posted by Daniel P. Berrangé 1 week, 6 days ago
The inhibitor constant values were off-by-1, so when converted into
string format, we picked the wrong names

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/util/virinhibitor.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/util/virinhibitor.h b/src/util/virinhibitor.h
index 0a1c445d41..49cf32fbeb 100644
--- a/src/util/virinhibitor.h
+++ b/src/util/virinhibitor.h
@@ -26,13 +26,13 @@ typedef struct _virInhibitor virInhibitor;
 
 typedef enum {
     VIR_INHIBITOR_WHAT_NONE          = 0,
-    VIR_INHIBITOR_WHAT_SLEEP         = (1 << 1),
-    VIR_INHIBITOR_WHAT_SHUTDOWN      = (1 << 2),
-    VIR_INHIBITOR_WHAT_IDLE          = (1 << 3),
-    VIR_INHIBITOR_WHAT_POWER_KEY     = (1 << 4),
-    VIR_INHIBITOR_WHAT_SUSPEND_KEY   = (1 << 5),
-    VIR_INHIBITOR_WHAT_HIBERNATE_KEY = (1 << 6),
-    VIR_INHIBITOR_WHAT_LID_SWITCH    = (1 << 7),
+    VIR_INHIBITOR_WHAT_SLEEP         = (1 << 0),
+    VIR_INHIBITOR_WHAT_SHUTDOWN      = (1 << 1),
+    VIR_INHIBITOR_WHAT_IDLE          = (1 << 2),
+    VIR_INHIBITOR_WHAT_POWER_KEY     = (1 << 3),
+    VIR_INHIBITOR_WHAT_SUSPEND_KEY   = (1 << 4),
+    VIR_INHIBITOR_WHAT_HIBERNATE_KEY = (1 << 5),
+    VIR_INHIBITOR_WHAT_LID_SWITCH    = (1 << 6),
 } virInhibitorWhat;
 
 typedef enum {
-- 
2.47.1
Re: [PATCH] util: fix off-by-1 in inhibitor constants
Posted by Andrea Bolognani 1 week, 6 days ago
On Tue, Jan 07, 2025 at 04:25:27PM +0000, Daniel P. Berrangé wrote:
> The inhibitor constant values were off-by-1, so when converted into
> string format, we picked the wrong names
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  src/util/virinhibitor.h | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization