]> sourceware.org Git - lvm2.git/commit
config: add support for configuration check (config_def_check fn)
authorPeter Rajnoha <prajnoha@redhat.com>
Tue, 5 Mar 2013 16:14:18 +0000 (17:14 +0100)
committerPeter Rajnoha <prajnoha@redhat.com>
Wed, 6 Mar 2013 09:17:18 +0000 (10:17 +0100)
commite38aaddb5e72a2123a03dedbb40c2aa594495c17
tree888d52f4bfeebb815a61bf00cc50d7452aff92c5
parent296385c0f3fa5176704c42f92210e7c5d38996ad
config: add support for configuration check (config_def_check fn)

Add support for configuration checking - type checking and recognition
of registered configuration settings that LVM2 understands and also
check the structure of the configuration. Log error on any mismatch
found.

A hash over all allowed configuration paths is created which helps
with matching the exact configuration (lvm.conf/--config tree) with
the configuration item definition from config_settings.h in an
efficient and one-step way.

Two more helper flags are introduced for each configuration definition
item:

  - CFG_USED which marks the item as being used (lvm.conf/--config)
    This helps with identifying missing configuration options
    (and for which defaults were used) when traversing the tree later.

  - CFG_VALID which denotes that the item has already been checked and
    it was found valid. This improves performance, so if the check
    is called once again on the same tree which was not reloaded, we
    can just return the state from previous check (with a possibility
    to force the check if needed).

The new function that config.h exports and which is going to be used
to perform the configuration checking is:

  int config_def_check(struct cmd_context *cmd, int force, int skip, int suppress_messages)

...which is exported internally via config.h.
lib/config/config.c
lib/config/config.h
This page took 0.039179 seconds and 5 git commands to generate.