mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Move export_vg_to_config_tree alongside export_vg_to_buffer.
This commit is contained in:
parent
c3b06ff55d
commit
c1e851e208
24
lib/cache/lvmetad.c
vendored
24
lib/cache/lvmetad.c
vendored
@ -425,26 +425,6 @@ static int _fixup_ignored(struct metadata_area *mda, void *baton) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static struct dm_config_tree *_export_vg_to_config_tree(struct volume_group *vg)
|
||||
{
|
||||
char *buf = NULL;
|
||||
struct dm_config_tree *vgmeta;
|
||||
|
||||
if (!export_vg_to_buffer(vg, &buf)) {
|
||||
log_error("Could not format VG metadata.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(vgmeta = dm_config_from_string(buf))) {
|
||||
log_error("Error parsing VG metadata.");
|
||||
dm_free(buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dm_free(buf);
|
||||
return vgmeta;
|
||||
}
|
||||
|
||||
int lvmetad_vg_update(struct volume_group *vg)
|
||||
{
|
||||
daemon_reply reply;
|
||||
@ -462,7 +442,7 @@ int lvmetad_vg_update(struct volume_group *vg)
|
||||
if (!lvmetad_active() || test_mode())
|
||||
return 1; /* fake it */
|
||||
|
||||
if (!(vgmeta = _export_vg_to_config_tree(vg)))
|
||||
if (!(vgmeta = export_vg_to_config_tree(vg)))
|
||||
return_0;
|
||||
|
||||
log_debug_lvmetad("Sending lvmetad updated metadata for VG %s (seqno %" PRIu32 ")", vg->name, vg->seqno);
|
||||
@ -772,7 +752,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
|
||||
_extract_mdas(info, pvmeta, pvmeta->root);
|
||||
|
||||
if (vg) {
|
||||
if (!(vgmeta = _export_vg_to_config_tree(vg))) {
|
||||
if (!(vgmeta = export_vg_to_config_tree(vg))) {
|
||||
dm_config_destroy(pvmeta);
|
||||
return_0;
|
||||
}
|
||||
|
@ -841,5 +841,25 @@ size_t export_vg_to_buffer(struct volume_group *vg, char **buf)
|
||||
return text_vg_export_raw(vg, "", buf);
|
||||
}
|
||||
|
||||
struct dm_config_tree *export_vg_to_config_tree(struct volume_group *vg)
|
||||
{
|
||||
char *buf = NULL;
|
||||
struct dm_config_tree *vg_cft;
|
||||
|
||||
if (!export_vg_to_buffer(vg, &buf)) {
|
||||
log_error("Could not format metadata for VG %s.", vg->name);
|
||||
return_NULL;
|
||||
}
|
||||
|
||||
if (!(vg_cft = dm_config_from_string(buf))) {
|
||||
log_error("Error parsing metadata for VG %s.", vg->name);
|
||||
dm_free(buf);
|
||||
return_NULL;
|
||||
}
|
||||
|
||||
dm_free(buf);
|
||||
return vg_cft;
|
||||
}
|
||||
|
||||
#undef outf
|
||||
#undef outnl
|
||||
|
@ -437,7 +437,7 @@ void lv_calculate_readahead(const struct logical_volume *lv, uint32_t *read_ahea
|
||||
* For internal metadata caching.
|
||||
*/
|
||||
size_t export_vg_to_buffer(struct volume_group *vg, char **buf);
|
||||
int export_vg_to_config_tree(struct volume_group *vg, struct dm_config_tree **cft);
|
||||
struct dm_config_tree *export_vg_to_config_tree(struct volume_group *vg);
|
||||
struct volume_group *import_vg_from_buffer(const char *buf,
|
||||
struct format_instance *fid);
|
||||
struct volume_group *import_vg_from_config_tree(const struct dm_config_tree *cft,
|
||||
|
Loading…
Reference in New Issue
Block a user