mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
config: use dm_config_parse_only_section
This commit is contained in:
parent
51fcc5650a
commit
9850452300
@ -483,7 +483,7 @@ int override_config_tree_from_profile(struct cmd_context *cmd,
|
||||
int config_file_read_fd(struct dm_config_tree *cft, struct device *dev, dev_io_reason_t reason,
|
||||
off_t offset, size_t size, off_t offset2, size_t size2,
|
||||
checksum_fn_t checksum_fn, uint32_t checksum,
|
||||
int checksum_only, int no_dup_node_check)
|
||||
int checksum_only, int no_dup_node_check, int only_pv_summary)
|
||||
{
|
||||
char namebuf[NAME_LEN + 1] __attribute__((aligned(8)));
|
||||
int namelen = 0;
|
||||
@ -573,7 +573,10 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev, dev_io_r
|
||||
if (!checksum_only) {
|
||||
fe = fb + size + size2;
|
||||
if (no_dup_node_check) {
|
||||
if (!dm_config_parse_without_dup_node_check(cft, fb, fe))
|
||||
if (only_pv_summary) {
|
||||
if (!dm_config_parse_only_section(cft, fb, fe, "physical_volumes"))
|
||||
goto_out;
|
||||
} else if (!dm_config_parse_without_dup_node_check(cft, fb, fe))
|
||||
goto_out;
|
||||
} else {
|
||||
if (!dm_config_parse(cft, fb, fe))
|
||||
@ -635,7 +638,7 @@ int config_file_read_from_file(struct dm_config_tree *cft)
|
||||
cf->dev = &fake_dev;
|
||||
|
||||
r = config_file_read_fd(cft, cf->dev, DEV_IO_MDA_CONTENT, 0, (size_t) info.st_size, 0, 0,
|
||||
(checksum_fn_t) NULL, 0, 0, 0);
|
||||
(checksum_fn_t) NULL, 0, 0, 0, 0);
|
||||
|
||||
free((void*)alias->str);
|
||||
free((void*)alias);
|
||||
|
@ -243,7 +243,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, dev_io_reason_t reason,
|
||||
off_t offset, size_t size, off_t offset2, size_t size2,
|
||||
checksum_fn_t checksum_fn, uint32_t checksum,
|
||||
int skip_parse, int no_dup_node_check);
|
||||
int skip_parse, int no_dup_node_check, int only_pv_summary);
|
||||
int config_file_read_from_file(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);
|
||||
|
@ -61,7 +61,7 @@ int text_read_metadata_summary(const struct format_type *fmt,
|
||||
if (!config_file_read_fd(cft, dev, reason, offset, size,
|
||||
offset2, size2, checksum_fn,
|
||||
vgsummary->mda_checksum,
|
||||
checksum_only, 1)) {
|
||||
checksum_only, 1, 1)) {
|
||||
log_warn("WARNING: invalid metadata text from %s at %llu.",
|
||||
dev_name(dev), (unsigned long long)offset);
|
||||
goto out;
|
||||
@ -156,7 +156,7 @@ struct volume_group *text_read_metadata(struct format_instance *fid,
|
||||
|
||||
if (!config_file_read_fd(cft, dev, MDA_CONTENT_REASON(primary_mda), offset, size,
|
||||
offset2, size2, checksum_fn, checksum,
|
||||
skip_parse, 1)) {
|
||||
skip_parse, 1, 0)) {
|
||||
log_warn("WARNING: couldn't read volume group metadata from %s.", dev_name(dev));
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user