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

o Use new info interface to dm.

This commit is contained in:
Joe Thornber 2001-11-19 15:38:39 +00:00
parent 7f3859bb5c
commit ef8a0eae5c
3 changed files with 17 additions and 26 deletions

1
TODO
View File

@ -9,7 +9,6 @@ error message review
correct handling of *existing* snapshots correct handling of *existing* snapshots
review statics review statics
review consistency checks for full compatibility with LVM1 review consistency checks for full compatibility with LVM1
iospace split/rename
before beta1 before beta1
----------- -----------

View File

@ -33,8 +33,9 @@ static struct dm_task *_setup_task(struct logical_volume *lv, int task)
return dmt; 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; struct dm_task *dmt;
if (!(dmt = _setup_task(lv, DM_DEVICE_INFO))) { 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)) { if (!dm_task_run(dmt)) {
stack; 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); dm_task_destroy(dmt);
return NULL; return r;
} }
int lv_active(struct logical_volume *lv) int lv_active(struct logical_volume *lv)
{ {
int r = -1; int r = -1;
struct dm_task *dmt; struct dm_info info;
if (!(dmt = _info(lv))) { if (!_info(lv, &info)) {
stack; stack;
return r; return r;
} }
if (!dm_task_exists(dmt, &r)) { return info.exists;
stack;
goto out;
}
out:
dm_task_destroy(dmt);
return r;
} }
int lv_open_count(struct logical_volume *lv) int lv_open_count(struct logical_volume *lv)
{ {
int r = -1; int r = -1;
struct dm_task *dmt; struct dm_info info;
if (!(dmt = _info(lv))) { if (!_info(lv, &info)) {
stack; stack;
return r; return r;
} }
if (!dm_task_open_count(dmt, &r)) { return info.open_count;
stack;
goto out;
}
out:
dm_task_destroy(dmt);
return r;
} }
/* /*

View File

@ -89,6 +89,7 @@ static int _mk_node(struct logical_volume *lv)
_build_lv_path(lv_path, sizeof(lv_path), 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) { if (mknod(lv_path, S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP, dev) < 0) {
log_sys_error("mknod", lv_path); log_sys_error("mknod", lv_path);
return 0; return 0;