mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-30 17:18:21 +03:00
o Use new info interface to dm.
This commit is contained in:
parent
7f3859bb5c
commit
ef8a0eae5c
1
TODO
1
TODO
@ -9,7 +9,6 @@ error message review
|
||||
correct handling of *existing* snapshots
|
||||
review statics
|
||||
review consistency checks for full compatibility with LVM1
|
||||
iospace split/rename
|
||||
|
||||
before beta1
|
||||
-----------
|
||||
|
@ -33,8 +33,9 @@ static struct dm_task *_setup_task(struct logical_volume *lv, int task)
|
||||
return dmt;
|
||||
}
|
||||
|
||||
static struct dm_task *_info(struct logical_volume *lv)
|
||||
static int _info(struct logical_volume *lv, struct dm_info *info)
|
||||
{
|
||||
int r = 0;
|
||||
struct dm_task *dmt;
|
||||
|
||||
if (!(dmt = _setup_task(lv, DM_DEVICE_INFO))) {
|
||||
@ -44,54 +45,44 @@ static struct dm_task *_info(struct logical_volume *lv)
|
||||
|
||||
if (!dm_task_run(dmt)) {
|
||||
stack;
|
||||
goto bad;
|
||||
goto out;
|
||||
}
|
||||
|
||||
return dmt;
|
||||
if (!dm_task_get_info(dmt, info)) {
|
||||
stack;
|
||||
goto out;
|
||||
}
|
||||
r = 1;
|
||||
|
||||
bad:
|
||||
out:
|
||||
dm_task_destroy(dmt);
|
||||
return NULL;
|
||||
return r;
|
||||
}
|
||||
|
||||
int lv_active(struct logical_volume *lv)
|
||||
{
|
||||
int r = -1;
|
||||
struct dm_task *dmt;
|
||||
struct dm_info info;
|
||||
|
||||
if (!(dmt = _info(lv))) {
|
||||
if (!_info(lv, &info)) {
|
||||
stack;
|
||||
return r;
|
||||
}
|
||||
|
||||
if (!dm_task_exists(dmt, &r)) {
|
||||
stack;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
dm_task_destroy(dmt);
|
||||
return r;
|
||||
return info.exists;
|
||||
}
|
||||
|
||||
int lv_open_count(struct logical_volume *lv)
|
||||
{
|
||||
int r = -1;
|
||||
struct dm_task *dmt;
|
||||
struct dm_info info;
|
||||
|
||||
if (!(dmt = _info(lv))) {
|
||||
if (!_info(lv, &info)) {
|
||||
stack;
|
||||
return r;
|
||||
}
|
||||
|
||||
if (!dm_task_open_count(dmt, &r)) {
|
||||
stack;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
dm_task_destroy(dmt);
|
||||
return r;
|
||||
return info.open_count;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -89,6 +89,7 @@ static int _mk_node(struct logical_volume *lv)
|
||||
|
||||
_build_lv_path(lv_path, sizeof(lv_path), lv);
|
||||
|
||||
// FIXME: dev never get's initialised !
|
||||
if (mknod(lv_path, S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP, dev) < 0) {
|
||||
log_sys_error("mknod", lv_path);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user