File dab3ebce-devices-Do-not-support-unpartitioned-DASD.patch of Package lvm2.631

From dab3ebce4c75e931345159dfcf906cc32a066541 Mon Sep 17 00:00:00 2001
From: Alasdair G Kergon <agk@redhat.com>
Date: Fri, 23 Jan 2015 20:01:34 +0000
Subject: [PATCH] devices: Do not support unpartitioned DASD.
References: bnc#894202
Git-commit: dab3ebce4c75e931345159dfcf906cc32a066541


---

 lib/device/device.c  |    4 ++++
 lib/filters/filter.c |   16 ++++++++++++++++
 lib/filters/filter.h |    1 +
 3 files changed, 21 insertions(+)

--- a/lib/filters/filter.c
+++ b/lib/filters/filter.c
@@ -47,6 +47,7 @@ static struct {
 static int _md_major = -1;
 static int _blkext_major = -1;
 static int _drbd_major = -1;
+static int _dasd_major = -1;
 static int _device_mapper_major = -1;
 static int _emcpower_major = -1;
 
@@ -67,6 +68,11 @@ int drbd_major(void)
        return _drbd_major;
 }
 
+int dasd_major(void)
+{
+       return _dasd_major;
+}
+
 int blkext_major(void)
 {
 	return _blkext_major;
@@ -82,6 +88,9 @@ int dev_subsystem_part_major(const struc
 	if (MAJOR(dev->dev) == _drbd_major)
 		return 1;
 
+	if (MAJOR(dev->dev) == _dasd_major)
+		return 1;
+
 	if (MAJOR(dev->dev) == _emcpower_major)
 		return 1;
 
@@ -101,6 +110,9 @@ const char *dev_subsystem_name(const str
 	if (MAJOR(dev->dev) == _drbd_major)
 		return "DRBD";
 
+	if (MAJOR(dev->dev) == _dasd_major)
+		return "DASD";
+
 	if (MAJOR(dev->dev) == _emcpower_major)
 		return "EMCPOWER";
 
@@ -249,6 +261,10 @@ static int _scan_proc_dev(const char *pr
 		if (!strncmp("drbd", line + i, 4) && isspace(*(line + i + 4)))
 			_drbd_major = line_maj;
 
+		/* Look for dasd device */
+		if (!strncmp("dasd", line + i, 4) && isspace(*(line + i + 4)))
+			_dasd_major = line_maj;
+
 		/* Look for EMC powerpath */
 		if (!strncmp("emcpower", line + i, 8) && isspace(*(line + i + 8)))
 			_emcpower_major = line_maj;
--- a/lib/device/device.c
+++ b/lib/device/device.c
@@ -92,6 +92,10 @@ int is_partitioned_dev(struct device *de
 	if (!_is_partitionable(dev))
 		return 0;
 
+	/*Unpartitioned DASD devices are not supported*/
+	if (MAJOR(dev->dev) == dasd_major())
+		return 1;
+
 	return _has_partition_table(dev);
 }
 
--- a/lib/filters/filter.h
+++ b/lib/filters/filter.h
@@ -35,6 +35,7 @@ struct dev_filter *lvm_type_filter_creat
 
 int dm_major(void);
 int md_major(void);
+int dasd_major(void);
 int blkext_major(void);
 int max_partitions(int major);
 int major_is_scsi_device(int major);
openSUSE Build Service is sponsored by