From: Stefan Metzmacher Date: Fri, 7 Aug 2026 10:15:00 +0000 (+0200) Subject: s3:cluster_support: add cluster_level_global_active() helper X-Git-Tag: samba-4.25.0rc1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba2ae9f7ad847eb060644e4d58791a3a11cbba79;p=thirdparty%2Fsamba.git s3:cluster_support: add cluster_level_global_active() helper 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 Reviewed-by: Ralph Boehme --- diff --git a/source3/lib/cluster_support.c b/source3/lib/cluster_support.c index 4876db2346c..5664dc0af55 100644 --- a/source3/lib/cluster_support.c +++ b/source3/lib/cluster_support.c @@ -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: * diff --git a/source3/lib/cluster_support.h b/source3/lib/cluster_support.h index 5c77da77419..c6ca90a8739 100644 --- a/source3/lib/cluster_support.h +++ b/source3/lib/cluster_support.h @@ -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