Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/Makefile.in lib/device/de ...

PATCH [email protected] 1 participant 1 message Aug 19, 2010 Library code

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mbroz at sourceware.org 2010-08-19 23:08:18

Modified files:

	.              : WHATS_NEW 
	lib            : Makefile.in 
	lib/device     : device.h 
	lib/metadata   : metadata.c 

Added files:
lib/device : dev-luks.c

Log message:
Detect LUKS signature in pvcreate

One shiny day we should use libblkid here. But now using LUKS is very common together with LVM and pvcreate destroys LUKS completely.

So for user's convenience, try to detect LUKS signature and allow abort.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1715&r2=1.1716
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/Makefile.in.diff?cvsroot=lvm2&r1=1.103&r2=1.104
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-luks.c.diff?cvsroot=lvm2&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/device.h.diff?cvsroot=lvm2&r1=1.44&r2=1.45
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.392&r2=1.393

WHATS_NEW +1 -0
@@ -3,6 +3,7 @@
   Simplify MD/swap signature detection in pvcreate and allow aborting.
   Remove assumption that --yes must be used only in --force mode.
   Fix file descriptor leak in swap signature detection error path.
+  Detect and allow abort in pvcreate if LUKS signature is detected.
 
 Version 2.02.73 - 18th August 2010
 ==================================
lib/Makefile.in +1 -0
@@ -47,6 +47,7 @@
 	device/dev-io.c \
 	device/dev-md.c \
 	device/dev-swap.c \
+	device/dev-luks.c \
 	device/device.c \
 	display/display.c \
 	error/errseg.c \

/cvs/lvm2/LVM2/lib/device/dev-luks.c,v --> standard output revision 1.1

- renamed from lib/device/dev-luks.c +43 -0

43 lines not on this page · raw message

lib/device/device.h +1 -0
@@ -96,6 +96,7 @@
 /* Does device contain md superblock?  If so, where? */
 int dev_is_md(struct device *dev, uint64_t *sb);
 int dev_is_swap(struct device *dev, uint64_t *signature);
+int dev_is_luks(struct device *dev, uint64_t *signature);
 unsigned long dev_md_stripe_width(const char *sysfs_dir, struct device *dev);
 
 int is_partitioned_dev(struct device *dev);
lib/metadata/metadata.c +3 -0
@@ -1640,6 +1640,9 @@
 	if (!_wipe_sb(dev, "swap signature", name, 10, pp, dev_is_swap))
 		return 0;
 
+	if (!_wipe_sb(dev, "LUKS signature", name, 8, pp, dev_is_luks))
+		return 0;
+
 	if (sigint_caught())
 		return 0;