r367 - in devmapper/trunk: . dmsetup kernel/ioctl lib lib/ioctl
Bastian Blank
waldi at costa.debian.org
Sun Aug 6 21:21:35 UTC 2006
Author: waldi
Date: Sun Aug 6 21:21:34 2006
New Revision: 367
Modified:
devmapper/trunk/ (props changed)
devmapper/trunk/Makefile.in
devmapper/trunk/VERSION
devmapper/trunk/WHATS_NEW
devmapper/trunk/dmsetup/dmsetup.c
devmapper/trunk/kernel/ioctl/dm-ioctl.h
devmapper/trunk/lib/ioctl/libdm-iface.c
devmapper/trunk/lib/libdm-deptree.c
devmapper/trunk/man/dmsetup.8
Log:
Merge /devmapper/upstream/current (1.02.08).
Modified: devmapper/trunk/Makefile.in
==============================================================================
--- devmapper/trunk/Makefile.in (original)
+++ devmapper/trunk/Makefile.in Sun Aug 6 21:21:34 2006
@@ -26,6 +26,10 @@
ifeq ("@DMEVENTD@", "yes")
SUBDIRS += dmeventd
+else
+ ifeq ($(MAKECMDGOALS),distclean)
+ SUBDIRS += dmeventd
+ endif
endif
SUBDIRS += lib dmsetup
@@ -34,10 +38,6 @@
SUBDIRS += kernel po
endif
-ifeq ($(MAKECMDGOALS),distclean)
- SUBDIRS += dmeventd
-endif
-
include make.tmpl
lib: include
Modified: devmapper/trunk/VERSION
==============================================================================
--- devmapper/trunk/VERSION (original)
+++ devmapper/trunk/VERSION Sun Aug 6 21:21:34 2006
@@ -1 +1 @@
-1.02.07 (2006-05-11)
+1.02.08 (2006-07-17)
Modified: devmapper/trunk/WHATS_NEW
==============================================================================
--- devmapper/trunk/WHATS_NEW (original)
+++ devmapper/trunk/WHATS_NEW Sun Aug 6 21:21:34 2006
@@ -1,3 +1,14 @@
+Version 1.02.08 - 17 July 2006
+==============================
+ Append full patch to check in emails.
+ Avoid duplicate dmeventd subdir with 'make distclean'.
+ Update dmsetup man page.
+ Add --force to dmsetup remove* to load error target.
+ dmsetup remove_all also performs mknodes.
+ Don't suppress identical table reloads if permission changes.
+ Fix corelog segment line.
+ Suppress some compiler warnings.
+
Version 1.02.07 - 11 May 2006
=============================
Add DM_CORELOG flag to dm_tree_node_add_mirror_target().
Modified: devmapper/trunk/dmsetup/dmsetup.c
==============================================================================
--- devmapper/trunk/dmsetup/dmsetup.c (original)
+++ devmapper/trunk/dmsetup/dmsetup.c Sun Aug 6 21:21:34 2006
@@ -88,6 +88,7 @@
READ_ONLY = 0,
COLS_ARG,
EXEC_ARG,
+ FORCE_ARG,
GID_ARG,
MAJOR_ARG,
MINOR_ARG,
@@ -108,6 +109,7 @@
static int _switches[NUM_SWITCHES];
static int _values[NUM_SWITCHES];
+static int _num_devices;
static char *_uuid;
static char *_fields;
static char *_target;
@@ -143,7 +145,7 @@
return 0;
}
- while (fgets(buffer, buffer_size, fp)) {
+ while (fgets(buffer, (int) buffer_size, fp)) {
#else
while (getline(&buffer, &buffer_size, fp) > 0) {
#endif
@@ -321,7 +323,7 @@
return 1;
}
-static int _load(int argc, char **argv, void *data)
+static int _load(int argc, char **argv, void *data __attribute((unused)))
{
int r = 0;
struct dm_task *dmt;
@@ -378,7 +380,7 @@
return r;
}
-static int _create(int argc, char **argv, void *data)
+static int _create(int argc, char **argv, void *data __attribute((unused)))
{
int r = 0;
struct dm_task *dmt;
@@ -386,7 +388,7 @@
if (argc == 3)
file = argv[2];
-
+
if (!(dmt = dm_task_create(DM_DEVICE_CREATE)))
return 0;
@@ -434,7 +436,7 @@
return r;
}
-static int _rename(int argc, char **argv, void *data)
+static int _rename(int argc, char **argv, void *data __attribute((unused)))
{
int r = 0;
struct dm_task *dmt;
@@ -463,7 +465,7 @@
return r;
}
-static int _message(int argc, char **argv, void *data)
+static int _message(int argc, char **argv, void *data __attribute((unused)))
{
int r = 0, i;
size_t sz = 1;
@@ -523,7 +525,7 @@
return r;
}
-static int _setgeometry(int argc, char **argv, void *data)
+static int _setgeometry(int argc, char **argv, void *data __attribute((unused)))
{
int r = 0;
struct dm_task *dmt;
@@ -556,7 +558,7 @@
return r;
}
-static int _version(int argc, char **argv, void *data)
+static int _version(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused)))
{
char version[80];
@@ -602,32 +604,22 @@
return r;
}
-static int _remove_all(int argc, char **argv, void *data)
-{
- return _simple(DM_DEVICE_REMOVE_ALL, "", 0, 0);
-}
-
-static int _remove(int argc, char **argv, void *data)
-{
- return _simple(DM_DEVICE_REMOVE, argc > 1 ? argv[1] : NULL, 0, 0);
-}
-
-static int _suspend(int argc, char **argv, void *data)
+static int _suspend(int argc, char **argv, void *data __attribute((unused)))
{
return _simple(DM_DEVICE_SUSPEND, argc > 1 ? argv[1] : NULL, 0, 1);
}
-static int _resume(int argc, char **argv, void *data)
+static int _resume(int argc, char **argv, void *data __attribute((unused)))
{
return _simple(DM_DEVICE_RESUME, argc > 1 ? argv[1] : NULL, 0, 1);
}
-static int _clear(int argc, char **argv, void *data)
+static int _clear(int argc, char **argv, void *data __attribute((unused)))
{
return _simple(DM_DEVICE_CLEAR, argc > 1 ? argv[1] : NULL, 0, 1);
}
-static int _wait(int argc, char **argv, void *data)
+static int _wait(int argc, char **argv, void *data __attribute((unused)))
{
const char *name = NULL;
@@ -644,7 +636,7 @@
(argc > 1) ? (uint32_t) atoi(argv[argc - 1]) : 0, 1);
}
-static int _process_all(int argc, char **argv,
+static int _process_all(int argc, char **argv, int silent,
int (*fn) (int argc, char **argv, void *data))
{
int r = 1;
@@ -667,7 +659,8 @@
}
if (!names->dev) {
- printf("No devices found\n");
+ if (!silent)
+ printf("No devices found\n");
goto out;
}
@@ -683,6 +676,132 @@
return r;
}
+static uint64_t _get_device_size(const char *name)
+{
+ uint64_t start, length, size = UINT64_C(0);
+ struct dm_info info;
+ char *target_type, *params;
+ struct dm_task *dmt;
+ void *next = NULL;
+
+ if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
+ return 0;
+
+ 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 (!dm_task_get_info(dmt, &info) || !info.exists)
+ goto out;
+
+ do {
+ next = dm_get_next_target(dmt, next, &start, &length,
+ &target_type, ¶ms);
+ size += length;
+ } while (next);
+
+ out:
+ dm_task_destroy(dmt);
+ return size;
+}
+
+static int _error_device(int argc __attribute((unused)), char **argv __attribute((unused)), void *data)
+{
+ struct dm_names *names = (struct dm_names *) data;
+ struct dm_task *dmt;
+ const char *name;
+ uint64_t size;
+ int r = 0;
+
+ if (data)
+ name = names->name;
+ else
+ name = argv[1];
+
+ size = _get_device_size(name);
+
+ if (!(dmt = dm_task_create(DM_DEVICE_RELOAD)))
+ return 0;
+
+ if (!_set_task_device(dmt, name, 0))
+ goto err;
+
+ if (!dm_task_add_target(dmt, 0, size, "error", ""))
+ goto err;
+
+ if (_switches[READ_ONLY] && !dm_task_set_ro(dmt))
+ goto err;
+
+ if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+ goto err;
+
+ if (!dm_task_run(dmt))
+ goto err;
+
+ if (!_simple(DM_DEVICE_RESUME, name, 0, 0)) {
+ _simple(DM_DEVICE_CLEAR, name, 0, 0);
+ goto err;
+ }
+
+ r = 1;
+
+err:
+ dm_task_destroy(dmt);
+ return r;
+}
+
+static int _remove(int argc, char **argv, void *data __attribute((unused)))
+{
+ int r;
+
+ if (_switches[FORCE_ARG] && argc > 1)
+ r = _error_device(argc, argv, NULL);
+
+ return _simple(DM_DEVICE_REMOVE, argc > 1 ? argv[1] : NULL, 0, 0);
+}
+
+static int _count_devices(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused)))
+{
+ _num_devices++;
+
+ return 1;
+}
+
+static int _remove_all(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused)))
+{
+ int r;
+
+ /* Remove all closed devices */
+ r = _simple(DM_DEVICE_REMOVE_ALL, "", 0, 0) | dm_mknodes(NULL);
+
+ if (!_switches[FORCE_ARG])
+ return r;
+
+ _num_devices = 0;
+ r |= _process_all(argc, argv, 1, _count_devices);
+
+ /* No devices left? */
+ if (!_num_devices)
+ return r;
+
+ r |= _process_all(argc, argv, 1, _error_device);
+ r |= _simple(DM_DEVICE_REMOVE_ALL, "", 0, 0) | dm_mknodes(NULL);
+
+ _num_devices = 0;
+ r |= _process_all(argc, argv, 1, _count_devices);
+ if (!_num_devices)
+ return r;
+
+ fprintf(stderr, "Unable to remove %d device(s).\n", _num_devices);
+
+ return r;
+}
+
static void _display_dev(struct dm_task *dmt, const char *name)
{
struct dm_info info;
@@ -691,7 +810,7 @@
printf("%s\t(%u, %u)\n", name, info.major, info.minor);
}
-static int _mknodes(int argc, char **argv, void *data)
+static int _mknodes(int argc, char **argv, void *data __attribute((unused)))
{
return dm_mknodes(argc > 1 ? argv[1] : NULL);
}
@@ -774,7 +893,7 @@
name = names->name;
else {
if (argc == 1 && !_switches[UUID_ARG] && !_switches[MAJOR_ARG])
- return _process_all(argc, argv, _status);
+ return _process_all(argc, argv, 0, _status);
if (argc == 2)
name = argv[1];
}
@@ -847,7 +966,7 @@
}
/* Show target names and their version numbers */
-static int _targets(int argc, char **argv, void *data)
+static int _targets(int argc __attribute((unused)), char **argv __attribute((unused)), void *data __attribute((unused)))
{
int r = 0;
struct dm_task *dmt;
@@ -877,7 +996,6 @@
out:
dm_task_destroy(dmt);
return r;
-
}
static int _info(int argc, char **argv, void *data)
@@ -892,7 +1010,7 @@
name = names->name;
else {
if (argc == 1 && !_switches[UUID_ARG] && !_switches[MAJOR_ARG])
- return _process_all(argc, argv, _info);
+ return _process_all(argc, argv, 0, _info);
if (argc == 2)
name = argv[1];
}
@@ -930,7 +1048,7 @@
name = names->name;
else {
if (argc == 1 && !_switches[UUID_ARG] && !_switches[MAJOR_ARG])
- return _process_all(argc, argv, _deps);
+ return _process_all(argc, argv, 0, _deps);
if (argc == 2)
name = argv[1];
}
@@ -982,7 +1100,7 @@
return r;
}
-static int _display_name(int argc, char **argv, void *data)
+static int _display_name(int argc __attribute((unused)), char **argv __attribute((unused)), void *data)
{
struct dm_names *names = (struct dm_names *) data;
@@ -1088,19 +1206,19 @@
static int _cur_x = 1; /* Current horizontal output position */
static char _last_char = 0;
-static void _out_char(char c)
+static void _out_char(const unsigned c)
{
/* Only first UTF-8 char counts */
_cur_x += ((c & 0xc0) != 0x80);
if (!_tree_switches[TR_TRUNCATE]) {
- putchar(c);
+ putchar((int) c);
return;
}
/* Truncation? */
if (_cur_x <= _termwidth)
- putchar(c);
+ putchar((int) c);
if (_cur_x == _termwidth + 1 && ((c & 0xc0) != 0x80)) {
if (_last_char || (c & 0x80)) {
@@ -1114,7 +1232,7 @@
}
}
-static void _out_string(const char *str)
+static void _out_string(const unsigned char *str)
{
while (*str)
_out_char(*str++);
@@ -1150,9 +1268,9 @@
_cur_x = 1;
}
-static void _out_prefix(int depth)
+static void _out_prefix(unsigned depth)
{
- int x, d;
+ unsigned x, d;
for (d = 0; d < depth; d++) {
for (x = _tree_width[d] + 1; x > 0; x--)
@@ -1192,7 +1310,7 @@
if (_tree_switches[TR_OPENCOUNT]) {
_out_string(attr++ ? ", " : " [");
- (void) _out_int(info->open_count);
+ (void) _out_int((unsigned) info->open_count);
}
if (_tree_switches[TR_UUID]) {
@@ -1205,8 +1323,8 @@
}
static void _display_tree_node(struct dm_tree_node *node, unsigned depth,
- unsigned first_child, unsigned last_child,
- unsigned has_children)
+ unsigned first_child __attribute((unused)),
+ unsigned last_child, unsigned has_children)
{
int offset;
const char *name;
@@ -1287,7 +1405,7 @@
dm_tree_node_num_children(child, inverted) ? 1 : 0;
_display_tree_node(child, depth, first_child,
- next_child ? 0 : 1, has_children);
+ next_child ? 0U : 1U, has_children);
if (has_children)
_tree_walk_children(child, depth + 1);
@@ -1296,11 +1414,11 @@
}
}
-static int _add_dep(int argc, char **argv, void *data)
+static int _add_dep(int argc __attribute((unused)), char **argv __attribute((unused)), void *data)
{
struct dm_names *names = (struct dm_names *) data;
- if (!dm_tree_add_dev(_dtree, MAJOR(names->dev), MINOR(names->dev)))
+ if (!dm_tree_add_dev(_dtree, (unsigned) MAJOR(names->dev), (unsigned) MINOR(names->dev)))
return 0;
return 1;
@@ -1309,12 +1427,12 @@
/*
* Create and walk dependency tree
*/
-static int _tree(int argc, char **argv, void *data)
+static int _tree(int argc, char **argv, void *data __attribute((unused)))
{
if (!(_dtree = dm_tree_create()))
return 0;
- if (!_process_all(argc, argv, _add_dep))
+ if (!_process_all(argc, argv, 0, _add_dep))
return 0;
_tree_walk_children(dm_tree_find_node(_dtree, 0, 0), 0);
@@ -1335,7 +1453,7 @@
else if ((_switches[TREE_ARG]))
return _tree(argc, argv, data);
else
- return _process_all(argc, argv, _display_name);
+ return _process_all(argc, argv, 0, _display_name);
}
/*
@@ -1356,8 +1474,8 @@
"\t [-U|--uid <uid>] [-G|--gid <gid>] [-M|--mode <octal_mode>]\n"
"\t [-u|uuid <uuid>] [--notable] [<table_file>]",
1, 2, _create},
- {"remove", "<device>", 0, 1, _remove},
- {"remove_all", "", 0, 0, _remove_all},
+ {"remove", "[-f|--force] <device>", 0, 1, _remove},
+ {"remove_all", "[-f|--force]", 0, 0, _remove_all},
{"suspend", "<device>", 0, 1, _suspend},
{"resume", "<device>", 0, 1, _resume},
{"load", "<device> [<table_file>]", 0, 2, _load},
@@ -1483,6 +1601,7 @@
{"readonly", 0, &ind, READ_ONLY},
{"columns", 0, &ind, COLS_ARG},
{"exec", 1, &ind, EXEC_ARG},
+ {"force", 0, &ind, FORCE_ARG},
{"gid", 1, &ind, GID_ARG},
{"major", 1, &ind, MAJOR_ARG},
{"minor", 1, &ind, MINOR_ARG},
@@ -1527,7 +1646,7 @@
_values[MINOR_ARG] = atoi((*argv)[2]);
*argc -= 2;
*argv += 2;
- } else if ((*argc == 2) &&
+ } else if ((*argc == 2) &&
(2 == sscanf((*argv)[1], "%i:%i",
&_values[MAJOR_ARG],
&_values[MINOR_ARG]))) {
@@ -1546,10 +1665,12 @@
optarg = 0;
optind = OPTIND_INIT;
- while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCG:j:m:M:no:ru:U:v",
+ while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfG:j:m:M:no:ru:U:v",
long_options, NULL)) != -1) {
if (c == 'c' || c == 'C' || ind == COLS_ARG)
_switches[COLS_ARG]++;
+ if (c == 'f' || ind == FORCE_ARG)
+ _switches[FORCE_ARG]++;
if (c == 'r' || ind == READ_ONLY)
_switches[READ_ONLY]++;
if (c == 'j' || ind == MAJOR_ARG) {
Modified: devmapper/trunk/kernel/ioctl/dm-ioctl.h
==============================================================================
--- devmapper/trunk/kernel/ioctl/dm-ioctl.h (original)
+++ devmapper/trunk/kernel/ioctl/dm-ioctl.h Sun Aug 6 21:21:34 2006
@@ -8,9 +8,7 @@
#ifndef _LINUX_DM_IOCTL_V4_H
#define _LINUX_DM_IOCTL_V4_H
-#ifdef linux
-# include <linux/types.h>
-#endif
+#include <linux/types.h>
#define DM_DIR "mapper" /* Slashes not supported */
#define DM_MAX_TYPE_NAME 16
@@ -84,11 +82,10 @@
* Pass a message string to the target at a specific offset of a device.
*
* DM_DEV_SET_GEOMETRY:
- * Set the geometry of a device by passing in a string. The
- * string should have this format:
+ * Set the geometry of a device by passing in a string in this format:
*
* "cylinders heads sectors_per_track start_sector"
- *
+ *
* Beware that CHS geometry is nearly obsolete and only provided
* for compatibility with dm devices that can be booted by a PC
* BIOS. See struct hd_geometry for range limits. Also note that
@@ -244,53 +241,53 @@
*/
#ifdef CONFIG_COMPAT
typedef char ioctl_struct[308];
-#define DM_VERSION_32 _IOWR(DM_IOCTL, DM_VERSION_CMD, ioctl_struct)
-#define DM_REMOVE_ALL_32 _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, ioctl_struct)
-#define DM_LIST_DEVICES_32 _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, ioctl_struct)
-
-#define DM_DEV_CREATE_32 _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, ioctl_struct)
-#define DM_DEV_REMOVE_32 _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, ioctl_struct)
-#define DM_DEV_RENAME_32 _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, ioctl_struct)
-#define DM_DEV_SUSPEND_32 _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, ioctl_struct)
-#define DM_DEV_STATUS_32 _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, ioctl_struct)
-#define DM_DEV_WAIT_32 _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, ioctl_struct)
-
-#define DM_TABLE_LOAD_32 _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, ioctl_struct)
-#define DM_TABLE_CLEAR_32 _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, ioctl_struct)
-#define DM_TABLE_DEPS_32 _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, ioctl_struct)
-#define DM_TABLE_STATUS_32 _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, ioctl_struct)
-#define DM_LIST_VERSIONS_32 _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, ioctl_struct)
-#define DM_TARGET_MSG_32 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, ioctl_struct)
+#define DM_VERSION_32 _IOWR(DM_IOCTL, DM_VERSION_CMD, ioctl_struct)
+#define DM_REMOVE_ALL_32 _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, ioctl_struct)
+#define DM_LIST_DEVICES_32 _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, ioctl_struct)
+
+#define DM_DEV_CREATE_32 _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, ioctl_struct)
+#define DM_DEV_REMOVE_32 _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, ioctl_struct)
+#define DM_DEV_RENAME_32 _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, ioctl_struct)
+#define DM_DEV_SUSPEND_32 _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, ioctl_struct)
+#define DM_DEV_STATUS_32 _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, ioctl_struct)
+#define DM_DEV_WAIT_32 _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, ioctl_struct)
+
+#define DM_TABLE_LOAD_32 _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, ioctl_struct)
+#define DM_TABLE_CLEAR_32 _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, ioctl_struct)
+#define DM_TABLE_DEPS_32 _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, ioctl_struct)
+#define DM_TABLE_STATUS_32 _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, ioctl_struct)
+#define DM_LIST_VERSIONS_32 _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, ioctl_struct)
+#define DM_TARGET_MSG_32 _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, ioctl_struct)
#define DM_DEV_SET_GEOMETRY_32 _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, ioctl_struct)
#endif
#define DM_IOCTL 0xfd
-#define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl)
-#define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl)
-#define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl)
-
-#define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl)
-#define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl)
-#define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl)
-#define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl)
-#define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl)
-#define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl)
-
-#define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl)
-#define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl)
-#define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl)
-#define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl)
+#define DM_VERSION _IOWR(DM_IOCTL, DM_VERSION_CMD, struct dm_ioctl)
+#define DM_REMOVE_ALL _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD, struct dm_ioctl)
+#define DM_LIST_DEVICES _IOWR(DM_IOCTL, DM_LIST_DEVICES_CMD, struct dm_ioctl)
+
+#define DM_DEV_CREATE _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD, struct dm_ioctl)
+#define DM_DEV_REMOVE _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD, struct dm_ioctl)
+#define DM_DEV_RENAME _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD, struct dm_ioctl)
+#define DM_DEV_SUSPEND _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD, struct dm_ioctl)
+#define DM_DEV_STATUS _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD, struct dm_ioctl)
+#define DM_DEV_WAIT _IOWR(DM_IOCTL, DM_DEV_WAIT_CMD, struct dm_ioctl)
+
+#define DM_TABLE_LOAD _IOWR(DM_IOCTL, DM_TABLE_LOAD_CMD, struct dm_ioctl)
+#define DM_TABLE_CLEAR _IOWR(DM_IOCTL, DM_TABLE_CLEAR_CMD, struct dm_ioctl)
+#define DM_TABLE_DEPS _IOWR(DM_IOCTL, DM_TABLE_DEPS_CMD, struct dm_ioctl)
+#define DM_TABLE_STATUS _IOWR(DM_IOCTL, DM_TABLE_STATUS_CMD, struct dm_ioctl)
-#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl)
+#define DM_LIST_VERSIONS _IOWR(DM_IOCTL, DM_LIST_VERSIONS_CMD, struct dm_ioctl)
-#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
+#define DM_TARGET_MSG _IOWR(DM_IOCTL, DM_TARGET_MSG_CMD, struct dm_ioctl)
#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
#define DM_VERSION_MAJOR 4
-#define DM_VERSION_MINOR 6
+#define DM_VERSION_MINOR 8
#define DM_VERSION_PATCHLEVEL 0
-#define DM_VERSION_EXTRA "-ioctl (2006-02-17)"
+#define DM_VERSION_EXTRA "-ioctl (2006-06-08)"
/* Status bits */
#define DM_READONLY_FLAG (1 << 0) /* In/Out */
@@ -317,7 +314,7 @@
#define DM_BUFFER_FULL_FLAG (1 << 8) /* Out */
/*
- * Set this to improve performance when you aren't going to use open_count.
+ * This flag is now ignored.
*/
#define DM_SKIP_BDGET_FLAG (1 << 9) /* In */
Modified: devmapper/trunk/lib/ioctl/libdm-iface.c
==============================================================================
--- devmapper/trunk/lib/ioctl/libdm-iface.c (original)
+++ devmapper/trunk/lib/ioctl/libdm-iface.c Sun Aug 6 21:21:34 2006
@@ -1461,7 +1461,6 @@
{
struct dm_task *task;
struct target *t1, *t2;
- int matches = 1;
int r;
/* New task to get existing table information */
@@ -1491,6 +1490,9 @@
return r;
}
+ if ((task->dmi.v4->flags & DM_READONLY_FLAG) ? 1 : 0 != dmt->read_only)
+ goto no_match;
+
t1 = dmt->head;
t2 = task->head;
@@ -1498,21 +1500,20 @@
if ((t1->start != t2->start) ||
(t1->length != t2->length) ||
(strcmp(t1->type, t2->type)) ||
- (strcmp(t1->params, t2->params))) {
- matches = 0;
- break;
- }
+ (strcmp(t1->params, t2->params)))
+ goto no_match;
t1 = t1->next;
t2 = t2->next;
}
- if (matches && !t1 && !t2) {
+ if (!t1 && !t2) {
dmt->dmi.v4 = task->dmi.v4;
task->dmi.v4 = NULL;
dm_task_destroy(task);
return 1;
}
+no_match:
dm_task_destroy(task);
/* Now do the original reload */
Modified: devmapper/trunk/lib/libdm-deptree.c
==============================================================================
--- devmapper/trunk/lib/libdm-deptree.c (original)
+++ devmapper/trunk/lib/libdm-deptree.c Sun Aug 6 21:21:34 2006
@@ -1267,9 +1267,12 @@
log_parm_count = 1; /* Region size */
log_parm_count += hweight32(seg->flags); /* [no]sync, block_on_error etc. */
+ if (seg->flags & DM_CORELOG)
+ log_parm_count--; /* DM_CORELOG does not count in the param list */
+
if (seg->clustered) {
- if (seg->uuid && !(seg->flags & DM_CORELOG))
- log_parm_count++; /* uuid (already counted for core log) */
+ if (seg->uuid)
+ log_parm_count++;
if ((tw = _dm_snprintf(params + pos, paramsize - pos, "clustered_")) < 0) {
stack; /* Out of space */
return -1;
Modified: devmapper/trunk/man/dmsetup.8
==============================================================================
--- devmapper/trunk/man/dmsetup.8 (original)
+++ devmapper/trunk/man/dmsetup.8 Sun Aug 6 21:21:34 2006
@@ -7,9 +7,10 @@
.I device_name [-u uuid] [--notable] [table_file]
.br
.B dmsetup remove
-.I device_name
+.I [-f|--force] device_name
.br
.B dmsetup remove_all
+.I [-f|--force]
.br
.B dmsetup suspend
.I [--nolockfs] device_name
@@ -103,7 +104,7 @@
.IP \fB-u|--uuid
.br
Specify the uuid.
-.IP \fB-v|--verbose [-v|--verbose]
+.IP \fB-v|--verbose\ [-v|--verbose]
.br
Produce additional output.
.IP \fB--version
@@ -163,15 +164,34 @@
.br
Loads table_file into the inactive table slot for device_name.
If table_file is not supplied, reads a table from standard input.
+.IP \fBmknodes
+.I [device_name]
+.br
+Ensure that the node in /dev/mapper for device_name is correct.
+If no device_name is supplied, ensure that all nodes in /dev/mapper
+correspond to mapped devices currently loaded by the device-mapper kernel
+driver, adding, changing or removing nodes as necessary.
.IP \fBremove
-.I device_name
+.I [-f|--force] device_name
.br
-Removes a device. It will no longer be visible to dmsetup and
-will be deleted when its open_count is zero.
+Removes a device. It will no longer be visible to dmsetup.
+Open devices cannot be removed except with older kernels
+that contain a version of device-mapper prior to 4.8.0.
+In this case the device will be deleted when its open_count
+drops to zero. From version 4.8.0 onwards, if a device can't
+be removed because an uninterruptible process is waiting for
+I/O to return from it, adding --force will replace the table
+with one that fails all I/O, which might allow the
+process to be killed.
.IP \fBremove_all
+.I [-f|--force]
.br
Attempts to remove all device definitions i.e. reset the driver.
-Use with care!
+Use with care! From version 4.8.0 onwards, if devices can't
+be removed because uninterruptible processess are waiting for
+I/O to return from them, adding --force will replace the table
+with one that fails all I/O, which might allow the
+process to be killed. This also runs \fBmknodes\fP afterwards.
.IP \fBrename
.I device_name new_name
.br
More information about the pkg-lvm-commits
mailing list