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