1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

config: parse config tree without dup node checking if it's metadata tree

This commit is contained in:
Peter Rajnoha 2016-09-21 14:27:15 +02:00 committed by Zdenek Kabelac
parent 7563e69cf1
commit e40fbd08c8
4 changed files with 13 additions and 8 deletions

View File

@ -496,7 +496,7 @@ int override_config_tree_from_profile(struct cmd_context *cmd,
int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
off_t offset, size_t size, off_t offset2, size_t size2,
checksum_fn_t checksum_fn, uint32_t checksum,
int checksum_only)
int checksum_only, int no_dup_node_check)
{
char *fb, *fe;
int r = 0;
@ -547,8 +547,13 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
if (!checksum_only) {
fe = fb + size + size2;
if (!dm_config_parse(cft, fb, fe))
goto_out;
if (no_dup_node_check) {
if (!dm_config_parse_without_dup_node_check(cft, fb, fe))
goto_out;
} else {
if (!dm_config_parse(cft, fb, fe))
goto_out;
}
}
r = 1;
@ -596,7 +601,7 @@ int config_file_read(struct dm_config_tree *cft)
}
r = config_file_read_fd(cft, cf->dev, 0, (size_t) info.st_size, 0, 0,
(checksum_fn_t) NULL, 0, 0);
(checksum_fn_t) NULL, 0, 0, 0);
if (!cf->keep_open) {
if (!dev_close(cf->dev))

View File

@ -239,7 +239,7 @@ struct dm_config_tree *config_open(config_source_t source, const char *filename,
int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
off_t offset, size_t size, off_t offset2, size_t size2,
checksum_fn_t checksum_fn, uint32_t checksum,
int skip_parse);
int skip_parse, int no_dup_node_check);
int config_file_read(struct dm_config_tree *cft);
struct dm_config_tree *config_file_open_and_read(const char *config_file, config_source_t source,
struct cmd_context *cmd);

View File

@ -56,7 +56,7 @@ int text_vgsummary_import(const struct format_type *fmt,
(dev && !config_file_read_fd(cft, dev, offset, size,
offset2, size2, checksum_fn,
vgsummary->mda_checksum,
checksum_only))) {
checksum_only, 1))) {
log_error("Couldn't read volume group metadata.");
goto out;
}
@ -130,7 +130,7 @@ struct volume_group *text_vg_import_fd(struct format_instance *fid,
if ((!dev && !config_file_read(cft)) ||
(dev && !config_file_read_fd(cft, dev, offset, size,
offset2, size2, checksum_fn, checksum,
skip_parse)))
skip_parse, 1)))
goto_out;
if (skip_parse) {

View File

@ -1386,7 +1386,7 @@ int get_cache_params(struct cmd_context *cmd,
NULL)))
goto_out;
if (!dm_config_parse(current, str, str + strlen(str)))
if (!dm_config_parse_without_dup_node_check(current, str, str + strlen(str)))
goto_out;
}