master - config: preparation for marking configuration nodes as deprecated
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b769183a98ca942c8252c8571241ac62d7476a26 Commit: b769183a98ca942c8252c8571241ac62d7476a26 Parent: 9c39d635b62aa4f27e3f9ff31f171e501bb8a874 Author: Peter Rajnoha <[email protected]> AuthorDate: Thu Apr 30 15:34:07 2015 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Thu Apr 30 15:39:34 2015 +0200
config: preparation for marking configuration nodes as deprecated
A preparatory code for marking configuration nodes as deprecated:
- struct cfg_def_item gains 2 new fields ("deprecated_since_version" and "deprecation_comment"
- cfg* macros to handle new fields
- related config_settings.h edits to add new fields for each item (null for all at the moment)
Patch with implementation will follow...
--- lib/config/config.c | 10 +- lib/config/config.h | 12 +- lib/config/config_settings.h | 412 +++++++++++++++++++++--------------------- 3 files changed, 221 insertions(+), 213 deletions(-)
lib/config/config.c +5 -5
@@ -65,11 +65,11 @@ struct config_source {* Map each ID to respective definition of the configuration item. */ static struct cfg_def_item _cfg_def_items[CFG_COUNT + 1] = { -#define cfg_section(id, name, parent, flags, since_version, comment) {id, parent, name, CFG_TYPE_SECTION, {0}, flags, since_version, {0}, comment}, -#define cfg(id, name, parent, flags, type, default_value, since_version, unconfigured_value, comment) {id, parent, name, type, {.v_##type = default_value}, flags, since_version, {.v_UNCONFIGURED = unconfigured_value}, comment}, -#define cfg_runtime(id, name, parent, flags, type, since_version, comment) {id, parent, name, type, {.fn_##type = get_default_##id}, flags | CFG_DEFAULT_RUN_TIME, since_version, {.fn_UNCONFIGURED = get_default_unconfigured_##id}, comment}, -#define cfg_array (id, name, parent, flags, types, default_value, since_version, unconfigured_value, comment) {id, parent, name, CFG_TYPE_ARRAY | types, {.v_CFG_TYPE_STRING = default_value}, flags, since_version, {.v_UNCONFIGURED = unconfigured_value}, comment}, -#define cfg_array_runtime (id, name, parent, flags, types, since_version, comment) {id, parent, name, CFG_TYPE_ARRAY | types, {.fn_CFG_TYPE_STRING = get_default_##id}, flags | CFG_DEFAULT_RUN_TIME, since_version, {.fn_UNCONFIGURED = get_default_unconfigured_##id}, comment}, +#define cfg_section(id, name, parent, flags, since_version, deprecated_since_version, deprecation_comment, comment) {id, parent, name, CFG_TYPE_SECTION, {0}, flags, since_version, {0}, deprecated_since_version, deprecation_comment, comment}, +#define cfg(id, name, parent, flags, type, default_value, since_version, unconfigured_value, deprecated_since_version, deprecation_comment, comment) {id, parent, name, type, {.v_##type = default_value}, flags, since_version, {.v_UNCONFIGURED = unconfigured_value}, deprecated_since_version, deprecation_comment, comment}, +#define cfg_runtime(id, name, parent, flags, type, since_version, deprecated_since_version, deprecation_comment, comment) {id, parent, name, type, {.fn_##type = get_default_##id}, flags | CFG_DEFAULT_RUN_TIME, since_version, {.fn_UNCONFIGURED = get_default_unconfigured_##id}, deprecated_since_version, deprecation_comment, comment}, +#define cfg_array (id, name, parent, flags, types, default_value, since_version, unconfigured_value, deprecated_since_version, deprecation_comment, comment) {id, parent, name, CFG_TYPE_ARRAY | types, {.v_CFG_TYPE_STRING = default_value}, flags, since_version, {.v_UNCONFIGURED = unconfigured_value}, deprecated_since_version, deprecation_comment, comment}, +#define cfg_array_runtime (id, name, parent, flags, types, since_version, deprecated_since_version, deprecation_comment, comment) {id, parent, name, CFG_TYPE_ARRAY | types, {.fn_CFG_TYPE_STRING = get_default_##id}, flags | CFG_DEFAULT_RUN_TIME, since_version, {.fn_UNCONFIGURED = get_default_unconfigured_##id}, deprecated_since_version, deprecation_comment, comment},#include "config_settings.h" #undef cfg_section#undef cfg
lib/config/config.h +7 -5
@@ -128,6 +128,8 @@ typedef struct cfg_def_item {uint16_t flags;/* configuration item definition flags */ uint16_t since_version;/* version this item appeared in */ cfg_def_unconfigured_value_t default_unconfigured_value;/* default value in terms of @FOO@, pre-configured (only for settings) */ +uint16_t deprecated_since_version;/* version since this item is deprecated */ +const char *deprecation_comment;/* comment about reasons for deprecation and settings that supersede this one */ const char *comment;/* comment */ } cfg_def_item_t;
@@ -172,11 +174,11 @@ struct config_def_tree_spec {* Register ID for each possible item in the configuration tree. */ enum { -#define cfg_section(id, name, parent, flags, since_version, comment) id, -#define cfg (id, name, parent, flags, type, default_value, since_version, unconfigured_value, comment) id, -#define cfg_runtime (id, name, parent, flags, type, since_version, comment) id, -#define cfg_array (id, name, parent, flags, types, default_value, since_version, unconfigured_value, comment) id, -#define cfg_array_runtime (id, name, parent, flags, types, since_version, comment) id, +#define cfg_section(id, name, parent, flags, since_version, deprecated_since_version, deprecation_comment, comment) id, +#define cfg(id, name, parent, flags, type, default_value, since_version, unconfigured_value, deprecated_since_version, deprecation_comment, comment) id, +#define cfg_runtime(id, name, parent, flags, type, since_version, deprecated_since_version, deprecation_comment, comment) id, +#define cfg_array(id, name, parent, flags, types, default_value, since_version, unconfigured_value, deprecated_since_version, deprecation_comment, comment) id, +#define cfg_array_runtime(id, name, parent, flags, types, since_version, deprecated_since_version, deprecation_comment, comment) id, #include "config_settings.h"#undef cfg_section #undef cfg
lib/config/config_settings.h +209 -203
1,217 lines not on this page · raw message