Accepting request 503982 from Base:System

1

OBS-URL: https://build.opensuse.org/request/show/503982
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/parted?expand=0&rev=115
This commit is contained in:
Dominique Leuenberger 2017-06-20 08:59:38 +00:00 committed by Git OBS Bridge
commit 9625590bf1
6 changed files with 460 additions and 0 deletions

View File

@ -0,0 +1,134 @@
From: Sebastian Parschauer <sparschauer@suse.de>
Date: Thu, 15 Jun 2017 19:04:41 +0200
Subject: libparted/dasd: add swap flag handling for DASD-CDL
References: fate#314888, bsc#1044536
Patch-mainline: no, upstream wants to drop the swap flag
The way how the linux-swap partition type is handled is not how
fdasd handles it. It is only set if there is a linux-swap file
system set with mkpart or if there is a swap file system created
by mkswap on disk. But we want to know the partition type on disk.
So introduce a swap flag which behaves like the other flags. The
parted function do_mkpart() sets this flag for us if creating a
partition with FS type name "linux-swap*".
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
---
libparted/labels/dasd.c | 42 +++++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 17 deletions(-)
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -65,6 +65,7 @@ extern void ped_disk_dasd_done ();
typedef struct {
int type;
int system;
+ int swap;
int raid;
int lvm;
} DasdPartitionData;
@@ -316,6 +317,7 @@ dasd_read (PedDisk* disk)
part->num = 1;
part->fs_type = ped_file_system_probe (&part->geom);
dasd_data = part->disk_specific;
+ dasd_data->swap = 0;
dasd_data->raid = 0;
dasd_data->lvm = 0;
dasd_data->type = 0;
@@ -400,6 +402,7 @@ dasd_read (PedDisk* disk)
part->num = 1;
part->fs_type = ped_file_system_probe (&part->geom);
dasd_data = part->disk_specific;
+ dasd_data->swap = 0;
dasd_data->raid = 0;
dasd_data->lvm = 0;
dasd_data->type = 0;
@@ -457,18 +460,11 @@ dasd_read (PedDisk* disk)
}
dasd_data = part->disk_specific;
+ dasd_data->swap = !strncmp(PART_TYPE_SWAP, str, 6);
dasd_data->raid = !strncmp(PART_TYPE_RAID, str, 6);
dasd_data->lvm = !strncmp(PART_TYPE_LVM, str, 6);
dasd_partition_set_system(part, part->fs_type);
- if (strncmp(PART_TYPE_SWAP, str, 6) == 0) {
- fs = ped_file_system_probe(&part->geom);
- if (fs && is_linux_swap(fs->name)) {
- dasd_data->system = PARTITION_LINUX_SWAP;
- PDEBUG;
- }
- }
-
vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44);
dasd_data->type = 0;
@@ -745,14 +741,25 @@ dasd_partition_set_flag (PedPartition* p
dasd_data = part->disk_specific;
switch (flag) {
+ case PED_PARTITION_SWAP:
+ if (state) {
+ dasd_data->raid = 0;
+ dasd_data->lvm = 0;
+ }
+ dasd_data->swap = state;
+ return ped_partition_set_system(part, part->fs_type);
case PED_PARTITION_RAID:
- if (state)
+ if (state) {
+ dasd_data->swap = 0;
dasd_data->lvm = 0;
+ }
dasd_data->raid = state;
return ped_partition_set_system(part, part->fs_type);
case PED_PARTITION_LVM:
- if (state)
+ if (state) {
+ dasd_data->swap = 0;
dasd_data->raid = 0;
+ }
dasd_data->lvm = state;
return ped_partition_set_system(part, part->fs_type);
default:
@@ -770,6 +777,8 @@ dasd_partition_get_flag (const PedPartit
dasd_data = part->disk_specific;
switch (flag) {
+ case PED_PARTITION_SWAP:
+ return dasd_data->swap;
case PED_PARTITION_RAID:
return dasd_data->raid;
case PED_PARTITION_LVM:
@@ -784,6 +793,8 @@ dasd_partition_is_flag_available (const
PedPartitionFlag flag)
{
switch (flag) {
+ case PED_PARTITION_SWAP:
+ return 1;
case PED_PARTITION_RAID:
return 1;
case PED_PARTITION_LVM:
@@ -962,17 +973,14 @@ dasd_partition_set_system (PedPartition*
return 1;
}
- if (!fs_type) {
- dasd_data->system = PARTITION_LINUX;
- PDEBUG;
- } else if (is_linux_swap (fs_type->name)) {
+ if (dasd_data->swap) {
dasd_data->system = PARTITION_LINUX_SWAP;
PDEBUG;
- } else {
- dasd_data->system = PARTITION_LINUX;
- PDEBUG;
+ return 1;
}
+ dasd_data->system = PARTITION_LINUX;
+ PDEBUG;
return 1;
}

View File

@ -0,0 +1,44 @@
From: Andre Wild <wild@linux.vnet.ibm.com>
Date: Fri, 24 Mar 2017 03:11:11 +0100
Subject: libparted/dasd: improve lvm/raid flag handling for DASD-CDL
References: bsc#1040163, fate#314888
Patch-mainline: submitted, 2017-05-23
This commit corrects the reading of lvm/raid flags on DASD/CDL formatted
disks. Previously, users were not able to see what was the actual flags
stored on the disk. Now the file system check is removed and this issue
is corrected.
Fixes: c8873b0044c8 ("When reading the DASD disk label, ...")
Signed-off-by: Andre Wild <wild@linux.vnet.ibm.com>
Signed-off-by: Wang Dong <dongdwdw@linux.vnet.ibm.com>
Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Acked-by: Sebastian Parschauer <sparschauer@suse.de>
---
libparted/labels/dasd.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -457,18 +457,9 @@ dasd_read (PedDisk* disk)
}
dasd_data = part->disk_specific;
-
- if ((strncmp(PART_TYPE_RAID, str, 6) == 0) &&
- (ped_file_system_probe(&part->geom) == NULL))
- ped_partition_set_flag(part, PED_PARTITION_RAID, 1);
- else
- ped_partition_set_flag(part, PED_PARTITION_RAID, 0);
-
- if ((strncmp(PART_TYPE_LVM, str, 6) == 0) &&
- (ped_file_system_probe(&part->geom) == NULL))
- ped_partition_set_flag(part, PED_PARTITION_LVM, 1);
- else
- ped_partition_set_flag(part, PED_PARTITION_LVM, 0);
+ dasd_data->raid = !strncmp(PART_TYPE_RAID, str, 6);
+ dasd_data->lvm = !strncmp(PART_TYPE_LVM, str, 6);
+ dasd_partition_set_system(part, part->fs_type);
if (strncmp(PART_TYPE_SWAP, str, 6) == 0) {
fs = ped_file_system_probe(&part->geom);

View File

@ -0,0 +1,213 @@
From: Arvin Schnell <aschnell@suse.com>
Date: Thu, 22 Dec 2016 14:36:43 -0800
Subject: libparted: set swap flag on GPT partitions
References: fate#314888, bsc#1044536
Patch-mainline: v3.3
Git-commit: c7ce5d48f6facccf617467d79c68ccce0bc27dcd
The filesystem type is still detected as befor, but now setting the
'swap' flag will set the partition GUID to PARTITION_SWAP_GUID.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
[sparschauer: Drop setting PARTITION_SWAP_GUID when the FS is swap]
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
---
libparted/labels/gpt.c | 42 +++++++++++++++++++++++++++++++++++++++---
1 file changed, 39 insertions(+), 3 deletions(-)
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -290,6 +290,7 @@ typedef struct _GPTPartitionData
efi_char16_t name[37];
char *translated_name;
int lvm;
+ int swap;
int raid;
int boot;
int bios_grub;
@@ -918,7 +919,8 @@ _parse_part_entry (PedDisk *disk, GuidPa
gpt_part_data->name[i] = 0;
gpt_part_data->translated_name = 0;
- gpt_part_data->lvm = gpt_part_data->raid
+ gpt_part_data->lvm = gpt_part_data->swap
+ = gpt_part_data->raid
= gpt_part_data->boot = gpt_part_data->hp_service
= gpt_part_data->hidden = gpt_part_data->msftres
= gpt_part_data->msftdata
@@ -941,6 +943,8 @@ _parse_part_entry (PedDisk *disk, GuidPa
gpt_part_data->raid = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_LVM_GUID))
gpt_part_data->lvm = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_SWAP_GUID))
+ gpt_part_data->swap = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_HPSERVICE_GUID))
gpt_part_data->hp_service = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID))
@@ -1568,6 +1572,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
gpt_part_data->lvm = 0;
+ gpt_part_data->swap = 0;
gpt_part_data->raid = 0;
gpt_part_data->boot = 0;
gpt_part_data->bios_grub = 0;
@@ -1656,6 +1661,11 @@ gpt_partition_set_system (PedPartition *
gpt_part_data->type = PARTITION_LVM_GUID;
return 1;
}
+ if (gpt_part_data->swap)
+ {
+ gpt_part_data->type = PARTITION_SWAP_GUID;
+ return 1;
+ }
if (gpt_part_data->raid)
{
gpt_part_data->type = PARTITION_RAID_GUID;
@@ -1720,11 +1730,6 @@ gpt_partition_set_system (PedPartition *
gpt_part_data->type = PARTITION_APPLE_HFS_GUID;
return 1;
}
- if (strstr (fs_type->name, "swap"))
- {
- gpt_part_data->type = PARTITION_SWAP_GUID;
- return 1;
- }
}
gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
@@ -1843,6 +1848,7 @@ gpt_partition_set_flag (PedPartition *pa
if (state)
gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1857,6 +1863,7 @@ gpt_partition_set_flag (PedPartition *pa
if (state)
gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->boot
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1871,6 +1878,7 @@ gpt_partition_set_flag (PedPartition *pa
if (state)
gpt_part_data->boot
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1884,6 +1892,22 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->lvm = state;
if (state)
gpt_part_data->boot
+ = gpt_part_data->swap
+ = gpt_part_data->raid
+ = gpt_part_data->bios_grub
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres
+ = gpt_part_data->msftdata
+ = gpt_part_data->msftrecv
+ = gpt_part_data->prep
+ = gpt_part_data->irst
+ = gpt_part_data->atvrecv = 0;
+ return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_SWAP:
+ gpt_part_data->swap = state;
+ if (state)
+ gpt_part_data->boot
+ = gpt_part_data->lvm
= gpt_part_data->raid
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
@@ -1900,6 +1924,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->bios_grub
= gpt_part_data->msftres
= gpt_part_data->msftdata
@@ -1914,6 +1939,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftdata
@@ -1928,6 +1954,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1946,6 +1973,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftdata
@@ -1960,6 +1988,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1973,6 +2002,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -1986,6 +2016,7 @@ gpt_partition_set_flag (PedPartition *pa
gpt_part_data->boot
= gpt_part_data->raid
= gpt_part_data->lvm
+ = gpt_part_data->swap
= gpt_part_data->bios_grub
= gpt_part_data->hp_service
= gpt_part_data->msftres
@@ -2000,7 +2031,6 @@ gpt_partition_set_flag (PedPartition *pa
case PED_PARTITION_LEGACY_BOOT:
gpt_part_data->legacy_boot = state;
return 1;
- case PED_PARTITION_SWAP:
case PED_PARTITION_ROOT:
case PED_PARTITION_LBA:
default:
@@ -2046,6 +2076,7 @@ gpt_partition_get_flag (const PedPartiti
case PED_PARTITION_IRST:
return gpt_part_data->irst;
case PED_PARTITION_SWAP:
+ return gpt_part_data->swap;
case PED_PARTITION_LBA:
case PED_PARTITION_ROOT:
default:
@@ -2062,6 +2093,7 @@ gpt_partition_is_flag_available (const P
{
case PED_PARTITION_RAID:
case PED_PARTITION_LVM:
+ case PED_PARTITION_SWAP:
case PED_PARTITION_BOOT:
case PED_PARTITION_BIOS_GRUB:
case PED_PARTITION_HPSERVICE:
@@ -2075,7 +2107,6 @@ gpt_partition_is_flag_available (const P
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
return 1;
- case PED_PARTITION_SWAP:
case PED_PARTITION_ROOT:
case PED_PARTITION_LBA:
default:

View File

@ -0,0 +1,44 @@
From: Sebastian Parschauer <sparschauer@suse.de>
Date: Thu, 15 Jun 2017 18:50:32 +0200
Subject: parted: mkpart: set a swap flag if available
References: fate#314888, bsc#1044536
Patch-mainline: no, upstream wants to drop the swap flag
libparted can't differentiate if ped_partition_set_system() is
called from mkpart context or when reading from disk. This makes
it hard to handle the linux-swap partition type properly.
So check in do_mkpart() if a swap flag is available and only set it
there if the selected FS type name starts with "linux-swap".
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
---
parted/parted.c | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -655,6 +655,13 @@ _adjust_end_if_iec (PedSector* start, Pe
}
+static inline int
+is_linux_swap (char const *fs_type_name)
+{
+ char const *prefix = "linux-swap";
+ return strncmp (fs_type_name, prefix, strlen (prefix)) == 0;
+}
+
static int
do_mkpart (PedDevice** dev, PedDisk** diskp)
{
@@ -844,6 +851,9 @@ do_mkpart (PedDevice** dev, PedDisk** di
goto error;
if (ped_partition_is_flag_available (part, PED_PARTITION_LBA))
ped_partition_set_flag (part, PED_PARTITION_LBA, 1);
+ if (ped_partition_is_flag_available (part, PED_PARTITION_SWAP) &&
+ fs_type && is_linux_swap(fs_type->name))
+ ped_partition_set_flag (part, PED_PARTITION_SWAP, 1);
if (wipesignatures) {
if (!ped_device_wipe_signatures(*dev, part->geom.start, part->geom.length))

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Thu Jun 15 20:28:08 CEST 2017 - sparschauer@suse.de
- Add a swap flag for dasd/gpt and handle it like gdisk/fdasd
(bsc#1044536, fate#314888)
- add: parted-mkpart-set-a-swap-flag-if-available.patch
- add: libparted-set-swap-flag-on-GPT-partitions.patch
- add: libparted-dasd-add-swap-flag-handling-for-DASD-CDL.patch
-------------------------------------------------------------------
Wed May 24 17:15:17 CEST 2017 - sparschauer@suse.de
- Fix printing DASD/CDL partition flags "lvm" and "raid"
(bsc#1040163, fate#314888)
- add: libparted-dasd-improve-lvm-raid-flag-handling.patch
-------------------------------------------------------------------
Tue May 16 15:28:47 CEST 2017 - sparschauer@suse.de

View File

@ -74,6 +74,11 @@ Patch43: libparted-dasd-unify-vtoc-handling-for-cdl-ldl.patch
Patch44: libparted-dasd-update-and-improve-fdasd-functions.patch
Patch45: libparted-dasd-add-new-fdasd-functions.patch
Patch46: libparted-Add-support-for-RAM-drives.patch
# fate#314888
Patch47: libparted-dasd-improve-lvm-raid-flag-handling.patch
Patch48: parted-mkpart-set-a-swap-flag-if-available.patch
Patch49: libparted-set-swap-flag-on-GPT-partitions.patch
Patch50: libparted-dasd-add-swap-flag-handling-for-DASD-CDL.patch
Patch100: parted-fatresize-autoconf.patch
BuildRequires: check-devel
BuildRequires: device-mapper-devel >= 1.02.33
@ -163,6 +168,10 @@ to develop applications that require these.
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch100 -p1
%build