struct volume_group *import_vg_from_buffer(char *buf, struct format_instance *fid) { struct volume_group *vg = NULL; struct config_tree *cft; struct text_vg_version_ops **vsn; _init_text_import(); if (!(cft = create_config_tree_from_string(fid->fmt->cmd, buf))) return_NULL; for (vsn = &_text_vsn_list[0]; *vsn; vsn++) { if (!(*vsn)->check_version(cft)) continue; /* * The only path to this point uses cached vgmetadata, * so it can use cached PV state too. */ if (!(vg = (*vsn)->read_vg(fid, cft, 1))) stack; break; } destroy_config_tree(cft); return vg; }
int override_config_tree_from_string(struct cmd_context *cmd, const char *config_settings) { if (!(cmd->cft_override = create_config_tree_from_string(config_settings))) { log_error("Failed to set overridden configuration entries."); return 1; } return 0; }
struct volume_group *import_vg_from_buffer(char *buf, struct format_instance *fid) { struct volume_group *vg = NULL; struct config_tree *cft; struct text_vg_version_ops **vsn; _init_text_import(); if (!(cft = create_config_tree_from_string(fid->fmt->cmd, buf))) return_NULL; for (vsn = &_text_vsn_list[0]; *vsn; vsn++) { if (!(*vsn)->check_version(cft)) continue; if (!(vg = (*vsn)->read_vg(fid, cft))) stack; break; } destroy_config_tree(cft); return vg; }