1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Link in the activation library.

This commit is contained in:
Alasdair Kergon 2001-11-02 16:28:04 +00:00
parent ae2bb66535
commit f047219b23
4 changed files with 23 additions and 20 deletions

View File

@ -6,12 +6,15 @@
#include "metadata.h"
#include "activate.h"
#include "log.h"
#include <device-mapper/libdm.h>
#include <devmapper/libdevmapper.h>
int lv_activate(struct logical_volume *lv)
{
int r = 0;
int i;
uint64_t esize = lv->vg->extent_size;
uint64_t start = 0ull;
char params[1024];
@ -23,15 +26,15 @@ int lv_activate(struct logical_volume *lv)
return 0;
}
dm_command_set_name(c, lv->uuid);
dm_task_set_name(dmt, lv->id.uuid);
for (i = 0; i < lv->le_count; i++) {
pes = lv->map + i;
snprintf(params, sizeof(params), "%s %ull",
dev_name(pes->pv.dev),
snprintf(params, sizeof(params), "%s %llu",
dev_name(pes->pv->dev),
pes->pv->pe_start + (esize * pes->pe));
if (!dm_task_add_target(dmt, start, size, "linear", params)) {
if (!dm_task_add_target(dmt, start, esize, "linear", params)) {
stack;
goto out;
}
@ -39,11 +42,11 @@ int lv_activate(struct logical_volume *lv)
start += esize;
}
if (!(r = dm_task_run(c)))
if (!(r = dm_task_run(dmt)))
stack;
out:
dm_command_destroy(c);
dm_task_destroy(dmt);
return r;
}
@ -61,26 +64,21 @@ int activate_lvs_in_vg(struct volume_group *vg)
int lv_deactivate(struct logical_volume *lv)
{
struct dm_task *dmt = dm_command_create(DM_DEVICE_REMOVE);
if (!c) {
int r;
struct dm_task *dmt = dm_task_create(DM_DEVICE_REMOVE);
if (!dmt) {
stack;
return 0;
}
dm_command_set_name(c, lv->uuid);
if (!(r = dm_command_run()))
dm_task_set_name(dmt, lv->id.uuid);
if (!(r = dm_task_run(dmt)))
stack;
out:
dm_task_destroy(dmt);
return r;
}
int lv_deactivate(struct volume_group *vg, struct logical_volume *lv)
{
return 0;
}
int lv_update_write_access(struct logical_volume *lv)
{
return 0;
@ -97,3 +95,8 @@ int deactivate_lvs_in_vg(struct volume_group *vg)
return done;
}
int lvs_in_vg_activated(struct volume_group *vg)
{
return 0;
}

View File

@ -318,7 +318,7 @@ int read_pvs_in_vg(const char *vg_name, struct dev_filter *filter,
struct disk_list *data = NULL;
for (dev = dev_iter_get(iter); dev; dev = dev_iter_get(iter)) {
if ((data = read_pvd(dev, mem, vg_name)))
if ((data = read_disk(dev, mem, vg_name)))
list_add(head, &data->list);
}
dev_iter_destroy(iter);

View File

@ -213,7 +213,7 @@ static struct physical_volume *_pv_read(struct io_space *is,
goto bad;
}
if (!(dl = read_pvd(dev, mem, NULL))) {
if (!(dl = read_disk(dev, mem, NULL))) {
stack;
goto bad;
}

View File

@ -47,7 +47,7 @@ include ../make.tmpl
lvm: $(OBJECTS) $(top_srcdir)/lib/liblvm.a
$(CC) -o lvm $(OBJECTS) $(LD_FLAGS) -L$(top_srcdir)/lib -llvm \
$(EXTRA_LIBS)
-ldevmapper $(EXTRA_LIBS)
install:
$(INSTALL) -c -d $(sbindir);