- tests: t3200-type-change now passes (bcl)

- parted: Reset the filesystem type when changing the id/uuid (bcl)
- libparted: add swap flag for DASD label (aschnell)
- parted: add type command (aschnell)
- maint: post-release administrivia (bcl)
This commit is contained in:
Brian C. Lane 2022-05-17 16:23:46 -07:00
parent 4cce40f55c
commit 953543a358
6 changed files with 1980 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From cec533a00a2cd0b64a7a0f5debc26554f6025831 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 18 Apr 2022 15:10:06 -0400
Subject: [PATCH 1/5] maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
---
.prev-version | 2 +-
NEWS | 3 +++
cfg.mk | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/.prev-version b/.prev-version
index e917998..5a95802 100644
--- a/.prev-version
+++ b/.prev-version
@@ -1 +1 @@
-3.4.64.2
+3.5
diff --git a/NEWS b/NEWS
index 68a164a..2bd161f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
GNU parted NEWS -*- outline -*-
+* Noteworthy changes in release ?.? (????-??-??) [?]
+
+
* Noteworthy changes in release 3.5 (2022-04-18) [stable]
** New Features
diff --git a/cfg.mk b/cfg.mk
index d5fdd80..11fa51b 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -45,7 +45,7 @@ local-checks-to-skip = \
export VERBOSE = yes
# Hash of lines 42-208 for release 3.2
-old_NEWS_hash = 64a8f4d9ec1a5c256f3cc792450dc257
+old_NEWS_hash = 81f624d1d62a34f24e1286bd3cf5c736
include $(srcdir)/dist-check.mk
--
2.35.3

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,228 @@
From 29ffc6a1f285f48ac0b9efa7299373e486c486e8 Mon Sep 17 00:00:00 2001
From: Arvin Schnell <aschnell@suse.com>
Date: Fri, 8 Oct 2021 10:06:24 +0000
Subject: [PATCH 3/5] libparted: add swap flag for DASD label
Support the swap flag and fix reading flags from disk. Also
cleanup code by dropping the 2 flags "raid" and "lvm" from
DasdPartitionData and instead use "system" directly.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
include/parted/fdasd.in.h | 2 -
libparted/labels/dasd.c | 118 ++++++++++++++++----------------------
2 files changed, 50 insertions(+), 70 deletions(-)
diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
index 9e5d7d1..e3ba183 100644
--- a/include/parted/fdasd.in.h
+++ b/include/parted/fdasd.in.h
@@ -28,10 +28,8 @@
#define PARTITION_LINUX_SWAP 0x82
#define PARTITION_LINUX 0x83
-#define PARTITION_LINUX_EXT 0x85
#define PARTITION_LINUX_LVM 0x8e
#define PARTITION_LINUX_RAID 0xfd
-#define PARTITION_LINUX_LVM_OLD 0xfe
#define PART_TYPE_NATIVE "NATIVE"
#define PART_TYPE_SWAP "SWAP "
diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
index 0c00c4f..27baad0 100644
--- a/libparted/labels/dasd.c
+++ b/libparted/labels/dasd.c
@@ -53,10 +53,8 @@
#define PARTITION_LINUX_SWAP 0x82
#define PARTITION_LINUX 0x83
-#define PARTITION_LINUX_EXT 0x85
#define PARTITION_LINUX_LVM 0x8e
#define PARTITION_LINUX_RAID 0xfd
-#define PARTITION_LINUX_LVM_OLD 0xfe
extern void ped_disk_dasd_init ();
extern void ped_disk_dasd_done ();
@@ -66,8 +64,6 @@ extern void ped_disk_dasd_done ();
typedef struct {
int type;
int system;
- int raid;
- int lvm;
} DasdPartitionData;
typedef struct {
@@ -134,6 +130,31 @@ static PedDiskType dasd_disk_type = {
features: 0
};
+struct flag_id_mapping_t
+{
+ enum _PedPartitionFlag flag;
+ int type_id;
+};
+
+static const struct flag_id_mapping_t flag_id_mapping[] =
+{
+ { PED_PARTITION_LVM, PARTITION_LINUX_LVM },
+ { PED_PARTITION_RAID, PARTITION_LINUX_RAID },
+ { PED_PARTITION_SWAP, PARTITION_LINUX_SWAP },
+};
+
+static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST
+dasd_find_flag_id_mapping (PedPartitionFlag flag)
+{
+ int n = sizeof(flag_id_mapping) / sizeof(flag_id_mapping[0]);
+
+ for (int i = 0; i < n; ++i)
+ if (flag_id_mapping[i].flag == flag)
+ return &flag_id_mapping[i];
+
+ return NULL;
+}
+
static PedDisk*
dasd_alloc (const PedDevice* dev)
{
@@ -310,8 +331,6 @@ dasd_read (PedDisk* disk)
part->num = 1;
part->fs_type = ped_file_system_probe (&part->geom);
dasd_data = part->disk_specific;
- dasd_data->raid = 0;
- dasd_data->lvm = 0;
dasd_data->type = 0;
if (!ped_disk_add_partition (disk, part, NULL))
@@ -394,8 +413,6 @@ dasd_read (PedDisk* disk)
part->num = 1;
part->fs_type = ped_file_system_probe (&part->geom);
dasd_data = part->disk_specific;
- dasd_data->raid = 0;
- dasd_data->lvm = 0;
dasd_data->type = 0;
if (!ped_disk_add_partition (disk, part, NULL))
@@ -452,25 +469,12 @@ 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);
-
- 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;
- }
- }
+ if (strncmp(PART_TYPE_RAID, str, 6) == 0)
+ dasd_data->system = PARTITION_LINUX_RAID;
+ else if (strncmp(PART_TYPE_LVM, str, 6) == 0)
+ dasd_data->system = PARTITION_LINUX_LVM;
+ else if (strncmp(PART_TYPE_SWAP, str, 6) == 0)
+ dasd_data->system = PARTITION_LINUX_SWAP;
vtoc_ebcdic_enc(p->f1->DS1DSNAM, p->f1->DS1DSNAM, 44);
@@ -747,20 +751,17 @@ dasd_partition_set_flag (PedPartition* part, PedPartitionFlag flag, int state)
PED_ASSERT(part->disk_specific != NULL);
dasd_data = part->disk_specific;
- switch (flag) {
- case PED_PARTITION_RAID:
- if (state)
- dasd_data->lvm = 0;
- dasd_data->raid = state;
- return ped_partition_set_system(part, part->fs_type);
- case PED_PARTITION_LVM:
- if (state)
- dasd_data->raid = 0;
- dasd_data->lvm = state;
- return ped_partition_set_system(part, part->fs_type);
- default:
- return 0;
+ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag);
+ if (p)
+ {
+ if (state)
+ dasd_data->system = p->type_id;
+ else if (dasd_data->system == p->type_id)
+ return dasd_partition_set_system (part, part->fs_type);
+ return 1;
}
+
+ return 0;
}
static int
@@ -772,14 +773,11 @@ dasd_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
PED_ASSERT (part->disk_specific != NULL);
dasd_data = part->disk_specific;
- switch (flag) {
- case PED_PARTITION_RAID:
- return dasd_data->raid;
- case PED_PARTITION_LVM:
- return dasd_data->lvm;
- default:
- return 0;
- }
+ const struct flag_id_mapping_t* p = dasd_find_flag_id_mapping (flag);
+ if (p)
+ return dasd_data->system == p->type_id;
+
+ return 0;
}
/*
@@ -800,14 +798,10 @@ dasd_partition_is_flag_available (const PedPartition* part,
if (disk_specific->format_type == 1)
return 0;
- switch (flag) {
- case PED_PARTITION_RAID:
- return 1;
- case PED_PARTITION_LVM:
- return 1;
- default:
- return 0;
- }
+ if (dasd_find_flag_id_mapping (flag))
+ return 1;
+
+ return 0;
}
@@ -938,18 +932,6 @@ dasd_partition_set_system (PedPartition* part,
part->fs_type = fs_type;
- if (dasd_data->lvm) {
- dasd_data->system = PARTITION_LINUX_LVM;
- PDEBUG;
- return 1;
- }
-
- if (dasd_data->raid) {
- dasd_data->system = PARTITION_LINUX_RAID;
- PDEBUG;
- return 1;
- }
-
if (!fs_type) {
dasd_data->system = PARTITION_LINUX;
PDEBUG;
--
2.35.3

View File

@ -0,0 +1,30 @@
From 9b0a83a747b28bd1b778bdd32616e6f7ea88c84d Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 13 May 2022 10:02:06 -0700
Subject: [PATCH 4/5] parted: Reset the filesystem type when changing the
id/uuid
Without this the print command keeps showing the type selected with
mkpart, which doesn't match the id/uuid set by the user. So rescan the
partition for a filesystem.
---
parted/parted.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/parted/parted.c b/parted/parted.c
index b8a4acf..96da30d 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -991,6 +991,9 @@ do_type (PedDevice** dev, PedDisk** diskp)
free (input);
+ // Reset the fs_type based on the filesystem, if it exists
+ part->fs_type = ped_file_system_probe (&part->geom);
+
if (!ped_disk_commit (*diskp))
goto error;
return 1;
--
2.35.3

View File

@ -0,0 +1,23 @@
From ac2a35c2214ef42352d0ddb4f7f4cb77d116e92e Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 13 May 2022 10:15:41 -0700
Subject: [PATCH 5/5] tests: t3200-type-change now passes
---
tests/Makefile.am | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2da653b..1d109d7 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,3 @@
-XFAIL_TESTS = \
- t3200-type-change.sh
-
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
--
2.35.3

View File

@ -1,7 +1,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.5
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv3+
URL: http://www.gnu.org/software/parted
@ -11,6 +11,11 @@ Source2: pubkey.phillip.susi
Source3: pubkey.brian.lane
# Upstream patches since v3.5 release
Patch0001: 0001-maint-post-release-administrivia.patch
Patch0002: 0002-parted-add-type-command.patch
Patch0003: 0003-libparted-add-swap-flag-for-DASD-label.patch
Patch0004: 0004-parted-Reset-the-filesystem-type-when-changing-the-i.patch
Patch0005: 0005-tests-t3200-type-change-now-passes.patch
BuildRequires: gcc
@ -115,6 +120,13 @@ make check
%changelog
* Tue May 17 2022 Brian C. Lane <bcl@redhat.com> - 3.5-2
- tests: t3200-type-change now passes (bcl)
- parted: Reset the filesystem type when changing the id/uuid (bcl)
- libparted: add swap flag for DASD label (aschnell)
- parted: add type command (aschnell)
- maint: post-release administrivia (bcl)
* Mon Apr 18 2022 Brian C. Lane <bcl@redhat.com> - 3.5-1
- Upstream 3.5 stable release