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; 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. * 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; const char *trailing_space;
uint64_t esize = seg->lv->vg->extent_size; uint64_t esize = seg->lv->vg->extent_size;
char devbuf[10]; char devbuf[10];
char *dlid;
for (s = start_area; s < areas; s++, *pos += tw) { for (s = start_area; s < areas; s++, *pos += tw) {
trailing_space = (areas - s - 1) ? " " : ""; 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))), (esize * seg_pe(seg, s))),
trailing_space); trailing_space);
else if (seg_type(seg, s) == AREA_LV) { else if (seg_type(seg, s) == AREA_LV) {
if (!build_dev_string(dm, seg_lv(seg, s)->lvid.s, devbuf, if (!(dlid = _build_dlid(dm->mem,
sizeof(devbuf), "LV")) { seg_lv(seg, s)->lvid.s, NULL))) {
stack;
return 0;
}
if (!build_dev_string(dm, dlid,
devbuf,sizeof(devbuf), "LV")) {
stack; stack;
return 0; 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 */ /* add the dependency on the visible origin device */
if (!str_list_add(dm->mem, &dl->pre_suspend, 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; stack;
return 0; return 0;
} }
@ -1574,7 +1586,7 @@ static int _create_rec(struct dev_manager *dm, struct dev_layer *dl)
/* Rename? */ /* Rename? */
if (dl->info.exists) { if (dl->info.exists) {
if ((suffix = rindex(dl->dlid, '-'))) if ((suffix = rindex(dl->dlid + 4, '-')))
suffix++; suffix++;
newname = build_dm_name(dm->mem, dm->vg_name, dl->lv->name, newname = build_dm_name(dm->mem, dm->vg_name, dl->lv->name,
suffix); 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, int build_dev_string(struct dev_manager *dm, char *dlid, char *devbuf,
size_t bufsize, const char *desc); size_t bufsize, const char *desc);
char *build_dlid(struct dev_manager *dm, const char *lvid, const char *layer);
#endif #endif

View File

@ -170,6 +170,7 @@ static int _compose_log_line(struct dev_manager *dm, struct lv_segment *seg,
int tw; int tw;
char devbuf[10]; char devbuf[10];
const char *clustered = ""; const char *clustered = "";
char *dlid;
/* /*
* Use clustered mirror log for non-exclusive activation * 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 ", tw = lvm_snprintf(params, paramsize, "%score 1 %u %u ",
clustered, region_size, areas); clustered, region_size, areas);
else { 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")) { sizeof(devbuf), "log")) {
stack; stack;
return 0; return 0;