1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Fix LVM2- prefix changes; export build_dlid.

This commit is contained in:
Alasdair Kergon 2005-10-20 21:07:57 +00:00
parent bc70fb17c0
commit 9011aed958
3 changed files with 24 additions and 5 deletions

View File

@ -182,6 +182,11 @@ static char *_build_dlid(struct dm_pool *mem, const char *lvid, const char *laye
return dlid;
}
char *build_dlid(struct dev_manager *dm, const char *lvid, const char *layer)
{
return _build_dlid(dm->mem, lvid, layer);
}
/*
* Low level device-layer operations.
*/
@ -770,6 +775,7 @@ int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg,
const char *trailing_space;
uint64_t esize = seg->lv->vg->extent_size;
char devbuf[10];
char *dlid;
for (s = start_area; s < areas; s++, *pos += tw) {
trailing_space = (areas - s - 1) ? " " : "";
@ -789,8 +795,13 @@ int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg,
(esize * seg_pe(seg, s))),
trailing_space);
else if (seg_type(seg, s) == AREA_LV) {
if (!build_dev_string(dm, seg_lv(seg, s)->lvid.s, devbuf,
sizeof(devbuf), "LV")) {
if (!(dlid = _build_dlid(dm->mem,
seg_lv(seg, s)->lvid.s, NULL))) {
stack;
return 0;
}
if (!build_dev_string(dm, dlid,
devbuf,sizeof(devbuf), "LV")) {
stack;
return 0;
}
@ -1315,7 +1326,8 @@ static int _expand_snapshot(struct dev_manager *dm, struct logical_volume *lv,
/* add the dependency on the visible origin device */
if (!str_list_add(dm->mem, &dl->pre_suspend,
snap_seg->origin->lvid.s)) {
_build_dlid(dm->mem, snap_seg->origin->lvid.s,
NULL))) {
stack;
return 0;
}
@ -1574,7 +1586,7 @@ static int _create_rec(struct dev_manager *dm, struct dev_layer *dl)
/* Rename? */
if (dl->info.exists) {
if ((suffix = rindex(dl->dlid, '-')))
if ((suffix = rindex(dl->dlid + 4, '-')))
suffix++;
newname = build_dm_name(dm->mem, dm->vg_name, dl->lv->name,
suffix);

View File

@ -26,4 +26,6 @@ int compose_areas_line(struct dev_manager *dm, struct lv_segment *seg,
int build_dev_string(struct dev_manager *dm, char *dlid, char *devbuf,
size_t bufsize, const char *desc);
char *build_dlid(struct dev_manager *dm, const char *lvid, const char *layer);
#endif

View File

@ -170,6 +170,7 @@ static int _compose_log_line(struct dev_manager *dm, struct lv_segment *seg,
int tw;
char devbuf[10];
const char *clustered = "";
char *dlid;
/*
* Use clustered mirror log for non-exclusive activation
@ -183,7 +184,11 @@ static int _compose_log_line(struct dev_manager *dm, struct lv_segment *seg,
tw = lvm_snprintf(params, paramsize, "%score 1 %u %u ",
clustered, region_size, areas);
else {
if (!build_dev_string(dm, seg->log_lv->lvid.s, devbuf,
if (!(dlid = build_dlid(dm, seg->log_lv->lvid.s, NULL))) {
stack;
return 0;
}
if (!build_dev_string(dm, dlid, devbuf,
sizeof(devbuf), "log")) {
stack;
return 0;