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

o build lv name from <vg>_<lv>

This commit is contained in:
Joe Thornber 2001-11-02 16:45:44 +00:00
parent f047219b23
commit ab269099a7

View File

@ -10,6 +10,11 @@
#include <devmapper/libdevmapper.h> #include <devmapper/libdevmapper.h>
static void _build_lv_name(char *buffer, size_t s, struct logical_volume *lv)
{
snprintf(buffer, s, "%s_%s", lv->vg->name, lv->name);
}
int lv_activate(struct logical_volume *lv) int lv_activate(struct logical_volume *lv)
{ {
int r = 0; int r = 0;
@ -18,6 +23,7 @@ int lv_activate(struct logical_volume *lv)
uint64_t esize = lv->vg->extent_size; uint64_t esize = lv->vg->extent_size;
uint64_t start = 0ull; uint64_t start = 0ull;
char params[1024]; char params[1024];
char name[128];
struct pe_specifier *pes; struct pe_specifier *pes;
struct dm_task *dmt; struct dm_task *dmt;
@ -26,7 +32,8 @@ int lv_activate(struct logical_volume *lv)
return 0; return 0;
} }
dm_task_set_name(dmt, lv->id.uuid); _build_lv_name(name, sizeof(name), lv);
dm_task_set_name(dmt, name);
for (i = 0; i < lv->le_count; i++) { for (i = 0; i < lv->le_count; i++) {
pes = lv->map + i; pes = lv->map + i;
@ -65,13 +72,17 @@ int activate_lvs_in_vg(struct volume_group *vg)
int lv_deactivate(struct logical_volume *lv) int lv_deactivate(struct logical_volume *lv)
{ {
int r; int r;
struct dm_task *dmt = dm_task_create(DM_DEVICE_REMOVE); char name[128];
if (!dmt) { struct dm_task *dmt;
if (!(dmt = dm_task_create(DM_DEVICE_REMOVE))) {
stack; stack;
return 0; return 0;
} }
dm_task_set_name(dmt, lv->id.uuid); _build_lv_name(name, sizeof(name), lv);
dm_task_set_name(dmt, name);
if (!(r = dm_task_run(dmt))) if (!(r = dm_task_run(dmt)))
stack; stack;