struct lvmcache_vginfo *vginfo;
struct volume_group *vg;
struct format_instance *fid;
+ struct format_instance_ctx fic;
if (!vgid || !(vginfo = vginfo_from_vgid(vgid)) || !vginfo->vgmetadata)
return NULL;
(!precommitted && vginfo->precommitted && !critical_section()))
return NULL;
- if (!(fid = vginfo->fmt->ops->create_instance(vginfo->fmt,
- vginfo->vgname,
- vgid, NULL)))
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS;
+ fic.context.vg_ref.vg_name = vginfo->vgname;
+ fic.context.vg_ref.vg_id = vgid;
+ if (!(fid = vginfo->fmt->ops->create_instance(vginfo->fmt, &fic)))
return_NULL;
/* Build config tree from vgmetadata, if not yet cached */
{
struct volume_group *vg = NULL;
struct format_instance *tf;
+ struct format_instance_ctx fic;
time_t when;
char *desc;
- void *context;
log_print(" ");
log_print("File:\t\t%s", af->path);
- if (!(context = create_text_context(cmd, af->path, NULL)) ||
- !(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, NULL,
- NULL, context))) {
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_PRIVATE_MDAS;
+ if (!(fic.context.private = create_text_context(cmd, af->path, NULL)) ||
+ !(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, &fic))) {
log_error("Couldn't create text instance object.");
return;
}
{
struct volume_group *vg = NULL;
struct format_instance *tf;
+ struct format_instance_ctx fic;
struct metadata_area *mda;
- void *context;
- if (!(context = create_text_context(cmd, file,
- cmd->cmd_line)) ||
- !(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, NULL,
- NULL, context))) {
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_PRIVATE_MDAS;
+ if (!(fic.context.private = create_text_context(cmd, file, cmd->cmd_line)) ||
+ !(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, &fic))) {
log_error("Couldn't create text format object.");
return NULL;
}
struct pv_list *pvl;
struct physical_volume *pv;
struct lvmcache_info *info;
+ struct format_instance *fid;
+ struct format_instance_ctx fic;
/*
* FIXME: Check that the PVs referenced in the backup are
*/
/* Attempt to write out using currently active format */
- if (!(vg->fid = cmd->fmt->ops->create_instance(cmd->fmt, vg->name,
- NULL, NULL))) {
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS;
+ fic.context.vg_ref.vg_name = vg->name;
+ fic.context.vg_ref.vg_id = NULL;
+ if (!(vg->fid = cmd->fmt->ops->create_instance(cmd->fmt, &fic))) {
log_error("Failed to allocate format instance");
return 0;
}
{
int r = 0;
struct format_instance *tf;
+ struct format_instance_ctx fic;
struct metadata_area *mda;
- void *context;
struct cmd_context *cmd;
cmd = vg->cmd;
log_verbose("Creating volume group backup \"%s\" (seqno %u).", file, vg->seqno);
- if (!(context = create_text_context(cmd, file, desc)) ||
- !(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, NULL,
- NULL, context))) {
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_PRIVATE_MDAS;
+ if (!(fic.context.private = create_text_context(cmd, file, desc)) ||
+ !(tf = cmd->fmt_backup->ops->create_instance(cmd->fmt_backup, &fic))) {
log_error("Couldn't create backup object.");
return 0;
}
DIR *d;
struct volume_group *vg;
struct format_instance *fid;
+ struct format_instance_ctx fic;
char path[PATH_MAX];
char *scanned_vgname;
}
/* FIXME stat file to see if it's changed */
- fid = _text_create_text_instance(fmt, NULL, NULL,
- NULL);
+ /* FIXME: Check this fid is OK! */
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_PRIVATE_MDAS;
+ fic.context.private = NULL;
+ fid = _text_create_text_instance(fmt, &fic);
if ((vg = _vg_read_file_name(fid, scanned_vgname,
path))) {
/* FIXME Store creation host in vg */
struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name)
{
struct volume_group *vg;
+ struct format_instance_ctx fic;
int consistent = 0;
struct dm_pool *mem;
uint32_t rc;
/* initialize removed_pvs list */
dm_list_init(&vg->removed_pvs);
- if (!(vg->fid = cmd->fmt->ops->create_instance(cmd->fmt, vg_name,
- NULL, NULL))) {
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS;
+ fic.context.vg_ref.vg_name = vg_name;
+ fic.context.vg_ref.vg_id = NULL;
+ if (!(vg->fid = cmd->fmt->ops->create_instance(cmd->fmt, &fic))) {
log_error("Failed to create format instance");
goto bad;
}
int warnings,
const char *orphan_vgname)
{
+ struct format_instance_ctx fic;
struct lvmcache_vginfo *vginfo;
struct lvmcache_info *info;
struct pv_list *pvl;
}
/* create format instance with appropriate metadata area */
- if (!(vg->fid = vginfo->fmt->ops->create_instance(vginfo->fmt,
- orphan_vgname, NULL,
- NULL))) {
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_AUX_MDAS;
+ fic.context.vg_ref.vg_name = orphan_vgname;
+ fic.context.vg_ref.vg_id = NULL;
+ if (!(vg->fid = vginfo->fmt->ops->create_instance(vginfo->fmt, &fic))) {
log_error("Failed to create format instance");
goto bad;
}
int *consistent, unsigned precommitted)
{
struct format_instance *fid;
+ struct format_instance_ctx fic;
const struct format_type *fmt;
struct volume_group *vg, *correct_vg = NULL;
struct metadata_area *mda;
use_precommitted = 0;
/* create format instance with appropriate metadata area */
- if (!(fid = fmt->ops->create_instance(fmt, vgname, vgid, NULL))) {
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS;
+ fic.context.vg_ref.vg_name = vgname;
+ fic.context.vg_ref.vg_id = vgid;
+ if (!(fid = fmt->ops->create_instance(fmt, &fic))) {
log_error("Failed to create format instance");
return NULL;
}
use_precommitted = 0;
/* create format instance with appropriate metadata area */
- if (!(fid = fmt->ops->create_instance(fmt, vgname, vgid, NULL))) {
+ fic.type = FMT_INSTANCE_VG | FMT_INSTANCE_MDAS | FMT_INSTANCE_AUX_MDAS;
+ fic.context.vg_ref.vg_name = vgname;
+ fic.context.vg_ref.vg_id = vgid;
+ if (!(fid = fmt->ops->create_instance(fmt, &fic))) {
log_error("Failed to create format instance");
return NULL;
}