*/
static struct dm_task *_setup_task(const char *name, const char *uuid,
uint32_t *event_nr, int task,
- uint32_t major, uint32_t minor)
+ uint32_t major, uint32_t minor,
+ int with_open_count)
{
struct dm_task *dmt;
if (activation_checks() && !dm_task_enable_checks(dmt))
goto_out;
-
+
+ if (!with_open_count && !dm_task_no_open_count(dmt))
+ log_warn("WARNING: Failed to disable open_count.");
+
return dmt;
out:
dm_task_destroy(dmt);
dmtask = mknodes ? DM_DEVICE_MKNODES : DM_DEVICE_INFO;
- if (!(dmt = _setup_task(mknodes ? name : NULL, dlid, 0, dmtask, major, minor)))
+ if (!(dmt = _setup_task(mknodes ? name : NULL, dlid, 0, dmtask, major, minor,
+ with_open_count)))
return_0;
- if (!with_open_count &&
- !dm_task_no_open_count(dmt))
- log_warn("WARNING: Failed to disable open_count.");
-
if (!dm_task_run(dmt))
goto_out;
char *type = NULL;
char *params = NULL;
- if (!(dmt = _setup_task(name, uuid, 0, DM_DEVICE_STATUS, 0, 0)))
+ if (!(dmt = _setup_task(name, uuid, 0, DM_DEVICE_STATUS, 0, 0, 0)))
return_0;
- if (!dm_task_no_open_count(dmt))
- log_error("Failed to disable open_count");
-
if (!dm_task_run(dmt))
goto_out;
if (!(dlid = build_dm_uuid(mem, lv, layer)))
return_0;
- if (!(dmt = _setup_task(NULL, dlid, 0,
- DM_DEVICE_STATUS, 0, 0)))
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0, 0)))
goto_bad;
- if (!dm_task_no_open_count(dmt))
- log_error("Failed to disable open_count");
-
if (!dm_task_run(dmt))
goto_out;
*overall_percent = percent;
if (!(dmt = _setup_task(name, dlid, event_nr,
- wait ? DM_DEVICE_WAITEVENT : DM_DEVICE_STATUS, 0, 0)))
+ wait ? DM_DEVICE_WAITEVENT : DM_DEVICE_STATUS, 0, 0, 0)))
return_0;
- if (!dm_task_no_open_count(dmt))
- log_error("Failed to disable open_count");
-
if (!dm_task_run(dmt))
goto_out;
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
return_0;
- if (!(dmt = _setup_task(0, dlid, NULL, DM_DEVICE_STATUS, 0, 0)))
+ if (!(dmt = _setup_task(0, dlid, NULL, DM_DEVICE_STATUS, 0, 0, 0)))
return_0;
- if (!dm_task_no_open_count(dmt))
- log_error("Failed to disable open_count");
-
if (!dm_task_run(dmt))
goto_out;
/*
* Try and get some info on this device.
*/
- log_debug_activation("Getting device status percentage for %s", name);
if (!_percent(dm, name, dlid, "snapshot", 0, NULL, percent,
NULL, fail_if_percent_unsupported))
return_0;
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
return_0;
- log_debug_activation("Getting raid device status for %s.", lv->name);
-
- if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0)))
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0, 0)))
return_0;
- if (!dm_task_no_open_count(dmt))
- log_error("Failed to disable open_count.");
-
if (!dm_task_run(dmt))
goto_out;
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
return_0;
- if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_TARGET_MSG, 0, 0)))
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_TARGET_MSG, 0, 0, 0)))
return_0;
- if (!dm_task_no_open_count(dmt))
- log_error("Failed to disable open_count.");
-
if (!dm_task_set_message(dmt, msg))
goto_out;
if (!(dlid = build_dm_uuid(dm->mem, lv, layer)))
return_0;
- log_debug_activation("Getting cache device status for %s.", lv->name);
-
- if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0)))
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0, 0)))
return_0;
- if (!dm_task_no_open_count(dmt))
- log_error("Failed to disable open_count.");
-
if (!dm_task_run(dmt))
goto_out;
if (!(dlid = build_dm_uuid(dm->mem, lv, lv_layer(lv))))
return_0;
- log_debug_activation("Getting thin pool device status for %s.", lv->name);
-
- if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0)))
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0, 0)))
return_0;
- if (!dm_task_no_open_count(dmt))
- log_error("Failed to disable open_count.");
-
if (noflush && !dm_task_no_flush(dmt))
log_warn("Can't set no_flush.");
if (!(dlid = build_dm_uuid(dm->mem, lv, lv_layer(lv))))
return_0;
- log_debug_activation("Getting device id for %s.", dlid);
-
- if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_TABLE, 0, 0)))
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_TABLE, 0, 0, 0)))
return_0;
if (!dm_task_run(dmt))