]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:cluster_support: add cluster_level_global_active() helper
authorStefan Metzmacher <metze@samba.org>
Fri, 7 Aug 2026 10:15:00 +0000 (12:15 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 7 Aug 2026 15:26:30 +0000 (15:26 +0000)
This is useful in order to print useful debug messages in future,
e.g. after a failing if (CLUSTER_LEVEL_ACTIVE(x, y))' check.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/lib/cluster_support.c
source3/lib/cluster_support.h

index 4876db2346c692f564ece44e2d973f78e183bd06..5664dc0af55ab6000d849ee1630a99cd36d6762e 100644 (file)
@@ -362,6 +362,17 @@ void cluster_level_activate_latest(void)
        SMB_ASSERT(CLUSTER_LEVEL_ACTIVE(LATEST, MAX));
 }
 
+/*
+ * Return the global functional level, even if its
+ * not valid yet.
+ */
+const struct cluster_level_active *cluster_level_global_active(void)
+{
+       cluster_level_range_asserts();
+
+       return &global_level_activated;
+}
+
 /*
  * This will allow code like this:
  *
index 5c77da774194586fa8b9bb21a5cd732f6b57b2a7..c6ca90a8739b9c657ced35d8d8584644365cc20f 100644 (file)
@@ -35,6 +35,8 @@ bool cluster_level_global_is_valid(void);
 void cluster_level_activate(const struct cluster_level_active *level);
 void cluster_level_activate_latest(void);
 
+const struct cluster_level_active *cluster_level_global_active(void);
+
 /*
  * We use checks like 'if (CLUSTER_LEVEL_ACTIVE(1, 0))' in
  * order to avoid long lines when using the