parted/libparted-dasd-add-swap-flag-handling-for-DASD-CDL.patch
Marcus Meissner 5631eac2bb Accepting request 760713 from home:anicka:branches:Base:System
- fix crash in do_resizepart
  + parted-fix-end_input-usage.patch: Fix end_input usage in
    do_resizepart 

- update to version 3.3, noteworthy changes:
 - s390: Re-enabled virtio-attached DASD heuristics by using
   HDIO_GETGEO when probing device geometry. Fixes a bug with
   KVM virtio-blk backed by a DASD.
   Parted now recognizes NVMe devices, NVDIMM, and RAM drives.
 - Fix atari disklabel false positives by probing other labels first.
 - Fix resizepart to adjust the end to be -1 sector when using iec
   power of 2 units so that the next partition can start immediately
   following the new end, just like mkpart does.
 - Fix set and disk_set to not crash when there are no flags to set.
 - Fix a udev cookie leak when using resizepart on device-mapper devices.
 - Fix a gettext crash/error sometimes when using localized languages.
 - Fix fat resize to preverve boot code, and thus not render the
   filesystem unreconized by Windows.
 - Fix rescue command: the rescue command often failed to find
   filesystems due to leaving on cylinder alignment.
 - libparted-fs-resize: Prevent crash resizing FAT file systems with very
   deep directories with path names over 512 bytes long.
 - Use 512b sector size when communicating with device-mapper. Fixes
   problems with partitions being created too small on dm devices
   with sector sizes > 5121b
 - Don't crash in the disk_set command when a disk label is not found
 - libparted-fs-resize: Prevent crash resizing FAT16 file systems.
 - libparted-fs-resize: Prevent crash resizing FAT16 file systems.
 - If the user specifies start/end of the partition as cylinders
   and a cylinder has a size which is power of 2, then such address

OBS-URL: https://build.opensuse.org/request/show/760713
OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=144
2020-01-12 13:40:37 +00:00

137 lines
3.9 KiB
Diff

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(-)
Index: parted-3.3/libparted/labels/dasd.c
===================================================================
--- parted-3.3.orig/libparted/labels/dasd.c
+++ parted-3.3/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;
@@ -749,14 +745,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:
@@ -774,6 +781,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:
@@ -802,6 +811,8 @@ dasd_partition_is_flag_available (const
return 0;
switch (flag) {
+ case PED_PARTITION_SWAP:
+ return 1;
case PED_PARTITION_RAID:
return 1;
case PED_PARTITION_LVM:
@@ -985,17 +996,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;
}