Skip to contentSkip to conversation

LVM2 ./WHATS_NEW_DM libdm/libdevmapper.h libdm ...

PATCH [email protected] 1 participant 1 message Oct 15, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2010-10-15 01:10:29

Modified files:

	.              : WHATS_NEW_DM 
	libdm          : libdevmapper.h libdm-common.c 
	libdm/ioctl    : libdm-iface.c libdm-targets.h 
	libdm/misc     : dm-ioctl.h 
	man            : dmsetup.8.in 
	tools          : dmsetup.c 

Log message:
Add --setuuid to dmsetup rename.
Add dm_task_set_newuuid to set uuid of mapped device post-creation. (pjones)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW_DM.diff?cvsroot=lvm2&r1=1.416&r2=1.417
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdevmapper.h.diff?cvsroot=lvm2&r1=1.126&r2=1.127
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/libdm-common.c.diff?cvsroot=lvm2&r1=1.100&r2=1.101
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-iface.c.diff?cvsroot=lvm2&r1=1.81&r2=1.82
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/ioctl/libdm-targets.h.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/libdm/misc/dm-ioctl.h.diff?cvsroot=lvm2&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/man/dmsetup.8.in.diff?cvsroot=lvm2&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dmsetup.c.diff?cvsroot=lvm2&r1=1.145&r2=1.146

WHATS_NEW_DM +2 -0
@@ -1,5 +1,7 @@
 Version 1.02.56 - 
 =====================================
+  Add --setuuid to dmsetup rename.
+  Add dm_task_set_newuuid to set uuid of mapped device post-creation.
 
 Version 1.02.55 - 24th September 2010
 =====================================
libdm/libdevmapper.h +1 -0
@@ -167,6 +167,7 @@
 
 int dm_task_set_ro(struct dm_task *dmt);
 int dm_task_set_newname(struct dm_task *dmt, const char *newname);
+int dm_task_set_newuuid(struct dm_task *dmt, const char *newuuid);
 int dm_task_set_minor(struct dm_task *dmt, int minor);
 int dm_task_set_major(struct dm_task *dmt, int major);
 int dm_task_set_major_minor(struct dm_task *dmt, int major, int minor, int allow_default_major_fallback);
libdm/libdm-common.c +1 -0
@@ -192,6 +192,7 @@
 	dmt->event_nr = 0;
 	dmt->cookie_set = 0;
 	dmt->query_inactive_table = 0;
+	dmt->new_uuid = 0;
 
 	return dmt;
 }
libdm/ioctl/libdm-iface.c +36 -5

95 lines not on this page · raw message

libdm/ioctl/libdm-targets.h +1 -0
@@ -62,6 +62,7 @@
 	int suppress_identical_reload;
 	uint64_t existing_table_size;
 	int cookie_set;
+	int new_uuid;
 
 	char *uuid;
 };
libdm/misc/dm-ioctl.h +9 -3
@@ -46,7 +46,7 @@
  * Remove a device, destroy any tables.
  *
  * DM_DEV_RENAME:
- * Rename a device.
+ * Rename a device or set its uuid if none was previously supplied.
  *
  * DM_SUSPEND:
  * This performs both suspend and resume, depending which flag is
@@ -269,9 +269,9 @@
 #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	17
+#define DM_VERSION_MINOR	19
 #define DM_VERSION_PATCHLEVEL	0
-#define DM_VERSION_EXTRA	"-ioctl (2010-03-05)"
+#define DM_VERSION_EXTRA	"-ioctl (2010-10-14)"
 
 /* Status bits */
 #define DM_READONLY_FLAG	(1 << 0) /* In/Out */
@@ -324,4 +324,10 @@
  */
 #define DM_UEVENT_GENERATED_FLAG	(1 << 13) /* Out */
 
+/*
+ * If set, rename changes the uuid not the name.  Only permitted
+ * if no uuid was previously supplied: an existing uuid cannot be changed.
+ */
+#define DM_NEW_UUID_FLAG        (1 << 14) /* In */
+
 #endif				/* _LINUX_DM_IOCTL_H */
man/dmsetup.8.in +8 -0
@@ -33,6 +33,9 @@
 .B dmsetup rename
 .I device_name new_name
 .br
+.B dmsetup rename
+.I device_name --setuuid uuid
+.br
 .B dmsetup message
 .I device_name sector message
 .br
@@ -285,6 +288,11 @@
 .I device_name new_name
 .br
 Renames a device.
+.IP \fBrename
+.I device_name --setuuid uuid
+.br
+Sets the uuid of a device that was created without a uuid.
+After a uuid has been set it cannot be changed.
 .IP \fBresume
 .I device_name
 .br
tools/dmsetup.c +9 -2
@@ -140,6 +140,7 @@
 	READAHEAD_ARG,
 	ROWS_ARG,
 	SEPARATOR_ARG,
+	SETUUID_ARG,
 	SHOWKEYS_ARG,
 	SORT_ARG,
 	TABLE_ARG,
@@ -665,7 +666,10 @@
 	if (!_set_task_device(dmt, (argc == 3) ? argv[1] : NULL, 0))
 		goto out;
 
-	if (!dm_task_set_newname(dmt, argv[argc - 1]))
+	if (_switches[SETUUID_ARG]) {
+		if  (!dm_task_set_newuuid(dmt, argv[argc - 1]))
+			goto out;
+	} else if (!dm_task_set_newname(dmt, argv[argc - 1]))
 		goto out;
 
 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
@@ -2699,7 +2703,7 @@
 	{"load", "<device> [<table_file>]", 0, 2, _load},
 	{"clear", "<device>", 0, 1, _clear},
 	{"reload", "<device> [<table_file>]", 0, 2, _load},
-	{"rename", "<device> <new_name>", 1, 2, _rename},
+	{"rename", "<device> [--setuuid] <new_name_or_uuid>", 1, 2, _rename},
 	{"message", "<device> <sector> <message>", 2, -1, _message},
 	{"ls", "[--target <target_type>] [--exec <command>] [--tree [-o options]]", 0, 0, _ls},
 	{"info", "[<device>]", 0, 1, _info},
@@ -3106,6 +3110,7 @@
 		{"readahead", 1, &ind, READAHEAD_ARG},
 		{"rows", 0, &ind, ROWS_ARG},
 		{"separator", 1, &ind, SEPARATOR_ARG},
+		{"setuuid", 0, &ind, SETUUID_ARG},
 		{"showkeys", 0, &ind, SHOWKEYS_ARG},
 		{"sort", 1, &ind, SORT_ARG},
 		{"table", 1, &ind, TABLE_ARG},
@@ -3278,6 +3283,8 @@
 		}
 		if ((ind == ROWS_ARG))
 			_switches[ROWS_ARG]++;
+		if ((ind == SETUUID_ARG))
+			_switches[SETUUID_ARG]++;
 		if ((ind == SHOWKEYS_ARG))
 			_switches[SHOWKEYS_ARG]++;
 		if ((ind == TABLE_ARG)) {