parted/libparted-dasd-implicit-partition-disk-flag.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

131 lines
4.0 KiB
Diff

From: Petr Uzel <petr.uzel@suse.cz>
Subject: libparted: dasd: Add an implicit partition disk flag
Patch-mainline: no, custom SUSE patch
---
include/parted/disk.in.h | 4 +++-
libparted/disk.c | 2 ++
libparted/labels/dasd.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 1 deletion(-)
Index: parted-3.3/include/parted/disk.in.h
===================================================================
--- parted-3.3.orig/include/parted/disk.in.h
+++ parted-3.3/include/parted/disk.in.h
@@ -38,9 +38,11 @@ enum _PedDiskFlag {
PED_DISK_CYLINDER_ALIGNMENT=1,
/* This flag controls whether the boot flag of a GPT PMBR is set */
PED_DISK_GPT_PMBR_BOOT=2,
+ /* This flag indicates that there is an implicit (aka fake) partition on the DASD disk */
+ PED_DISK_DASD_IMPLICIT_PARTITION=3,
};
#define PED_DISK_FIRST_FLAG PED_DISK_CYLINDER_ALIGNMENT
-#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT
+#define PED_DISK_LAST_FLAG PED_DISK_DASD_IMPLICIT_PARTITION
/**
* Partition types
Index: parted-3.3/libparted/disk.c
===================================================================
--- parted-3.3.orig/libparted/disk.c
+++ parted-3.3/libparted/disk.c
@@ -841,6 +841,8 @@ ped_disk_flag_get_name(PedDiskFlag flag)
return N_("cylinder_alignment");
case PED_DISK_GPT_PMBR_BOOT:
return N_("pmbr_boot");
+ case PED_DISK_DASD_IMPLICIT_PARTITION:
+ return N_("implicit_partition_table");
default:
ped_exception_throw (
PED_EXCEPTION_BUG,
Index: parted-3.3/libparted/labels/dasd.c
===================================================================
--- parted-3.3.orig/libparted/labels/dasd.c
+++ parted-3.3/libparted/labels/dasd.c
@@ -73,6 +73,7 @@ typedef struct {
unsigned int format_type;
unsigned int label_block;
volume_label_t vlabel;
+ unsigned int has_implicit_partition;
} DasdDiskSpecific;
static int dasd_probe (const PedDevice *dev);
@@ -107,6 +108,10 @@ static int dasd_partition_set_system (Pe
const PedFileSystemType* fs_type);
static int dasd_alloc_metadata (PedDisk* disk);
+static int dasd_disk_set_flag (PedDisk *disk, PedDiskFlag flag, int state);
+static int dasd_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag);
+static int dasd_disk_get_flag (const PedDisk *disk, PedDiskFlag flag);
+
#include "pt-common.h"
PT_define_limit_functions (dasd)
@@ -116,6 +121,9 @@ static PedDiskOps dasd_disk_ops = {
partition_set_name: NULL,
partition_get_name: NULL,
+ disk_set_flag: dasd_disk_set_flag,
+ disk_get_flag: dasd_disk_get_flag,
+ disk_is_flag_available: dasd_disk_is_flag_available,
get_partition_alignment: dasd_get_partition_alignment,
@@ -150,6 +158,8 @@ dasd_alloc (const PedDevice* dev)
return NULL;
}
+ disk_specific->has_implicit_partition = 0;
+
/* CDL format, newer */
disk_specific->format_type = 2;
disk_specific->label_block = 2;
@@ -289,6 +299,7 @@ dasd_read (PedDisk* disk)
goto error_close_dev;
disk_specific->format_type = 1;
+ disk_specific->has_implicit_partition = 1;
/* Register implicit partition */
ped_disk_delete_all (disk);
@@ -922,6 +933,40 @@ dasd_partition_enumerate (PedPartition*
}
static int
+dasd_disk_set_flag (PedDisk *disk, PedDiskFlag flag, int state)
+{
+ /* PED_DISK_DASD_IMPLICIT_PARTITION is immutable */
+ return 0;
+}
+
+static int
+dasd_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag)
+{
+ switch (flag)
+ {
+ case PED_DISK_DASD_IMPLICIT_PARTITION:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static int
+dasd_disk_get_flag (const PedDisk *disk, PedDiskFlag flag)
+{
+ DasdDiskSpecific* disk_specific = disk->disk_specific;
+
+ switch (flag)
+ {
+ case PED_DISK_DASD_IMPLICIT_PARTITION:
+ return disk_specific->has_implicit_partition;
+ break;
+ default:
+ return 0;
+ }
+}
+
+static int
dasd_partition_set_system (PedPartition* part,
const PedFileSystemType* fs_type)
{