summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2016-09-21 14:42:16 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2016-09-21 15:21:02 +0200
commit518a9792ef2c71bc9596b571ddb1d7d2f861362b (patch)
tree06104522dc8bea7fdf457230836ccbc71166ebbc
parent9abbd945222d58b1a55ca99b5337fd20c17c7d36 (diff)
downloadlvm2-518a9792ef2c71bc9596b571ddb1d7d2f861362b.tar.gz
config: add config_tree_from_string_without_dup_node_check to replace dm_config_from_string where needed
-rw-r--r--lib/config/config.h1
-rw-r--r--libdaemon/client/config-util.c15
-rw-r--r--libdaemon/client/config-util.h2
3 files changed, 17 insertions, 1 deletions
diff --git a/lib/config/config.h b/lib/config/config.h
index 8a7d6c327..3b8d998c6 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -252,7 +252,6 @@ struct timespec config_file_timestamp(struct dm_config_tree *cft);
int config_file_changed(struct dm_config_tree *cft);
int config_file_check(struct dm_config_tree *cft, const char **filename, struct stat *info);
-
typedef enum {
CONFIG_MERGE_TYPE_RAW, /* always replace old config values with new config values when merging */
CONFIG_MERGE_TYPE_TAGS /* apply some exceptions when merging tag configs:
diff --git a/libdaemon/client/config-util.c b/libdaemon/client/config-util.c
index e262182b6..93f3d0a93 100644
--- a/libdaemon/client/config-util.c
+++ b/libdaemon/client/config-util.c
@@ -161,6 +161,21 @@ void chain_node(struct dm_config_node *cn,
}
+struct dm_config_tree *config_tree_from_string_without_dup_node_check(const char *config_settings)
+{
+ struct dm_config_tree *cft;
+
+ if (!(cft = dm_config_create()))
+ return_NULL;
+
+ if (!dm_config_parse_without_dup_node_check(cft, config_settings, config_settings + strlen(config_settings))) {
+ dm_config_destroy(cft);
+ return_NULL;
+ }
+
+ return cft;
+}
+
struct dm_config_node *make_config_node(struct dm_config_tree *cft,
const char *key,
struct dm_config_node *parent,
diff --git a/libdaemon/client/config-util.h b/libdaemon/client/config-util.h
index 38f36af31..485161f7b 100644
--- a/libdaemon/client/config-util.h
+++ b/libdaemon/client/config-util.h
@@ -66,4 +66,6 @@ struct dm_config_node *config_make_nodes(struct dm_config_tree *cft,
struct dm_config_node *pre_sib,
...);
+struct dm_config_tree *config_tree_from_string_without_dup_node_check(const char *config_settings);
+
#endif /* _LVM_DAEMON_CONFIG_UTIL_H */