s3: smbd: Factor out setting up case parameters for a share to a function - conn_setu...
[Samba.git] / ctdb / server / legacy_conf.c
blob5be8da0dab02a2d446258446c08feb759b5eeead
1 /*
2 CTDB legacy config handling
4 Copyright (C) Martin Schwenke 2018
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include "replace.h"
22 #include "lib/util/debug.h"
24 #include "common/conf.h"
25 #include "common/logging.h"
27 #include "legacy_conf.h"
29 #define LEGACY_SCRIPT_LOG_LEVEL_DEFAULT "ERROR"
31 static bool legacy_conf_validate_script_log_level(const char *key,
32 const char *old_loglevel,
33 const char *new_loglevel,
34 enum conf_update_mode mode)
36 int log_level;
37 bool ok;
39 ok = debug_level_parse(new_loglevel, &log_level);
40 if (!ok) {
41 D_ERR("Invalid value for [%s] -> %s = %s\n",
42 LEGACY_CONF_SECTION,
43 key,
44 new_loglevel);
45 return false;
48 return true;
51 void legacy_conf_init(struct conf_context *conf)
53 conf_define_section(conf, LEGACY_CONF_SECTION, NULL);
55 conf_define_boolean(conf,
56 LEGACY_CONF_SECTION,
57 LEGACY_CONF_REALTIME_SCHEDULING,
58 true,
59 NULL);
60 conf_define_boolean(conf,
61 LEGACY_CONF_SECTION,
62 LEGACY_CONF_RECMASTER_CAPABILITY,
63 true,
64 NULL);
65 conf_define_boolean(conf,
66 LEGACY_CONF_SECTION,
67 LEGACY_CONF_LMASTER_CAPABILITY,
68 true,
69 NULL);
70 conf_define_boolean(conf,
71 LEGACY_CONF_SECTION,
72 LEGACY_CONF_START_AS_STOPPED,
73 false,
74 NULL);
75 conf_define_boolean(conf,
76 LEGACY_CONF_SECTION,
77 LEGACY_CONF_START_AS_DISABLED,
78 false,
79 NULL);
80 conf_define_string(conf,
81 LEGACY_CONF_SECTION,
82 LEGACY_CONF_SCRIPT_LOG_LEVEL,
83 LEGACY_SCRIPT_LOG_LEVEL_DEFAULT,
84 legacy_conf_validate_script_log_level);