mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
config: add CFG_SECTION_NO_CHECK flag
The CFG_SECTION_NO_CHECK flag can be used to mark a section and its whole subtree as containing settings where checks won't be made (lvmconfig --validate). These are setting where we don't know the names and and type in advance and they're recognized in runtime. As we don't know the type and name in advance, we can't do any checks here of course. Use this flag with great care as it disables config checks for the whole config subtree found under such section. This flag is going to be used by subsequent patches from Zdenek to support some cache settings...
This commit is contained in:
parent
00d24511bc
commit
8bfcefe11a
@ -1040,9 +1040,14 @@ static int _config_def_check_tree(struct cft_check_handle *handle,
|
|||||||
size_t buf_size, struct dm_config_node *root)
|
size_t buf_size, struct dm_config_node *root)
|
||||||
{
|
{
|
||||||
struct dm_config_node *cn;
|
struct dm_config_node *cn;
|
||||||
|
cfg_def_item_t *def;
|
||||||
int valid, r = 1;
|
int valid, r = 1;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
def = cfg_def_get_item_p(root->id);
|
||||||
|
if (def->flags & CFG_SECTION_NO_CHECK)
|
||||||
|
return 1;
|
||||||
|
|
||||||
for (cn = root->child; cn; cn = cn->sib) {
|
for (cn = root->child; cn; cn = cn->sib) {
|
||||||
if ((valid = _config_def_check_node(handle, vp, pvp, rp, prp,
|
if ((valid = _config_def_check_node(handle, vp, pvp, rp, prp,
|
||||||
buf_size, cn)) && !cn->v) {
|
buf_size, cn)) && !cn->v) {
|
||||||
@ -1662,14 +1667,9 @@ static int _out_prefix_fn(const struct dm_config_node *cn, const char *line, voi
|
|||||||
char path[CFG_PATH_MAX_LEN];
|
char path[CFG_PATH_MAX_LEN];
|
||||||
char commentline[MAX_COMMENT_LINE+1];
|
char commentline[MAX_COMMENT_LINE+1];
|
||||||
|
|
||||||
if (cn->id < 0)
|
if (cn->id <= 0)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!cn->id) {
|
|
||||||
log_error(INTERNAL_ERROR "Configuration node %s has invalid id.", cn->key);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (out->tree_spec->type == CFG_DEF_TREE_LIST)
|
if (out->tree_spec->type == CFG_DEF_TREE_LIST)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -121,6 +121,8 @@ typedef union {
|
|||||||
#define CFG_DISABLED 0x200
|
#define CFG_DISABLED 0x200
|
||||||
/* whether to print integers in octal form (prefixed by "0") */
|
/* whether to print integers in octal form (prefixed by "0") */
|
||||||
#define CFG_FORMAT_INT_OCTAL 0x400
|
#define CFG_FORMAT_INT_OCTAL 0x400
|
||||||
|
/* whether to disable checks for the whole config section subtree */
|
||||||
|
#define CFG_SECTION_NO_CHECK 0x800
|
||||||
|
|
||||||
/* configuration definition item structure */
|
/* configuration definition item structure */
|
||||||
typedef struct cfg_def_item {
|
typedef struct cfg_def_item {
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
* CFG_DEFAULT_COMMENTED - node's default value is commented out on output
|
* CFG_DEFAULT_COMMENTED - node's default value is commented out on output
|
||||||
* CFG_DISABLED - configuration is disabled (defaults always used)
|
* CFG_DISABLED - configuration is disabled (defaults always used)
|
||||||
* CFG_FORMAT_INT_OCTAL - print integer number in octal form (also prefixed by "0")
|
* CFG_FORMAT_INT_OCTAL - print integer number in octal form (also prefixed by "0")
|
||||||
|
* CFG_SECTION_NO_CHECK - do not check content of the section at all - use with care!!!
|
||||||
*
|
*
|
||||||
* type: Allowed type for the value of simple configuation setting, one of:
|
* type: Allowed type for the value of simple configuation setting, one of:
|
||||||
* CFG_TYPE_BOOL
|
* CFG_TYPE_BOOL
|
||||||
|
Loading…
Reference in New Issue
Block a user