From 405834e826036033132dd4b6ca114f512297b8c2 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 23 Jul 2024 01:06:12 +0200 Subject: [PATCH] drivers/dstate.c, common/state.c: allow to dump and receive "IMMUTABLE" flag value [#266] Signed-off-by: Jim Klimov --- common/state.c | 5 +++++ drivers/dstate.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/common/state.c b/common/state.c index 51eb8db6ff..aee3175df5 100644 --- a/common/state.c +++ b/common/state.c @@ -536,6 +536,11 @@ void state_setflags(st_tree_t *root, const char *var, size_t numflags, char **fl for (i = 0; i < numflags; i++) { + if (!strcasecmp(flag[i], "IMMUTABLE")) { + sttmp->flags |= ST_FLAG_IMMUTABLE; + continue; + } + if (!strcasecmp(flag[i], "RW")) { sttmp->flags |= ST_FLAG_RW; continue; diff --git a/drivers/dstate.c b/drivers/dstate.c index 59ef0c94d4..5ed9bae489 100644 --- a/drivers/dstate.c +++ b/drivers/dstate.c @@ -638,6 +638,9 @@ static int st_tree_dump_conn(st_tree_t *node, conn_t *conn) /* build the list */ snprintf(flist, sizeof(flist), "%s", node->var); + if (node->flags & ST_FLAG_IMMUTABLE) { + snprintfcat(flist, sizeof(flist), " IMMUTABLE"); + } if (node->flags & ST_FLAG_RW) { snprintfcat(flist, sizeof(flist), " RW"); }