MAJOR_ARG,
MINOR_ARG,
NOHEADINGS_ARG,
+ NOOPENCOUNT_ARG,
NOTABLE_ARG,
UUID_ARG,
VERBOSE_ARG,
if (_switches[READ_ONLY] && !dm_task_set_ro(dmt))
goto out;
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
if (_switches[MINOR_ARG] && !dm_task_set_minor(dmt, _values[MINOR_ARG]))
goto out;
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
if (!dm_task_set_newname(dmt, argv[argc - 1]))
goto out;
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
free(str);
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
if (event_nr && !dm_task_set_event_nr(dmt, event_nr))
goto out;
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto out;
+
r = dm_task_run(dmt);
if (r && display && _switches[VERBOSE_ARG])
if (!_set_task_device(dmt, name, 0))
goto out;
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
if (!_set_task_device(dmt, argc > 1 ? argv[1] : NULL, 1))
goto out;
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
if (!_set_task_device(dmt, name, 0))
goto out;
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
if (!_set_task_device(dmt, name, 0))
goto out;
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto out;
+
if (!dm_task_run(dmt))
goto out;
fprintf(out, "Usage:\n\n");
fprintf(out, "dmsetup [--version] [-v|--verbose [-v|--verbose ...]]\n"
- " [-r|--readonly]\n\n");
+ " [-r|--readonly] [--noopencount]\n\n");
for (i = 0; _commands[i].name; i++)
fprintf(out, "\t%s %s\n", _commands[i].name, _commands[i].help);
fprintf(out, "\n<device> may be device name or -u <uuid> or "
{"major", 1, NULL, MAJOR_ARG},
{"minor", 1, NULL, MINOR_ARG},
{"noheadings", 0, NULL, NOHEADINGS_ARG},
+ {"noopencount", 0, NULL, NOOPENCOUNT_ARG},
{"notable", 0, NULL, NOTABLE_ARG},
{"uuid", 1, NULL, UUID_ARG},
{"verbose", 1, NULL, VERBOSE_ARG},
}
if ((ind == NOHEADINGS_ARG))
_switches[NOHEADINGS_ARG]++;
+ if ((ind == NOOPENCOUNT_ARG))
+ _switches[NOOPENCOUNT_ARG]++;
if ((ind == VERSION_ARG))
_switches[VERSION_ARG]++;
}
return 1;
}
+int dm_task_no_open_count(struct dm_task *dmt)
+{
+ dmt->no_open_count = 1;
+
+ return 1;
+}
+
int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr)
{
dmt->event_nr = event_nr;
dmi->flags |= DM_STATUS_TABLE_FLAG;
dmi->flags |= DM_EXISTS_FLAG; /* FIXME */
- log_debug("dm %s %s %s %s%.0llu %s", _cmd_data_v4[dmt->type].name,
+
+ if (dmt->no_open_count)
+ dmi->flags |= DM_SKIP_BDGET_FLAG;
+
+ log_debug("dm %s %s %s %s%c %.0llu %s", _cmd_data_v4[dmt->type].name,
dmi->name, dmi->uuid, dmt->newname ? dmt->newname : "",
+ dmt->no_open_count ? 'N' : 'O',
dmt->sector, dmt->message ? dmt->message : "");
if (ioctl(_control_fd, command, dmi) < 0) {
if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) ||