[PATCH v4 23/30] context_tracking: Turn CT_STATE_* into bits

Valentin Schneider
2025-01-14T18:02:39Z

A later patch will require to easily exclude CT_STATE_KERNEL from a genuine
a ct->state read CT_STATE_KERNEL, which requires that value being non-zero
and exclusive with the other CT_STATE_* values.

This increases the size of the CT_STATE region of the ct->state variable by
two bits.

Signed-off-by: Valentin Schneider <vschneid@redhat.com>
---
include/linux/context_tracking_state.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index 0b81248aa03e2..eb2149b20baef 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -11,11 +11,11 @@

enum ctx_state {
CT_STATE_DISABLED = -1, /* returned by ct_state() if unknown */
- CT_STATE_KERNEL = 0,
- CT_STATE_IDLE = 1,
- CT_STATE_USER = 2,
- CT_STATE_GUEST = 3,
- CT_STATE_MAX = 4,
+ CT_STATE_KERNEL = 1,
+ CT_STATE_IDLE = 2,
+ CT_STATE_USER = 4,
+ CT_STATE_GUEST = 8,
+ CT_STATE_MAX = 9,
};

struct context_tracking {
--
2.43.0