コード例 #1
0
ファイル: mirrored.c プロジェクト: ErisBlastar/osfree
static int _mirrored_text_import(struct lv_segment *seg, const struct config_node *sn,
                        struct dm_hash_table *pv_hash)
{
        const struct config_node *cn;
        char *logname = NULL;

        if (find_config_node(sn, "extents_moved")) {
                if (get_config_uint32(sn, "extents_moved",
                                      &seg->extents_copied))
                        seg->status |= PVMOVE;
                else {
                        log_error("Couldn't read 'extents_moved' for "
                                  "segment '%s'.", sn->key);
                        return 0;
                }
        }

        if (find_config_node(sn, "region_size")) {
                if (!get_config_uint32(sn, "region_size",
                                      &seg->region_size)) {
                        log_error("Couldn't read 'region_size' for "
                                  "segment '%s'.", sn->key);
                        return 0;
                }
        }

        if ((cn = find_config_node(sn, "mirror_log"))) {
                if (!cn->v || !cn->v->v.str) {
                        log_error("Mirror log type must be a string.");
                        return 0;
                }
                logname = cn->v->v.str;
                if (!(seg->log_lv = find_lv(seg->lv->vg, logname))) {
                        log_error("Unrecognised mirror log in segment %s.",
                                  sn->key);
                        return 0;
                }
                seg->log_lv->status |= MIRROR_LOG;
        }

        if (logname && !seg->region_size) {
                log_error("Missing region size for mirror log for segment "
                          "'%s'.", sn->key);
                return 0;
        }

        if (!(cn = find_config_node(sn, "mirrors"))) {
                log_error("Couldn't find mirrors array for segment "
                          "'%s'.", sn->key);
                return 0;
        }

        return text_import_areas(seg, sn, cn, pv_hash, MIRROR_IMAGE);
}
コード例 #2
0
ファイル: striped.c プロジェクト: ystk/debian-lvm2
static int _striped_text_import(struct lv_segment *seg, const struct config_node *sn,
			struct dm_hash_table *pv_hash)
{
	struct config_node *cn;

	if ((seg->area_count != 1) &&
	    !get_config_uint32(sn, "stripe_size", &seg->stripe_size)) {
		log_error("Couldn't read stripe_size for segment %s "
			  "of logical volume %s.", config_parent_name(sn), seg->lv->name);
		return 0;
	}

	if (!(cn = find_config_node(sn, "stripes"))) {
		log_error("Couldn't find stripes array for segment %s "
			  "of logical volume %s.", config_parent_name(sn), seg->lv->name);
		return 0;
	}

	seg->area_len /= seg->area_count;

	return text_import_areas(seg, sn, cn, pv_hash, 0);
}