mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dev_manager: reuse _setup_task_run
This commit is contained in:
parent
b058498404
commit
73967233e4
@ -4103,7 +4103,7 @@ out:
|
|||||||
*/
|
*/
|
||||||
int get_crypt_table_offset(dev_t crypt_devt, uint32_t *offset_bytes)
|
int get_crypt_table_offset(dev_t crypt_devt, uint32_t *offset_bytes)
|
||||||
{
|
{
|
||||||
struct dm_task *dmt = dm_task_create(DM_DEVICE_TABLE);
|
struct dm_task *dmt;
|
||||||
uint64_t start, length;
|
uint64_t start, length;
|
||||||
char *target_type = NULL;
|
char *target_type = NULL;
|
||||||
void *next = NULL;
|
void *next = NULL;
|
||||||
@ -4113,23 +4113,10 @@ int get_crypt_table_offset(dev_t crypt_devt, uint32_t *offset_bytes)
|
|||||||
int spaces = 0;
|
int spaces = 0;
|
||||||
unsigned i, i_off = 0;
|
unsigned i, i_off = 0;
|
||||||
|
|
||||||
if (!dmt)
|
if (!(dmt = _setup_task_run(DM_DEVICE_TABLE, NULL, NULL, NULL, NULL,
|
||||||
|
MAJOR(crypt_devt), MINOR(crypt_devt), 0, 0, 0)))
|
||||||
return_0;
|
return_0;
|
||||||
|
|
||||||
if (!dm_task_set_major_minor(dmt, (int)MAJOR(crypt_devt), (int)MINOR(crypt_devt), 0)) {
|
|
||||||
dm_task_destroy(dmt);
|
|
||||||
return_0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Non-blocking status read */
|
|
||||||
if (!dm_task_no_flush(dmt))
|
|
||||||
log_warn("WARNING: Can't set no_flush for dm status.");
|
|
||||||
|
|
||||||
if (!dm_task_run(dmt)) {
|
|
||||||
dm_task_destroy(dmt);
|
|
||||||
return_0;
|
|
||||||
}
|
|
||||||
|
|
||||||
next = dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms);
|
next = dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms);
|
||||||
|
|
||||||
if (!target_type || !params || strcmp(target_type, "crypt")) {
|
if (!target_type || !params || strcmp(target_type, "crypt")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user