Bug#815916: patch update

2016-02-28 Thread Viktor Mihajlovski
On 27.02.2016 15:56, Philipp Kern wrote:
> On Fri, Feb 26, 2016 at 01:16:23PM +0100, Viktor Mihajlovski wrote:
>> the first patch to partman-base introduced a regression in the case of
>> pristine disks because it didn't check for ped_disk_new() failure.
>> Please use the new patch here instead.
> 
> I think you attached the old patch again, could that be?
> 
> % diff /tmp/0001-parted_devices-Add-disk-label-type-to-device-directo.patch-*
> 4c4
> < Subject: [PATCH] parted_devices: Add disk label type to device directory
> ---
>> Subject: [PATCHv2] parted_devices: Add disk label type to device directory
> 
> Kind regards and thanks
> Philipp Kern
> 
Quite obviously, thanks for checking.
As the saying goes, third time's a charm, so here we are:

-- 

Kind Regards
   Viktor Mihajlovski

>From 88320f8a3d5875c04fe8e55275de6cfc6fb54f40 Mon Sep 17 00:00:00 2001
From: Viktor Mihajlovski 
Date: Tue, 23 Feb 2016 15:23:21 +0100
Subject: [PATCHv3] parted_devices: Add disk label type to device directory

At least for s390 the default disk label type is device
dependent. We record the current disk label type in the
/var/lib/partman/devices/ for later retrieval.

Signed-off-by: Viktor Mihajlovski 
---
 init.d/parted| 2 ++
 parted_devices.c | 8 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/init.d/parted b/init.d/parted
index 81cdafc..6f96b07 100755
--- a/init.d/parted
+++ b/init.d/parted
@@ -87,6 +87,7 @@ if [ ! -f /var/run/parted_server.pid ]; then
 		device=$1
 		size=$2
 		model=$3
+		label=$4
 
 		# Skip mtd (not supported by parted) and mmcblk odities
 		case "${device#/dev/}" in
@@ -130,6 +131,7 @@ if [ ! -f /var/run/parted_server.pid ]; then
 		printf "%s" "$device" >$dev/device
 		printf "%s" "$size" >$dev/size
 		printf "%s" "$model" >$dev/model
+		printf "%s" "$label" >$dev/label
 
 		# Set the sataraid flag for dmraid arrays.
 		if type dmraid >/dev/null 2>&1 && \
diff --git a/parted_devices.c b/parted_devices.c
index de15355..197698e 100644
--- a/parted_devices.c
+++ b/parted_devices.c
@@ -76,6 +76,7 @@ is_floppy(const char *path)
 void
 process_device(PedDevice *dev)
 {
+	PedDisk *disk;
 	if (dev->read_only)
 		return;
 	if (is_cdrom(dev->path) || is_floppy(dev->path))
@@ -84,10 +85,13 @@ process_device(PedDevice *dev)
 	if (strstr(dev->path, "/dev/ramzswap") != NULL ||
 	strstr(dev->path, "/dev/zram") != NULL)
 		return;
-	printf("%s\t%lli\t%s\n",
+	disk = ped_disk_new(dev);
+	printf("%s\t%lli\t%s\t%s\n",
 	   dev->path,
 	   dev->length * dev->sector_size,
-	   dev->model);
+	   dev->model,
+	   disk && disk->type && disk->type->name ?
+	   disk->type->name : "unknown");
 }
 
 int
-- 
1.9.1



Bug#815916: patch update

2016-02-27 Thread Philipp Kern
On Fri, Feb 26, 2016 at 01:16:23PM +0100, Viktor Mihajlovski wrote:
> the first patch to partman-base introduced a regression in the case of
> pristine disks because it didn't check for ped_disk_new() failure.
> Please use the new patch here instead.

I think you attached the old patch again, could that be?

% diff /tmp/0001-parted_devices-Add-disk-label-type-to-device-directo.patch-*
4c4
< Subject: [PATCH] parted_devices: Add disk label type to device directory
---
> Subject: [PATCHv2] parted_devices: Add disk label type to device directory

Kind regards and thanks
Philipp Kern



Bug#815916: patch update

2016-02-26 Thread Viktor Mihajlovski
the first patch to partman-base introduced a regression in the case of
pristine disks because it didn't check for ped_disk_new() failure.
Please use the new patch here instead.

-- 

Mit freundlichen Grüßen/Kind Regards
   Viktor Mihajlovski


>From 6d71c4fb3eb679a5df4e1aa3028f0e6d6ec5df19 Mon Sep 17 00:00:00 2001
From: Viktor Mihajlovski 
Date: Tue, 23 Feb 2016 15:23:21 +0100
Subject: [PATCHv2] parted_devices: Add disk label type to device directory

At least for s390 the default disk label type is device
dependent. We record the current disk label type in the
/var/lib/partman/devices/ for later retrieval.

Signed-off-by: Viktor Mihajlovski 
---
 init.d/parted| 2 ++
 parted_devices.c | 7 +--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/init.d/parted b/init.d/parted
index 81cdafc..6f96b07 100755
--- a/init.d/parted
+++ b/init.d/parted
@@ -87,6 +87,7 @@ if [ ! -f /var/run/parted_server.pid ]; then
 		device=$1
 		size=$2
 		model=$3
+		label=$4
 
 		# Skip mtd (not supported by parted) and mmcblk odities
 		case "${device#/dev/}" in
@@ -130,6 +131,7 @@ if [ ! -f /var/run/parted_server.pid ]; then
 		printf "%s" "$device" >$dev/device
 		printf "%s" "$size" >$dev/size
 		printf "%s" "$model" >$dev/model
+		printf "%s" "$label" >$dev/label
 
 		# Set the sataraid flag for dmraid arrays.
 		if type dmraid >/dev/null 2>&1 && \
diff --git a/parted_devices.c b/parted_devices.c
index de15355..4fc64c7 100644
--- a/parted_devices.c
+++ b/parted_devices.c
@@ -76,6 +76,7 @@ is_floppy(const char *path)
 void
 process_device(PedDevice *dev)
 {
+	PedDisk *disk;
 	if (dev->read_only)
 		return;
 	if (is_cdrom(dev->path) || is_floppy(dev->path))
@@ -84,10 +85,12 @@ process_device(PedDevice *dev)
 	if (strstr(dev->path, "/dev/ramzswap") != NULL ||
 	strstr(dev->path, "/dev/zram") != NULL)
 		return;
-	printf("%s\t%lli\t%s\n",
+	disk = ped_disk_new(dev);
+	printf("%s\t%lli\t%s\t%s\n",
 	   dev->path,
 	   dev->length * dev->sector_size,
-	   dev->model);
+	   dev->model,
+	   disk->type->name ? disk->type->name : "unknown");
 }
 
 int
-- 
1.9.1