Compare commits

...

10 Commits

Author SHA1 Message Date
Brian C. Lane 5f1e574f65 - Fix ped_partition_set_system handling of existing flags Resolves: rhbz#2116505 2023-05-18 16:27:25 +00:00
Brian C. Lane b898e4ada1 - Rebase to upstream release 3.5
- Drop patches included in new upstream tar
- Add upstream patches for new type command
- Add upstream patch for swap flag on DASD
  Resolves: rhbz#1999333
2022-05-27 17:35:01 -07:00
Mohan Boddu 69de3928ff Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
Signed-off-by: Mohan Boddu <mboddu@redhat.com>
2021-08-09 22:49:25 +00:00
Brian C. Lane 6082f27e5e spec: Install to /usr/sbin and /usr/lib64 2021-06-15 10:29:23 -07:00
Brian C. Lane 18496a137d - Fix issues that covscan classifies as important
Resolves: rhbz#1938836
- Work around a mkswap bug
2021-06-14 16:48:55 -07:00
Brian C. Lane 4a98456ce3 gating: Switch test to run parted directly
Tests should run the installed package, not the source. So use the test
from RHEL 8.5.0 instead of from Fedora.

Resolves: rhbz#1968763
2021-06-08 15:49:50 -07:00
Brian C. Lane 6cea6cf291 gating.yaml add a RHEL gating config 2021-06-07 16:00:45 -07:00
Mohan Boddu b806096c05 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
Signed-off-by: Mohan Boddu <mboddu@redhat.com>
2021-04-16 02:48:25 +00:00
DistroBaker 5f2a33e978 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/parted.git#4ff1a768b478de8adbcf9799a900f1df726b154d
2021-02-03 21:04:02 +00:00
DistroBaker 5b3b6aff38 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/parted.git#8207dbd150159d5f2c3187d789192ee598581c53
2021-01-28 01:40:21 +00:00
57 changed files with 2501 additions and 3878 deletions

4
.gitignore vendored
View File

@ -17,3 +17,7 @@ clog
/parted-3.3.tar.xz.sig
/parted-3.3.52.tar.xz
/parted-3.3.52.tar.xz.sig
/parted-3.4.tar.xz
/parted-3.4.tar.xz.sig
/parted-3.5.tar.xz
/parted-3.5.tar.xz.sig

2
.parted.metadata Normal file
View File

@ -0,0 +1,2 @@
55023eb2acb3b22e6fc999d73e285f0a3706101a parted-3.5.tar.xz
a6494ad47e4d99009397f877101d26885f96ea88 parted-3.5.tar.xz.sig

View File

@ -1,34 +0,0 @@
From 22a4baba11ab299722e68f9ea37a53869afef7e1 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 27 Jun 2018 13:47:33 -0700
Subject: [PATCH 1/4] Switch gpt-header-move and msdos-overlap to python3
python2 is EOL on January 1, 2020 so it is time to switch to python3.
---
tests/gpt-header-move | 2 +-
tests/msdos-overlap | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/gpt-header-move b/tests/gpt-header-move
index 3dda5cb..18f58d0 100755
--- a/tests/gpt-header-move
+++ b/tests/gpt-header-move
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
# open img file, subtract 33 from altlba address, and move the last 33 sectors
# back by 33 sectors
diff --git a/tests/msdos-overlap b/tests/msdos-overlap
index d6ae8d6..b2b03e6 100755
--- a/tests/msdos-overlap
+++ b/tests/msdos-overlap
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
"""
Write an overlapping partition to a msdos disk
--
2.23.0

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

@ -1,25 +0,0 @@
From 679da92c54c75d7fca1fd825f1d42a750d115f2d Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 23 Apr 2019 10:25:20 -0700
Subject: [PATCH 3/4] tests: Test incomplete resizepart command
---
tests/t3200-resize-partition.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh
index 4565e99..06dbe68 100755
--- a/tests/t3200-resize-partition.sh
+++ b/tests/t3200-resize-partition.sh
@@ -63,6 +63,8 @@ parted -m -s $dev u s p > out 2>&1 || fail=1
wait_for_dev_to_appear_ ${dev}1 || { warn_ "${dev}1 did not appear" fail=1; }
sleep 1
+# Running it without end should not core-dump or prompt
+parted -s $dev resizepart 1 > out 2> err || fail=1
# extend the filesystem to end on sector 4096
new_end=4096s
--
2.23.0

View File

@ -1,34 +0,0 @@
From ca845aeeddb17343c9289816833ca352f7c0d87b Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 23 Apr 2019 13:52:25 -0700
Subject: [PATCH 4/4] Fix end_input usage in do_resizepart
It needs to be set to NULL, since it may not get set by the call to
command_line_get_sector
---
parted/parted.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parted/parted.c b/parted/parted.c
index 9dcdb05..df0c7ed 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1545,6 +1545,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
PedGeometry *range_end = NULL;
PedConstraint* constraint;
int rc = 0;
+ char* end_input = NULL;
if (!disk) {
disk = ped_disk_new (*dev);
@@ -1565,7 +1566,6 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
start = part->geom.start;
end = oldend = part->geom.end;
- char *end_input;
if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
goto error;
_adjust_end_if_iec(&start, &end, range_end, end_input);
--
2.23.0

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

@ -1,283 +0,0 @@
From e29dfafcf2d9a6886a66506bc84efb4badc5f6d6 Mon Sep 17 00:00:00 2001
From: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Date: Thu, 10 Oct 2019 21:03:22 +0300
Subject: [PATCH] libparted: Add ChromeOS Kernel partition flag
This adds a GPT-only partition type flag, chromeos_kernel, for use on
Chrome OS machines, with GUID FE3A2A5D-4F32-41A7-B725-ACCC3285A309.
The firmware/bootloader in these machines relies on special images being
written to partitions of this type. Among multiple such partitions, it
decides which one it will boot from based on the GUID-specific partition
attributes. This patch is not intended to and does not manipulate these
bits.
Google refers to these partitions as "ChromeOS kernel" partitions. They
also define partitions for rootfs, firmware, and a reserved one; but
these are not necessary for the boot flow and are not included here.
Relevant ChromiumOS documentation:
https://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format
Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---
doc/C/parted.8 | 2 +-
doc/parted.texi | 4 ++++
include/parted/disk.in.h | 5 +++--
libparted/disk.c | 2 ++
libparted/labels/gpt.c | 45 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index 15932c2..d40279e 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -112,7 +112,7 @@ or an LVM logical volume if necessary.
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
-"legacy_boot", "irst", "msftres", "esp" and "palo".
+"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel" and "palo".
\fIstate\fP should be either "on" or "off".
.TP
.B unit \fIunit\fP
diff --git a/doc/parted.texi b/doc/parted.texi
index 77c9628..f983d2c 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -874,6 +874,10 @@ partition.
(MS-DOS, GPT) - this flag identifies a UEFI System Partition. On GPT
it is an alias for boot.
+@item chromeos_kernel
+(GPT) - this flag indicates a partition that can be used with the Chrome OS
+bootloader and verified boot implementation.
+
@item lba
(MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and
MS Windows ME based operating systems to use Linear (LBA) mode.
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index a3b380d..b257c27 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -75,10 +75,11 @@ enum _PedPartitionFlag {
PED_PARTITION_LEGACY_BOOT=15,
PED_PARTITION_MSFT_DATA=16,
PED_PARTITION_IRST=17,
- PED_PARTITION_ESP=18
+ PED_PARTITION_ESP=18,
+ PED_PARTITION_CHROMEOS_KERNEL=19
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_CHROMEOS_KERNEL
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index 5aaac5a..d1f1077 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2407,6 +2407,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("irst");
case PED_PARTITION_ESP:
return N_("esp");
+ case PED_PARTITION_CHROMEOS_KERNEL:
+ return N_("chromeos_kernel");
default:
ped_exception_throw (
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 8e9500b..b8b58cd 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -156,6 +156,10 @@ typedef struct
((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \
PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \
{ 0xE3, 0xA5, 0x56, 0xD8, 0x95, 0x93 }})
+#define PARTITION_CHROMEOS_KERNEL_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0xfe3a2a5d), PED_CPU_TO_LE16 (0x4f32), \
+ PED_CPU_TO_LE16 (0x41a7), 0xb7, 0x25, \
+ { 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 }})
struct __attribute__ ((packed)) _GuidPartitionTableHeader_t
{
@@ -303,6 +307,7 @@ typedef struct _GPTPartitionData
int legacy_boot;
int prep;
int irst;
+ int chromeos_kernel;
} GPTPartitionData;
static PedDiskType gpt_disk_type;
@@ -826,6 +831,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
= gpt_part_data->legacy_boot
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
if (pte->Attributes.RequiredToFunction & 0x1)
@@ -857,6 +863,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
gpt_part_data->prep = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID))
gpt_part_data->irst = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID))
+ gpt_part_data->chromeos_kernel = 1;
return part;
}
@@ -1377,6 +1385,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->prep = 0;
gpt_part_data->translated_name = 0;
gpt_part_data->irst = 0;
+ gpt_part_data->chromeos_kernel = 0;
uuid_generate ((unsigned char *) &gpt_part_data->uuid);
swap_uuid_and_efi_guid (&gpt_part_data->uuid);
memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
@@ -1507,6 +1516,11 @@ gpt_partition_set_system (PedPartition *part,
gpt_part_data->type = PARTITION_IRST_GUID;
return 1;
}
+ if (gpt_part_data->chromeos_kernel)
+ {
+ gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID;
+ return 1;
+ }
if (fs_type)
{
@@ -1653,6 +1667,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_BIOS_GRUB:
@@ -1668,6 +1683,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_RAID:
@@ -1683,6 +1699,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_LVM:
@@ -1698,6 +1715,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_SWAP:
@@ -1713,6 +1731,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HPSERVICE:
@@ -1728,6 +1747,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_RESERVED:
@@ -1743,6 +1763,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_DATA:
@@ -1758,6 +1779,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
gpt_part_data->msftdata = 1;
} else {
@@ -1777,6 +1799,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->prep
= gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_APPLE_TV_RECOVERY:
@@ -1791,6 +1814,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->msftdata
= gpt_part_data->prep
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_PREP:
@@ -1805,6 +1829,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftres
= gpt_part_data->irst
= gpt_part_data->atvrecv
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_IRST:
@@ -1820,8 +1845,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftdata
= gpt_part_data->msftrecv
= gpt_part_data->prep
+ = gpt_part_data->chromeos_kernel
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_CHROMEOS_KERNEL:
+ gpt_part_data->chromeos_kernel = state;
+ if (state)
+ gpt_part_data->boot
+ = gpt_part_data->bios_grub
+ = gpt_part_data->raid
+ = gpt_part_data->lvm
+ = gpt_part_data->swap
+ = gpt_part_data->hp_service
+ = gpt_part_data->msftres
+ = gpt_part_data->msftdata
+ = gpt_part_data->msftrecv
+ = gpt_part_data->atvrecv
+ = gpt_part_data->prep
+ = gpt_part_data->irst = 0;
+ return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HIDDEN:
gpt_part_data->hidden = state;
return 1;
@@ -1874,6 +1916,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->irst;
case PED_PARTITION_SWAP:
return gpt_part_data->swap;
+ case PED_PARTITION_CHROMEOS_KERNEL:
+ return gpt_part_data->chromeos_kernel;
case PED_PARTITION_LBA:
case PED_PARTITION_ROOT:
default:
@@ -1903,6 +1947,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
case PED_PARTITION_PREP:
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
+ case PED_PARTITION_CHROMEOS_KERNEL:
return 1;
case PED_PARTITION_ROOT:
case PED_PARTITION_LBA:
--
2.24.1

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,139 +0,0 @@
From d6056299028f60b96802487de0d1d65e51e1fd33 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 19 Dec 2019 16:05:59 -0800
Subject: [PATCH 6/7] libparted: Add support for MSDOS partition type bls_boot
(0xea)
This type is used by the Boot Loader Specification to identify a
compatible /boot boot partition.
---
doc/C/parted.8 | 2 +-
libparted/labels/dos.c | 33 ++++++++++++++++++++-------------
2 files changed, 21 insertions(+), 14 deletions(-)
diff --git a/doc/C/parted.8 b/doc/C/parted.8
index d40279e..297c39a 100644
--- a/doc/C/parted.8
+++ b/doc/C/parted.8
@@ -112,7 +112,7 @@ or an LVM logical volume if necessary.
.B set \fIpartition\fP \fIflag\fP \fIstate\fP
Change the state of the \fIflag\fP on \fIpartition\fP to \fIstate\fP.
Supported flags are: "boot", "root", "swap", "hidden", "raid", "lvm", "lba",
-"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel" and "palo".
+"legacy_boot", "irst", "msftres", "esp", "chromeos_kernel", "bls_boot" and "palo".
\fIstate\fP should be either "on" or "off".
.TP
.B unit \fIunit\fP
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index ed1341e..d859b33 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -92,6 +92,7 @@ static const char MBR_BOOT_CODE[] = {
#define PARTITION_HFS 0xaf
#define PARTITION_SUN_UFS 0xbf
#define PARTITION_DELL_DIAG 0xde
+#define PARTITION_BLS_BOOT 0xea
#define PARTITION_GPT 0xee
#define PARTITION_ESP 0xef
#define PARTITION_PALO 0xf0
@@ -165,6 +166,7 @@ typedef struct {
int diag;
int irst;
int esp;
+ int bls_boot;
OrigState* orig; /* used for CHS stuff */
} DosPartitionData;
@@ -961,6 +963,7 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* raw_part,
dos_data->prep = raw_part->type == PARTITION_PREP;
dos_data->irst = raw_part->type == PARTITION_IRST;
dos_data->esp = raw_part->type == PARTITION_ESP;
+ dos_data->bls_boot = raw_part->type == PARTITION_BLS_BOOT;
dos_data->orig = ped_malloc (sizeof (OrigState));
if (!dos_data->orig) {
ped_partition_destroy (part);
@@ -1340,22 +1343,10 @@ msdos_partition_new (const PedDisk* disk, PedPartitionType part_type,
if (ped_partition_is_active (part)) {
part->disk_specific
- = dos_data = ped_malloc (sizeof (DosPartitionData));
+ = dos_data = ped_calloc (sizeof (DosPartitionData));
if (!dos_data)
goto error_free_part;
- dos_data->orig = NULL;
dos_data->system = PARTITION_LINUX;
- dos_data->hidden = 0;
- dos_data->msftres = 0;
- dos_data->boot = 0;
- dos_data->diag = 0;
- dos_data->raid = 0;
- dos_data->lvm = 0;
- dos_data->lba = 0;
- dos_data->palo = 0;
- dos_data->prep = 0;
- dos_data->irst = 0;
- dos_data->esp = 0;
} else {
part->disk_specific = NULL;
}
@@ -1394,6 +1385,7 @@ msdos_partition_duplicate (const PedPartition* part)
new_dos_data->prep = old_dos_data->prep;
new_dos_data->irst = old_dos_data->irst;
new_dos_data->esp = old_dos_data->esp;
+ new_dos_data->bls_boot = old_dos_data->bls_boot;
if (old_dos_data->orig) {
new_dos_data->orig = ped_malloc (sizeof (OrigState));
@@ -1492,6 +1484,10 @@ msdos_partition_set_system (PedPartition* part,
dos_data->system = PARTITION_ESP;
return 1;
}
+ if (dos_data->bls_boot) {
+ dos_data->system = PARTITION_BLS_BOOT;
+ return 1;
+ }
if (!fs_type)
dos_data->system = PARTITION_LINUX;
@@ -1534,6 +1530,7 @@ clear_flags (DosPartitionData *dos_data)
dos_data->irst = 0;
dos_data->esp = 0;
dos_data->raid = 0;
+ dos_data->bls_boot = 0;
}
static int
@@ -1635,6 +1632,12 @@ msdos_partition_set_flag (PedPartition* part,
dos_data->esp = state;
return ped_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_BLS_BOOT:
+ if (state)
+ clear_flags (dos_data);
+ dos_data->bls_boot = state;
+ return ped_partition_set_system (part, part->fs_type);
+
default:
return 0;
}
@@ -1689,6 +1692,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag)
case PED_PARTITION_ESP:
return dos_data->esp;
+ case PED_PARTITION_BLS_BOOT:
+ return dos_data->bls_boot;
+
default:
return 0;
}
@@ -1719,6 +1725,7 @@ msdos_partition_is_flag_available (const PedPartition* part,
case PED_PARTITION_PREP:
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
+ case PED_PARTITION_BLS_BOOT:
case PED_PARTITION_DIAG:
return 1;
--
2.24.1

View File

@ -0,0 +1,101 @@
From 22ec6553b00b8cc21bf8e78529e1cd0f775ff36f Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 8 Aug 2022 12:04:32 -0700
Subject: [PATCH 6/9] libparted: Fix handling of gpt partition types
This restores the previous behavior by testing the GUID against the list
of known types and skipping the filesystem GUID reset. Now the sequence
of:
ped_partition_new(...)
ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1);
ped_partition_set_system(part, ped_file_system_type_get("ext4"));
Will keep the GUID set to PED_PARTITION_BIOS_GRUB, which is how it used
to behave.
---
libparted/labels/gpt.c | 45 ++++++++++++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 2 deletions(-)
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 0e9e060..8e6a37d 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -196,6 +196,24 @@ static const struct flag_uuid_mapping_t flag_uuid_mapping[] =
{ PED_PARTITION_SWAP, PARTITION_SWAP_GUID },
};
+static const efi_guid_t skip_set_system_guids[] =
+{
+ PARTITION_LVM_GUID,
+ PARTITION_SWAP_GUID,
+ PARTITION_RAID_GUID,
+ PARTITION_PREP_GUID,
+ PARTITION_SYSTEM_GUID,
+ PARTITION_BIOS_GRUB_GUID,
+ PARTITION_HPSERVICE_GUID,
+ PARTITION_MSFT_RESERVED_GUID,
+ PARTITION_BASIC_DATA_GUID,
+ PARTITION_MSFT_RECOVERY,
+ PARTITION_APPLE_TV_RECOVERY_GUID,
+ PARTITION_IRST_GUID,
+ PARTITION_CHROMEOS_KERNEL_GUID,
+ PARTITION_BLS_BOOT_GUID,
+};
+
static const struct flag_uuid_mapping_t* _GL_ATTRIBUTE_CONST
gpt_find_flag_uuid_mapping (PedPartitionFlag flag)
{
@@ -1421,6 +1439,21 @@ gpt_partition_destroy (PedPartition *part)
_ped_partition_free (part);
}
+/* is_skip_guid checks the guid against the list of guids that should not be
+ * overridden by set_system. It returns a 1 if it is in the list.
+*/
+static bool
+is_skip_guid(efi_guid_t guid) {
+ int n = sizeof(skip_set_system_guids) / sizeof(skip_set_system_guids[0]);
+ for (int i = 0; i < n; ++i) {
+ if (guid_cmp(guid, skip_set_system_guids[i]) == 0) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
static int
gpt_partition_set_system (PedPartition *part,
const PedFileSystemType *fs_type)
@@ -1431,6 +1464,11 @@ gpt_partition_set_system (PedPartition *part,
part->fs_type = fs_type;
+ // Is this a GUID that should skip fs_type checking?
+ if (is_skip_guid(gpt_part_data->type)) {
+ return 1;
+ }
+
if (fs_type)
{
if (strncmp (fs_type->name, "fat", 3) == 0
@@ -1563,10 +1601,13 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
const struct flag_uuid_mapping_t* p = gpt_find_flag_uuid_mapping (flag);
if (p)
{
- if (state)
+ if (state) {
gpt_part_data->type = p->type_uuid;
- else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0)
+ } else if (guid_cmp (gpt_part_data->type, p->type_uuid) == 0) {
+ // Clear the GUID so that fs_type will be used to return it to the default
+ gpt_part_data->type = PARTITION_LINUX_DATA_GUID;
return gpt_partition_set_system (part, part->fs_type);
+ }
return 1;
}
--
2.37.1

View File

@ -1,248 +0,0 @@
From e5fe9328c890a266544a7ef0d272150519fdfc5d Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 20 Dec 2019 10:52:35 -0800
Subject: [PATCH 7/7] libparted: Add support for bls_boot to GPT disks
This sets the partition GUID to bc13c2ff-59e6-4262-a352-b275fd6f7172 to
indicate that the partition is a Boot Loader Specification compatible
/boot partition.
---
doc/parted.texi | 4 ++++
include/parted/disk.in.h | 5 +++--
libparted/disk.c | 2 ++
libparted/labels/gpt.c | 47 +++++++++++++++++++++++++++++++++++++++-
4 files changed, 55 insertions(+), 3 deletions(-)
diff --git a/doc/parted.texi b/doc/parted.texi
index f983d2c..213fc84 100644
--- a/doc/parted.texi
+++ b/doc/parted.texi
@@ -844,6 +844,10 @@ GRUB BIOS partition.
(GPT) - this flag is used to tell special purpose software that the GPT
partition may be bootable.
+@item bls_boot
+(MS-DOS, GPT) - Enable this to indicate that the selected partition is a
+Linux Boot Loader Specification compatible /boot partition.
+
@item boot
(Mac, MS-DOS, PC98) - should be enabled if you want to boot off the
partition. The semantics vary between disk labels. For MS-DOS disk
diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h
index b257c27..fadb995 100644
--- a/include/parted/disk.in.h
+++ b/include/parted/disk.in.h
@@ -76,10 +76,11 @@ enum _PedPartitionFlag {
PED_PARTITION_MSFT_DATA=16,
PED_PARTITION_IRST=17,
PED_PARTITION_ESP=18,
- PED_PARTITION_CHROMEOS_KERNEL=19
+ PED_PARTITION_CHROMEOS_KERNEL=19,
+ PED_PARTITION_BLS_BOOT=20
};
#define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT
-#define PED_PARTITION_LAST_FLAG PED_PARTITION_CHROMEOS_KERNEL
+#define PED_PARTITION_LAST_FLAG PED_PARTITION_BLS_BOOT
enum _PedDiskTypeFeature {
PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */
diff --git a/libparted/disk.c b/libparted/disk.c
index d1f1077..099837b 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -2409,6 +2409,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag)
return N_("esp");
case PED_PARTITION_CHROMEOS_KERNEL:
return N_("chromeos_kernel");
+ case PED_PARTITION_BLS_BOOT:
+ return N_("bls_boot");
default:
ped_exception_throw (
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index b8b58cd..93f7add 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -160,6 +160,10 @@ typedef struct
((efi_guid_t) { PED_CPU_TO_LE32 (0xfe3a2a5d), PED_CPU_TO_LE16 (0x4f32), \
PED_CPU_TO_LE16 (0x41a7), 0xb7, 0x25, \
{ 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09 }})
+#define PARTITION_BLS_BOOT_GUID \
+ ((efi_guid_t) { PED_CPU_TO_LE32 (0xbc13c2ff), PED_CPU_TO_LE16 (0x59e6), \
+ PED_CPU_TO_LE16 (0x4262), 0xa3, 0x52, \
+ { 0xb2, 0x75, 0xfd, 0x6f, 0x71, 0x72 }})
struct __attribute__ ((packed)) _GuidPartitionTableHeader_t
{
@@ -308,6 +312,7 @@ typedef struct _GPTPartitionData
int prep;
int irst;
int chromeos_kernel;
+ int bls_boot;
} GPTPartitionData;
static PedDiskType gpt_disk_type;
@@ -832,6 +837,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0;
if (pte->Attributes.RequiredToFunction & 0x1)
@@ -865,6 +871,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte)
gpt_part_data->irst = 1;
else if (!guid_cmp (gpt_part_data->type, PARTITION_CHROMEOS_KERNEL_GUID))
gpt_part_data->chromeos_kernel = 1;
+ else if (!guid_cmp (gpt_part_data->type, PARTITION_BLS_BOOT_GUID))
+ gpt_part_data->bls_boot = 1;
return part;
}
@@ -1386,6 +1394,7 @@ gpt_partition_new (const PedDisk *disk,
gpt_part_data->translated_name = 0;
gpt_part_data->irst = 0;
gpt_part_data->chromeos_kernel = 0;
+ gpt_part_data->bls_boot = 0;
uuid_generate ((unsigned char *) &gpt_part_data->uuid);
swap_uuid_and_efi_guid (&gpt_part_data->uuid);
memset (gpt_part_data->name, 0, sizeof gpt_part_data->name);
@@ -1521,6 +1530,11 @@ gpt_partition_set_system (PedPartition *part,
gpt_part_data->type = PARTITION_CHROMEOS_KERNEL_GUID;
return 1;
}
+ if (gpt_part_data->bls_boot)
+ {
+ gpt_part_data->type = PARTITION_BLS_BOOT_GUID;
+ return 1;
+ }
if (fs_type)
{
@@ -1668,6 +1682,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_BIOS_GRUB:
@@ -1684,6 +1699,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_RAID:
@@ -1700,6 +1716,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_LVM:
@@ -1716,6 +1733,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_SWAP:
@@ -1732,6 +1750,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HPSERVICE:
@@ -1748,6 +1767,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_RESERVED:
@@ -1764,6 +1784,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_MSFT_DATA:
@@ -1780,6 +1801,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->prep
= gpt_part_data->irst
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
gpt_part_data->msftdata = 1;
} else {
@@ -1830,6 +1852,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->irst
= gpt_part_data->atvrecv
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->msftrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_IRST:
@@ -1846,6 +1869,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->prep
= gpt_part_data->chromeos_kernel
+ = gpt_part_data->bls_boot
= gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_CHROMEOS_KERNEL:
@@ -1862,7 +1886,25 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state)
= gpt_part_data->msftrecv
= gpt_part_data->atvrecv
= gpt_part_data->prep
- = gpt_part_data->irst = 0;
+ = gpt_part_data->irst
+ = gpt_part_data->bls_boot = 0;
+ return gpt_partition_set_system (part, part->fs_type);
+ case PED_PARTITION_BLS_BOOT:
+ gpt_part_data->bls_boot = state;
+ if (state)
+ 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
+ = gpt_part_data->msftdata
+ = gpt_part_data->msftrecv
+ = gpt_part_data->prep
+ = gpt_part_data->irst
+ = gpt_part_data->chromeos_kernel
+ = gpt_part_data->atvrecv = 0;
return gpt_partition_set_system (part, part->fs_type);
case PED_PARTITION_HIDDEN:
gpt_part_data->hidden = state;
@@ -1914,6 +1956,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag)
return gpt_part_data->prep;
case PED_PARTITION_IRST:
return gpt_part_data->irst;
+ case PED_PARTITION_BLS_BOOT:
+ return gpt_part_data->bls_boot;
case PED_PARTITION_SWAP:
return gpt_part_data->swap;
case PED_PARTITION_CHROMEOS_KERNEL:
@@ -1948,6 +1992,7 @@ gpt_partition_is_flag_available (const PedPartition *part,
case PED_PARTITION_IRST:
case PED_PARTITION_ESP:
case PED_PARTITION_CHROMEOS_KERNEL:
+ case PED_PARTITION_BLS_BOOT:
return 1;
case PED_PARTITION_ROOT:
case PED_PARTITION_LBA:
--
2.24.1

View File

@ -0,0 +1,160 @@
From 8b4a30cc60ecbe9b7bc966e70560e5ce0fc0c1ad Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 8 Aug 2022 13:49:09 -0700
Subject: [PATCH 7/9] tests: Add a libparted test for ped_partition_set_system
on gpt
Test the libparted API to make sure the flag is not cleared by calling
ped_partition_set_system.
---
libparted/tests/Makefile.am | 6 ++-
libparted/tests/flags.c | 81 ++++++++++++++++++++++++++++++++++
libparted/tests/t1001-flags.sh | 23 ++++++++++
3 files changed, 108 insertions(+), 2 deletions(-)
create mode 100644 libparted/tests/flags.c
create mode 100755 libparted/tests/t1001-flags.sh
diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am
index fd5cba5..260b692 100644
--- a/libparted/tests/Makefile.am
+++ b/libparted/tests/Makefile.am
@@ -3,9 +3,10 @@
#
# This file may be modified and/or distributed without restriction.
-TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh
+TESTS = t1000-label.sh t1001-flags.sh t2000-disk.sh t2100-zerolen.sh \
+ t3000-symlink.sh t4000-volser.sh
EXTRA_DIST = $(TESTS)
-check_PROGRAMS = label disk zerolen symlink volser
+check_PROGRAMS = label disk zerolen symlink volser flags
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
LDADD = \
@@ -24,6 +25,7 @@ disk_SOURCES = common.h common.c disk.c
zerolen_SOURCES = common.h common.c zerolen.c
symlink_SOURCES = common.h common.c symlink.c
volser_SOURCES = common.h common.c volser.c
+flags_SOURCES = common.h common.c flags.c
# Arrange to symlink to tests/init.sh.
CLEANFILES = init.sh
diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c
new file mode 100644
index 0000000..c83a361
--- /dev/null
+++ b/libparted/tests/flags.c
@@ -0,0 +1,81 @@
+#include <config.h>
+#include <unistd.h>
+
+#include <check.h>
+
+#include <parted/parted.h>
+
+#include "common.h"
+#include "progname.h"
+
+#define STREQ(a, b) (strcmp (a, b) == 0)
+
+static char* temporary_disk;
+
+static void
+create_disk (void)
+{
+ temporary_disk = _create_disk (80 * 1024 * 1024);
+ fail_if (temporary_disk == NULL, "Failed to create temporary disk");
+}
+
+static void
+destroy_disk (void)
+{
+ unlink (temporary_disk);
+ free (temporary_disk);
+}
+
+/* TEST: Test partition type flag on gpt disklabel */
+START_TEST (test_gpt_flag)
+{
+ PedDevice* dev = ped_device_get (temporary_disk);
+ if (dev == NULL)
+ return;
+
+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("gpt"));
+ PedConstraint *constraint = ped_constraint_any (dev);
+ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL,
+ ped_file_system_type_get("ext4"), 2048, 4096);
+ ped_partition_set_flag(part, PED_PARTITION_BIOS_GRUB, 1);
+ // Type should remain set to BIOS_GRUB
+ ped_partition_set_system(part, ped_file_system_type_get("ext4"));
+
+ ped_disk_add_partition (disk, part, constraint);
+ ped_disk_commit (disk);
+ ped_constraint_destroy (constraint);
+
+ // Check flag to confirm it is still set
+ part = ped_disk_get_partition (disk, 1);
+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BIOS_GRUB) != 1, "BIOS_GRUB flag not set");
+
+ ped_disk_destroy (disk);
+ ped_device_destroy (dev);
+}
+END_TEST
+
+int
+main (int argc, char **argv)
+{
+ set_program_name (argv[0]);
+ int number_failed;
+ Suite* suite = suite_create ("Partition Flags");
+ TCase* tcase_gpt = tcase_create ("GPT");
+
+ /* Fail when an exception is raised */
+ ped_exception_set_handler (_test_exception_handler);
+
+ tcase_add_checked_fixture (tcase_gpt, create_disk, destroy_disk);
+ tcase_add_test (tcase_gpt, test_gpt_flag);
+ /* Disable timeout for this test */
+ tcase_set_timeout (tcase_gpt, 0);
+ suite_add_tcase (suite, tcase_gpt);
+
+ SRunner* srunner = srunner_create (suite);
+ srunner_run_all (srunner, CK_VERBOSE);
+
+ number_failed = srunner_ntests_failed (srunner);
+ srunner_free (srunner);
+
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
diff --git a/libparted/tests/t1001-flags.sh b/libparted/tests/t1001-flags.sh
new file mode 100755
index 0000000..60a6248
--- /dev/null
+++ b/libparted/tests/t1001-flags.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# run the flags unittest
+
+# Copyright (C) 2007-2014, 2019-2022 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. "${top_srcdir=../..}/tests/init.sh"; path_prepend_ .
+
+flags || fail=1
+
+Exit $fail
--
2.37.1

View File

@ -1,29 +0,0 @@
From 8c50fec522f475c51e2aaa3c972ce4c6690dda92 Mon Sep 17 00:00:00 2001
From: Max Campbell <max@0m.ax>
Date: Thu, 12 Dec 2019 16:54:29 +0100
Subject: [PATCH 08/12] Removed reference to ped_file_system_create
Removed a reference to the removed function ped_file_system_create in
the docs for ped_file_system_clobber.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/r/filesys.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/libparted/fs/r/filesys.c b/libparted/fs/r/filesys.c
index d57447c..dd316aa 100644
--- a/libparted/fs/r/filesys.c
+++ b/libparted/fs/r/filesys.c
@@ -213,8 +213,6 @@ error_close_dev:
* file system occupies a given region described by \p geom.
* After this operation ped_file_system_probe() won't detect any file system.
*
- * \note ped_file_system_create() calls this before creating a new file system.
- *
* \return \c 1 on success, \c 0 on failure
*/
static int
--
2.26.2

View File

@ -0,0 +1,109 @@
From d37d5e7a9470bb5bf8446f79f8e9c508366e06b6 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 8 Aug 2022 15:02:30 -0700
Subject: [PATCH 8/9] libparted: Fix handling of msdos partition types
This restores the previous behavior by testing the partition type
against the list of known types and skipping the filesystem type reset.
Now the sequence of:
ped_partition_new(...)
ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1);
ped_partition_set_system(part, ped_file_system_type_get("ext4"));
Will keep the type set to PED_PARTITION_BLS_BOOT, which is how it used
to behave.
---
libparted/labels/dos.c | 54 +++++++++++++++++++++++++++++++++++-------
1 file changed, 46 insertions(+), 8 deletions(-)
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index bd7465d..4359276 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -121,6 +121,22 @@ static const struct flag_id_mapping_t flag_id_mapping[] =
{ PED_PARTITION_SWAP, PARTITION_LINUX_SWAP },
};
+static const unsigned char skip_set_system_types[] =
+{
+ PARTITION_EXT_LBA,
+ PARTITION_DOS_EXT,
+ PARTITION_COMPAQ_DIAG,
+ PARTITION_MSFT_RECOVERY,
+ PARTITION_LINUX_LVM,
+ PARTITION_LINUX_SWAP,
+ PARTITION_LINUX_RAID,
+ PARTITION_PALO,
+ PARTITION_PREP,
+ PARTITION_IRST,
+ PARTITION_ESP,
+ PARTITION_BLS_BOOT
+};
+
static const struct flag_id_mapping_t* _GL_ATTRIBUTE_CONST
dos_find_flag_id_mapping (PedPartitionFlag flag)
{
@@ -1540,6 +1556,21 @@ msdos_partition_destroy (PedPartition* part)
free (part);
}
+/* is_skip_type checks the type against the list of types that should not be
+ * overridden by set_system. It returns a 1 if it is in the list.
+*/
+static bool
+is_skip_type(unsigned char type_id) {
+ int n = sizeof(skip_set_system_types) / sizeof(skip_set_system_types[0]);
+ for (int i = 0; i < n; ++i) {
+ if (type_id == skip_set_system_types[i]) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
static int
msdos_partition_set_system (PedPartition* part,
const PedFileSystemType* fs_type)
@@ -1548,6 +1579,11 @@ msdos_partition_set_system (PedPartition* part,
part->fs_type = fs_type;
+ // Is this a type that should skip fs_type checking?
+ if (is_skip_type(dos_data->system)) {
+ return 1;
+ }
+
if (part->type & PED_PARTITION_EXTENDED) {
dos_data->system = PARTITION_EXT_LBA;
return 1;
@@ -1590,15 +1626,17 @@ msdos_partition_set_flag (PedPartition* part,
const struct flag_id_mapping_t* p = dos_find_flag_id_mapping (flag);
if (p)
{
- if (part->type & PED_PARTITION_EXTENDED)
- return 0;
-
- if (state)
- dos_data->system = p->type_id;
- else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id)
- return ped_partition_set_system (part, part->fs_type);
+ if (part->type & PED_PARTITION_EXTENDED)
+ return 0;
- return 1;
+ if (state) {
+ dos_data->system = p->type_id;
+ } else if (dos_data->system == p->type_id || dos_data->system == p->alt_type_id) {
+ // Clear the type so that fs_type will be used to return it to the default
+ dos_data->system = PARTITION_LINUX;
+ return ped_partition_set_system (part, part->fs_type);
+ }
+ return 1;
}
switch (flag) {
--
2.37.1

View File

@ -1,201 +0,0 @@
From c6b61814cd4cf958e12d35a36184ff7d767e57d9 Mon Sep 17 00:00:00 2001
From: Romain Perier <romain.perier@gmail.com>
Date: Fri, 20 Mar 2020 17:43:16 +0100
Subject: [PATCH 09/12] Add support for the F2FS filesystem
This adds a basic support for the Flash-Friendly File System. So
we can manipulate the file system by using the PedFileSystem API and we
can do basic device probing for autodetecting the current fs.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/Makefile.am | 2 ++
libparted/fs/f2fs/f2fs.c | 60 ++++++++++++++++++++++++++++++++++++++++
libparted/fs/f2fs/f2fs.h | 57 ++++++++++++++++++++++++++++++++++++++
libparted/libparted.c | 4 +++
4 files changed, 123 insertions(+)
create mode 100644 libparted/fs/f2fs/f2fs.c
create mode 100644 libparted/fs/f2fs/f2fs.h
diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am
index 74f275a..e40eee8 100644
--- a/libparted/fs/Makefile.am
+++ b/libparted/fs/Makefile.am
@@ -32,6 +32,8 @@ libfs_la_SOURCES = \
fat/count.h \
fat/fat.c \
fat/fat.h \
+ f2fs/f2fs.c \
+ f2fs/f2fs.h \
hfs/hfs.c \
hfs/hfs.h \
hfs/probe.c \
diff --git a/libparted/fs/f2fs/f2fs.c b/libparted/fs/f2fs/f2fs.c
new file mode 100644
index 0000000..64883e9
--- /dev/null
+++ b/libparted/fs/f2fs/f2fs.c
@@ -0,0 +1,60 @@
+/*
+ libparted/fs/f2fs - Flash-Friendly File System
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
+
+#include <parted/parted.h>
+#include <parted/endian.h>
+
+#include "f2fs.h"
+
+static PedGeometry*
+f2fs_probe (PedGeometry* geom)
+{
+ struct f2fs_super_block *sb = alloca(geom->dev->sector_size);
+
+ if (!ped_geometry_read (geom, sb, F2FS_SB_OFFSET, 1))
+ return NULL;
+
+ if (PED_LE32_TO_CPU(sb->magic) == F2FS_MAGIC)
+ return ped_geometry_new (geom->dev, geom->start, geom->length);
+
+ return NULL;
+}
+
+static PedFileSystemOps f2fs_ops = {
+ probe: f2fs_probe,
+};
+
+static PedFileSystemType f2fs_type = {
+ next: NULL,
+ ops: &f2fs_ops,
+ name: "f2fs",
+};
+
+void
+ped_file_system_f2fs_init ()
+{
+ ped_file_system_type_register (&f2fs_type);
+}
+
+void
+ped_file_system_f2fs_done ()
+{
+ ped_file_system_type_unregister (&f2fs_type);
+}
diff --git a/libparted/fs/f2fs/f2fs.h b/libparted/fs/f2fs/f2fs.h
new file mode 100644
index 0000000..c96b88f
--- /dev/null
+++ b/libparted/fs/f2fs/f2fs.h
@@ -0,0 +1,57 @@
+/*
+ libparted/fs/f2fs - Flash-Friendly File System
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef _F2FS_H
+#define _F2FS_H
+
+#define F2FS_MAGIC 0xF2F52010
+#define F2FS_MAX_VOLUME_NAME 512
+#define F2FS_SB_OFFSET 0x02
+
+struct f2fs_super_block {
+ uint32_t magic; /* Magic Number */
+ uint16_t major_ver; /* Major Version */
+ uint16_t minor_ver; /* Minor Version */
+ uint32_t log_sectorsize; /* log2 sector size in bytes */
+ uint32_t log_sectors_per_block; /* log2 # of sectors per block */
+ uint32_t log_blocksize; /* log2 block size in bytes */
+ uint32_t log_blocks_per_seg; /* log2 # of blocks per segment */
+ uint32_t segs_per_sec; /* # of segments per section */
+ uint32_t secs_per_zone; /* # of sections per zone */
+ uint32_t checksum_offset; /* checksum offset inside super block */
+ uint64_t block_count; /* total # of user blocks */
+ uint32_t section_count; /* total # of sections */
+ uint32_t segment_count; /* total # of segments */
+ uint32_t segment_count_ckpt; /* # of segments for checkpoint */
+ uint32_t segment_count_sit; /* # of segments for SIT */
+ uint32_t segment_count_nat; /* # of segments for NAT */
+ uint32_t segment_count_ssa; /* # of segments for SSA */
+ uint32_t segment_count_main; /* # of segments for main area */
+ uint32_t segment0_blkaddr; /* start block address of segment 0 */
+ uint32_t cp_blkaddr; /* start block address of checkpoint */
+ uint32_t sit_blkaddr; /* start block address of SIT */
+ uint32_t nat_blkaddr; /* start block address of NAT */
+ uint32_t ssa_blkaddr; /* start block address of SSA */
+ uint32_t main_blkaddr; /* start block address of main area */
+ uint32_t root_ino; /* root inode number */
+ uint32_t node_ino; /* node inode number */
+ uint32_t meta_ino; /* meta inode number */
+ uint8_t uuid[16]; /* 128-bit uuid for volume */
+ uint16_t volume_name[F2FS_MAX_VOLUME_NAME]; /* volume name */
+} __attribute__((packed));
+
+#endif
diff --git a/libparted/libparted.c b/libparted/libparted.c
index 00f5ff8..4a57a80 100644
--- a/libparted/libparted.c
+++ b/libparted/libparted.c
@@ -109,6 +109,7 @@ extern void ped_file_system_linux_swap_init (void);
extern void ped_file_system_jfs_init (void);
extern void ped_file_system_hfs_init (void);
extern void ped_file_system_fat_init (void);
+extern void ped_file_system_f2fs_init (void);
extern void ped_file_system_ext2_init (void);
extern void ped_file_system_nilfs2_init (void);
extern void ped_file_system_btrfs_init (void);
@@ -126,6 +127,7 @@ init_file_system_types ()
ped_file_system_jfs_init ();
ped_file_system_hfs_init ();
ped_file_system_fat_init ();
+ ped_file_system_f2fs_init ();
ped_file_system_ext2_init ();
ped_file_system_nilfs2_init ();
ped_file_system_btrfs_init ();
@@ -186,6 +188,7 @@ _init()
extern void ped_file_system_nilfs2_done (void);
extern void ped_file_system_ext2_done (void);
extern void ped_file_system_fat_done (void);
+extern void ped_file_system_f2fs_done (void);
extern void ped_file_system_hfs_done (void);
extern void ped_file_system_jfs_done (void);
extern void ped_file_system_linux_swap_done (void);
@@ -202,6 +205,7 @@ done_file_system_types ()
{
ped_file_system_nilfs2_done ();
ped_file_system_ext2_done ();
+ ped_file_system_f2fs_done ();
ped_file_system_fat_done ();
ped_file_system_hfs_done ();
ped_file_system_jfs_done ();
--
2.26.2

View File

@ -0,0 +1,75 @@
From 3deaae7a19ebfbc2dad6ad67ba65409e7238efc8 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 8 Aug 2022 15:06:03 -0700
Subject: [PATCH 9/9] tests: Add a libparted test for ped_partition_set_system
on msdos
Test the libparted API to make sure the flag is not cleared by calling
ped_partition_set_system.
---
libparted/tests/flags.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/libparted/tests/flags.c b/libparted/tests/flags.c
index c83a361..c4b290b 100644
--- a/libparted/tests/flags.c
+++ b/libparted/tests/flags.c
@@ -54,6 +54,34 @@ START_TEST (test_gpt_flag)
}
END_TEST
+/* TEST: Test partition type flag on msdos disklabel */
+START_TEST (test_msdos_flag)
+{
+ PedDevice* dev = ped_device_get (temporary_disk);
+ if (dev == NULL)
+ return;
+
+ PedDisk* disk = ped_disk_new_fresh (dev, ped_disk_type_get ("msdos"));
+ PedConstraint *constraint = ped_constraint_any (dev);
+ PedPartition *part = ped_partition_new (disk, PED_PARTITION_NORMAL,
+ ped_file_system_type_get("ext4"), 2048, 4096);
+ ped_partition_set_flag(part, PED_PARTITION_BLS_BOOT, 1);
+ // Type should remain set to BIOS_GRUB
+ ped_partition_set_system(part, ped_file_system_type_get("ext4"));
+
+ ped_disk_add_partition (disk, part, constraint);
+ ped_disk_commit (disk);
+ ped_constraint_destroy (constraint);
+
+ // Check flag to confirm it is still set
+ part = ped_disk_get_partition (disk, 1);
+ fail_if (ped_partition_get_flag(part, PED_PARTITION_BLS_BOOT) != 1, "BLS_BOOT flag not set");
+
+ ped_disk_destroy (disk);
+ ped_device_destroy (dev);
+}
+END_TEST
+
int
main (int argc, char **argv)
{
@@ -61,6 +89,7 @@ main (int argc, char **argv)
int number_failed;
Suite* suite = suite_create ("Partition Flags");
TCase* tcase_gpt = tcase_create ("GPT");
+ TCase* tcase_msdos = tcase_create ("MSDOS");
/* Fail when an exception is raised */
ped_exception_set_handler (_test_exception_handler);
@@ -71,6 +100,12 @@ main (int argc, char **argv)
tcase_set_timeout (tcase_gpt, 0);
suite_add_tcase (suite, tcase_gpt);
+ tcase_add_checked_fixture (tcase_msdos, create_disk, destroy_disk);
+ tcase_add_test (tcase_msdos, test_msdos_flag);
+ /* Disable timeout for this test */
+ tcase_set_timeout (tcase_msdos, 0);
+ suite_add_tcase (suite, tcase_msdos);
+
SRunner* srunner = srunner_create (suite);
srunner_run_all (srunner, CK_VERBOSE);
--
2.37.1

View File

@ -1,27 +0,0 @@
From eaada0bc9e1cc8adb3a0260707d9474a3e01b835 Mon Sep 17 00:00:00 2001
From: Romain Perier <romain.perier@gmail.com>
Date: Fri, 20 Mar 2020 17:43:17 +0100
Subject: [PATCH 10/12] tests: Add f2fs to the fs probe test
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
tests/t1700-probe-fs.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
index 1fe3309..9150a37 100755
--- a/tests/t1700-probe-fs.sh
+++ b/tests/t1700-probe-fs.sh
@@ -23,7 +23,7 @@ dev=loop-file
ss=$sector_size_
n_sectors=$((512*1024))
-for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf; do
+for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus udf f2fs; do
( mkfs.$type 2>&1 | grep -i '^usage' ) > /dev/null \
|| { warn_ "$ME: no $type support"; continue; }
--
2.26.2

View File

@ -1,53 +0,0 @@
From 691dabc930a6d544dfd8da787cddd159bab34b1e Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 31 Aug 2020 16:40:07 -0700
Subject: [PATCH 11/12] parted: Preserve resizepart End when prompted for busy
partition
Resizing busy partitions is allowed, but the user is prompted, which
erases the cmdline. It is annoying to have to re-end the ending location
after answering Yes. This saves the word and pushes it back onto the
cmdline after the user agrees to resize the busy partition.
---
parted/parted.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/parted/parted.c b/parted/parted.c
index df0c7ed..dbd38d0 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1546,6 +1546,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
PedConstraint* constraint;
int rc = 0;
char* end_input = NULL;
+ char* end_size = NULL;
if (!disk) {
disk = ped_disk_new (*dev);
@@ -1561,9 +1562,23 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
if (!command_line_get_partition (_("Partition number?"), disk, &part))
goto error;
+
+ /* Save the optional End value if the partition is busy. */
+ if (ped_partition_is_busy(part)) {
+ if (command_line_get_word_count())
+ end_size = command_line_pop_word();
+ }
+
+ /* If the partition is busy this may clear the command_line and prompt the user */
if (!_partition_warn_busy (part))
goto error;
+ /* Push the End value back onto the command_line, if it exists */
+ if (end_size) {
+ command_line_push_word(end_size);
+ free(end_size);
+ }
+
start = part->geom.start;
end = oldend = part->geom.end;
if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
--
2.26.2

View File

@ -1,85 +0,0 @@
From dfc611bd5126840d68493ad0e761511a71325af7 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 1 Sep 2020 14:51:54 -0700
Subject: [PATCH 12/12] tests: Add a test for resizepart on a busy partition
This makes sure that the resizepart on a busy partition with the size on
the cmdline will work.
---
tests/t3200-resize-partition.sh | 44 ++++++++++++++++++++++++++++++---
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/tests/t3200-resize-partition.sh b/tests/t3200-resize-partition.sh
index 06dbe68..2200977 100755
--- a/tests/t3200-resize-partition.sh
+++ b/tests/t3200-resize-partition.sh
@@ -2,7 +2,7 @@
# exercise the resize sub-command
# based on t3000-resize-fs.sh test
-# Copyright (C) 2009-2011, 2019 Free Software Foundation, Inc.
+# Copyright (C) 2009-2020 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -66,8 +66,8 @@ sleep 1
# Running it without end should not core-dump or prompt
parted -s $dev resizepart 1 > out 2> err || fail=1
-# extend the filesystem to end on sector 4096
-new_end=4096s
+# extend the filesystem to end on sector 2048
+new_end=2048s
parted -s $dev resizepart 1 $new_end > out 2> err || fail=1
# expect no output
compare /dev/null out || fail=1
@@ -77,9 +77,45 @@ compare /dev/null err || fail=1
parted -m -s $dev u s p > out 2>&1 || fail=1
sed -n 3p out > k && mv k out || fail=1
-printf "1:$default_start:$new_end:3073s:::$ms;\n" > exp || fail=1
+printf "1:$default_start:$new_end:1025s:::$ms;\n" > exp || fail=1
compare exp out || fail=1
+## Make sure resizing a busy partition works when user answers 'yes'
+# Format the partition and mount it for the busy check
+mkfs.ext4 "${dev}1" || skip_ mkfs.ext4 failed
+
+# be sure to unmount upon interrupt, failure, etc.
+cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; }
+
+mount_point=$(pwd)/mnt
+
+mkdir $mount_point || fail=1
+mount "${dev}1" "$mount_point" || fail=1
+
+# extend the filesystem to end on sector 4096
+new_end=4096s
+echo yes | parted ---pretend-input-tty $dev resizepart 1 $new_end > out 2>&1
+cat > exp <<EOF
+Warning: Partition ${dev}1 is being used. Are you sure you want to continue?
+Yes/No? yes
+Information: You may need to update /etc/fstab.
+
+EOF
+# Transform the actual output, to avoid spurious differences when
+# $PWD contains a symlink-to-dir. Also, remove the ^M ...^M bogosity.
+# normalize the actual output
+mv out o2 && sed -e "s, * ,,g;s, $,," o2 > out
+compare exp out || fail=1
+
+# print partition table
+parted -m -s $dev u s p > out 2>&1 || fail=1
+
+sed -n 3p out > k && mv k out || fail=1
+printf "1:$default_start:$new_end:3073s:ext2::$ms;\n" > exp || fail=1
+compare exp out || fail=1
+
+umount "${dev}1" || fail=1
+
# Remove the partition explicitly, so that mklabel doesn't evoke a warning.
parted -s $dev rm 1 || fail=1
--
2.26.2

View File

@ -1,143 +0,0 @@
From 2a2e05f09be4dd350bc91747f03378e7c534265d Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Tue, 3 Nov 2020 15:06:34 +0100
Subject: [PATCH] Do not link to libsepol or libselinux
Given that there's no code which would use it there's no reason to link
to libsepol or libselinux even when they are available.
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
AUTHORS | 8 ++++----
configure.ac | 12 ------------
libparted/Makefile.am | 1 -
parted.spec.in | 15 ++-------------
4 files changed, 6 insertions(+), 30 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 530a28b..8119934 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -72,7 +72,7 @@ Matthew Wilson <msw@redhat.com>
* Don't detect AIX physical volumes as msdos partition tables
* Code for manipulating AIX PVs
-Martin von Löwis <martin@mira.isdn.cs.tu-berlin.de>
+Martin von Löwis <martin@mira.isdn.cs.tu-berlin.de>
* German translations
Baty Jean-Marc <baty@club-internet.fr>
@@ -113,7 +113,7 @@ Ben Collins <bcollins@debian.org>
* Sun disk label support (libparted/disk_sun.c)
* stubs for UFS
-Vincent Stelhé <vincent.stelhe@free.fr>
+Vincent Stelhé <vincent.stelhe@free.fr>
* move syntax patch (make END specification optional). Trivial
for copyright purposes (no disclaimer needed)
@@ -132,7 +132,7 @@ Matt Domsch <Matt_Domsch@dell.com>
Kjetil Torgrim Homme <kjetilho@linpro.no>
* Norweigen translations
-Jörgen Tegnér <jorgen.tegner@telia.com>
+Jörgen Tegnér <jorgen.tegner@telia.com>
* Swedish translations
Keld Simonsen <keld@dkuug.dk>
@@ -153,7 +153,7 @@ Vicente E. Llorens <vllorens@mundofree.com>
Yury Umanets <torque@ukrpost.net>
* basis of libparted/fs_reiserfs
-Bernardo João Torres da Silveira
+Bernardo João Torres da Silveira
<bernardojts@ig.com.br>
* pt_BR translation of FAQ and parted.texi
diff --git a/configure.ac b/configure.ac
index c46a3ff..ef78600 100644
--- a/configure.ac
+++ b/configure.ac
@@ -89,11 +89,6 @@ if test $ENABLE_DEVICE_MAPPER = yes; then
1, [device mapper (libdevmapper) support])
fi
-AC_ARG_ENABLE([selinux],
- [ --enable-selinux enable SELinux support [default=no]], ,
- enable_selinux=no
-)
-
AC_ARG_ENABLE([discover-only],
[ --enable-discover-only support only reading/probing [default=no]], ,
enable_discover_only=no
@@ -320,13 +315,6 @@ package as well (it may be called device-mapper-devel or something similar).]
fi
AC_SUBST([DM_LIBS])
-dnl Check for SELinux
-SELINUX_LIBS=""
-if test "$enable_selinux" = yes; then
- SELINUX_LIBS="-lselinux -lsepol"
-fi
-AC_SUBST([SELINUX_LIBS])
-
dnl Check for termcap
if test "$with_readline" = yes; then
OLD_LIBS="$LIBS"
diff --git a/libparted/Makefile.am b/libparted/Makefile.am
index bcdde77..e52aa2a 100644
--- a/libparted/Makefile.am
+++ b/libparted/Makefile.am
@@ -55,7 +55,6 @@ libparted_la_LIBADD = \
$(top_builddir)/lib/libgnulib.la \
$(OS_LIBS) \
$(DM_LIBS) \
- $(SELINUX_LIBS) \
$(LIB_BLKID) \
$(UUID_LIBS) \
$(INTLLIBS)
diff --git a/parted.spec.in b/parted.spec.in
index bdbe218..d0e2b11 100644
--- a/parted.spec.in
+++ b/parted.spec.in
@@ -1,15 +1,9 @@
-# Default to disabling device-mapper and SELinux
+# Default to disabling device-mapper
%define use_devmapper 0
-%define use_selinux 0
-%define use_sepol 0
# Enable device-mapper support if we find devmapper
%define use_devmapper %(pkg-config --libs devmapper >/dev/null 2>&1; [ $? -eq 0 ] && echo 1)
-# Enable SELinux if we find libselinux and libsepol
-%define use_selinux %([ -r %{_libdir}/libselinux.a ] && echo 1)
-%define use_sepol %([ -r %{_libdir}/libsepol.so ] && echo 1)
-
Summary: The GNU disk partition manipulation program
Name: @PACKAGE@
Version: @VERSION@
@@ -22,7 +16,7 @@ Group: Applications/System
BuildRequires: e2fsprogs-devel readline-devel ncurses-devel gperf
BuildRequires: automake libtool gettext-devel texinfo pkgconfig
-BuildRequires: device-mapper-devel, libselinux-devel libsepol-devel
+BuildRequires: device-mapper-devel
Prereq: /sbin/install-info
@@ -52,11 +46,6 @@ Parted library, you need to install this package.
--enable-device-mapper \
%else
--disable-devmapper \
-%endif
-%if "%{use_selinux}" == "1" && "%{use_sepol}" == "1"
- --enable-selinux \
-%else
- --disable-selinux \
%endif
--enable-part-static \
--enable-pc98=no \
--
2.26.2

View File

@ -1,30 +0,0 @@
From 0eef2b04caad4a7b251ecf5e1c58ad33582da6e5 Mon Sep 17 00:00:00 2001
From: Joe Slater <joe.slater@windriver.com>
Date: Thu, 20 Jun 2019 14:33:04 -0700
Subject: [PATCH 14/42] t6001-psep: modify device manage support detection
Use the method other tests use -- test an environment variable.
Signed-off-by: Joe Slater <joe.slater@windriver.com>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
tests/t6001-psep.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh
index e350bd2..73f2d1c 100644
--- a/tests/t6001-psep.sh
+++ b/tests/t6001-psep.sh
@@ -21,7 +21,8 @@
require_root_
require_udevadm_settle_
-(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
# Device maps names - should be random to not conflict with existing ones on
# the system
--
2.26.2

View File

@ -1,59 +0,0 @@
From 04ca93351a4e25c35562ef705b3d96c3743609ff Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 25 Jun 2019 09:37:32 -0700
Subject: [PATCH 15/42] tests: Update all the dmsetup tests to use
ENABLE_DEVICE_MAPPER
---
tests/t6004-dm-many-partitions.sh | 4 +++-
tests/t6005-dm-uuid.sh | 4 +++-
tests/t6006-dm-512b-sectors.sh | 3 ++-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/tests/t6004-dm-many-partitions.sh b/tests/t6004-dm-many-partitions.sh
index b4be975..636c837 100755
--- a/tests/t6004-dm-many-partitions.sh
+++ b/tests/t6004-dm-many-partitions.sh
@@ -21,7 +21,9 @@
require_root_
require_udevadm_settle_
-(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
ss=$sector_size_
ns=300
diff --git a/tests/t6005-dm-uuid.sh b/tests/t6005-dm-uuid.sh
index 4266747..790c23f 100755
--- a/tests/t6005-dm-uuid.sh
+++ b/tests/t6005-dm-uuid.sh
@@ -21,7 +21,9 @@
require_root_
require_udevadm_settle_
-(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
+
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
ss=$sector_size_
ns=300
diff --git a/tests/t6006-dm-512b-sectors.sh b/tests/t6006-dm-512b-sectors.sh
index bf32135..c0de382 100644
--- a/tests/t6006-dm-512b-sectors.sh
+++ b/tests/t6006-dm-512b-sectors.sh
@@ -25,7 +25,8 @@ require_scsi_debug_module_
grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null ||
skip_ 'this system lacks a new-enough libblkid'
-(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed"
+test "x$ENABLE_DEVICE_MAPPER" = xyes \
+ || skip_ "no device-mapper support"
# Device maps names - should be random to not conflict with existing ones on
# the system
--
2.26.2

View File

@ -1,51 +0,0 @@
From f75af2cfbbd1a2d82ed3df4955014f73737ae13e Mon Sep 17 00:00:00 2001
From: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Date: Wed, 14 Aug 2019 10:59:18 +0900
Subject: [PATCH 16/42] libparted: Fix a GCC warning -Wunused-but-set-variable
GCC warns that a variable 'prealloc' defined for _generic_affs_probe() in
fs/amiga/affs.c is set but its value is never used.
CC amiga/affs.lo
amiga/affs.c: In function '_generic_affs_probe':
amiga/affs.c:54:35: warning: variable 'prealloc' set but not used [-Wunused-but-set-variable]
54 | int blocksize = 1, reserved = 2, prealloc = 0;
| ^~~~~~~~
Remove the variable for simplicity and to avoid the warning.
Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/amiga/affs.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/libparted/fs/amiga/affs.c b/libparted/fs/amiga/affs.c
index 1fde17c..e7c2e47 100644
--- a/libparted/fs/amiga/affs.c
+++ b/libparted/fs/amiga/affs.c
@@ -52,20 +52,19 @@ _generic_affs_probe (PedGeometry* geom, uint32_t kind)
uint32_t *block;
PedSector root, len, pos;
struct PartitionBlock * part;
- int blocksize = 1, reserved = 2, prealloc = 0;
+ int blocksize = 1, reserved = 2;
PED_ASSERT (geom != NULL);
PED_ASSERT (geom->dev != NULL);
if (geom->dev->sector_size != 512)
return NULL;
- /* Finds the blocksize, prealloc and reserved values of the partition block */
+ /* Finds the blocksize and reserved values of the partition block */
if (!(part = ped_malloc (PED_SECTOR_SIZE_DEFAULT*blocksize))) {
ped_exception_throw(PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("%s : Failed to allocate partition block\n"), __func__);
goto error_part;
}
if (amiga_find_part(geom, part) != NULL) {
- prealloc = PED_BE32_TO_CPU (part->de_PreAlloc);
reserved = PED_BE32_TO_CPU (part->de_Reserved);
reserved = reserved == 0 ? 1 : reserved;
blocksize = PED_BE32_TO_CPU (part->de_SizeBlock)
--
2.26.2

View File

@ -1,67 +0,0 @@
From d51921b05c32287238b1b0447d7e952884f63eb5 Mon Sep 17 00:00:00 2001
From: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Date: Wed, 14 Aug 2019 10:59:19 +0900
Subject: [PATCH 17/42] libparted: Fix warnings from GCC 8 -Wunused-variable
and -Warray-bounds
GCC 8 reports two warnings as follows.
r/fat/bootsector.c: In function 'fat_boot_sector_set_boot_code':
r/fat/bootsector.c:274:15: warning: unused variable 'fs_info' [-Wunused-variable]
FatSpecific* fs_info = FAT_SPECIFIC (fs);
^~~~~~~
In function 'memcpy',
inlined from 'fat_boot_sector_set_boot_code' at r/fat/bootsector.c:283:2:
/usr/include/bits/string_fortified.h:34:10: warning: '__builtin_memcpy' forming offset [126, 128] is out of the bounds [0, 125] [-Warray-bounds]
return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To avoid the warnings, remove the unused variable. Use strcpy in place of
memcpy checking copy length.
Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/r/fat/bootsector.c | 5 ++---
libparted/fs/r/fat/bootsector.h | 2 --
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/libparted/fs/r/fat/bootsector.c b/libparted/fs/r/fat/bootsector.c
index 46d5926..9130900 100644
--- a/libparted/fs/r/fat/bootsector.c
+++ b/libparted/fs/r/fat/bootsector.c
@@ -271,8 +271,6 @@ fat_boot_sector_analyse (FatBootSector* bs, PedFileSystem* fs)
int
fat_boot_sector_set_boot_code (FatBootSector** bsp, const PedFileSystem* fs)
{
- FatSpecific* fs_info = FAT_SPECIFIC (fs);
-
PED_ASSERT (bsp != NULL);
*bsp = ped_malloc (fs->geom->dev->sector_size);
FatBootSector *bs = *bsp;
@@ -280,7 +278,8 @@ fat_boot_sector_set_boot_code (FatBootSector** bsp, const PedFileSystem* fs)
memset (bs, 0, 512);
memcpy (bs->boot_jump, FAT_BOOT_JUMP, 3);
- memcpy (bs->u.fat32.boot_code, FAT_BOOT_CODE, FAT_BOOT_CODE_LENGTH);
+ PED_ASSERT (sizeof(FAT_BOOT_CODE) < sizeof(bs->u.fat32.boot_code));
+ strcpy (bs->u.fat32.boot_code, FAT_BOOT_CODE);
return 1;
}
diff --git a/libparted/fs/r/fat/bootsector.h b/libparted/fs/r/fat/bootsector.h
index 6b0363f..42fc3f2 100644
--- a/libparted/fs/r/fat/bootsector.h
+++ b/libparted/fs/r/fat/bootsector.h
@@ -57,8 +57,6 @@ typedef struct _FatInfoSector FatInfoSector;
/* message: */ \
FAT_BOOT_MESSAGE
-#define FAT_BOOT_CODE_LENGTH 128
-
struct __attribute__ ((packed)) _FatBootSector {
uint8_t boot_jump[3]; /* 00: Boot strap short or near jump */
uint8_t system_id[8]; /* 03: system name */
--
2.26.2

View File

@ -1,44 +0,0 @@
From 5449d1b1ee763e8ae1057fb7d18f7fbccb7a6fe0 Mon Sep 17 00:00:00 2001
From: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Date: Wed, 14 Aug 2019 10:59:17 +0900
Subject: [PATCH 18/42] libparted: Fix warnings from GCC's
-Wimplicit-fallthrough
Two case statements have intentional fall-throughs but do not have
comments to note it. GCC detects and warns those case statements. To
avoid the warning, add fall-through comments.
Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/amiga/amiga.c | 1 +
libparted/fs/r/hfs/reloc.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/libparted/fs/amiga/amiga.c b/libparted/fs/amiga/amiga.c
index be10dae..eb63f24 100644
--- a/libparted/fs/amiga/amiga.c
+++ b/libparted/fs/amiga/amiga.c
@@ -217,6 +217,7 @@ _amiga_read_block (PedDevice *dev, struct AmigaBlock *blk, PedSector block, stru
return NULL;
}
}
+ /* FALLTHROUGH */
case PED_EXCEPTION_IGNORE :
case PED_EXCEPTION_UNHANDLED :
default :
diff --git a/libparted/fs/r/hfs/reloc.c b/libparted/fs/r/hfs/reloc.c
index 0b8ddc1..d0477ae 100644
--- a/libparted/fs/r/hfs/reloc.c
+++ b/libparted/fs/r/hfs/reloc.c
@@ -224,6 +224,7 @@ hfs_do_move (PedFileSystem* fs, unsigned int *ptr_src,
priv_data->catalog_file
->cache[ref->ref_index].start_block =
PED_CPU_TO_BE16(new_start);
+ /* FALLTHROUGH */
case CR_BTREE_EXT_0 :
file = priv_data->extent_file;
goto CR_BTREE;
--
2.26.2

View File

@ -1,61 +0,0 @@
From bed9c6a17ee82c87bf47981149e224f2e34baedb Mon Sep 17 00:00:00 2001
From: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Date: Wed, 14 Aug 2019 10:59:23 +0900
Subject: [PATCH 19/42] libparted: Avoid a GCC warning for unused functions
libparted/fs/r/hfs/hfs.c has a '#if 0' block. The block refers two
functions hfsplus_clobber() and hfs_clobber(). It have GCC report a
warning below.
CC r/hfs/hfs.lo
r/hfs/hfs.c:343:1: warning: 'hfsplus_clobber' defined but not used [-Wunused-function]
343 | hfsplus_clobber (PedGeometry* geom)
| ^~~~~~~~~~~~~~~
To avoid the warning, add two more '#if 0' to disable the two functions.
Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/r/hfs/hfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c
index 6be0390..0aababd 100644
--- a/libparted/fs/r/hfs/hfs.c
+++ b/libparted/fs/r/hfs/hfs.c
@@ -59,6 +59,7 @@ static PedFileSystemType hfsplus_type;
/* ----- HFS ----- */
+#if 0
/* This is a very unundoable operation */
/* Maybe I shouldn't touch the alternate MDB ? */
/* Anyway clobber is call before other fs creation */
@@ -78,6 +79,7 @@ hfs_clobber (PedGeometry* geom)
(!!ped_geometry_write (geom, buf, geom->length - 1, 1)) &
(!!ped_geometry_sync (geom));
}
+#endif
PedFileSystem *
hfs_open (PedGeometry* geom)
@@ -339,6 +341,7 @@ hfs_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer)
#include "reloc_plus.h"
#include "journal.h"
+#if 0
static int
hfsplus_clobber (PedGeometry* geom)
{
@@ -374,6 +377,7 @@ hfsplus_clobber (PedGeometry* geom)
/* non-embedded or envelop destroy as hfs */
return ( hfs_clobber (geom) && i );
}
+#endif
int
hfsplus_close (PedFileSystem *fs)
--
2.26.2

View File

@ -1,248 +0,0 @@
From 20c136159b37f11822b591941c077bb2be6ede05 Mon Sep 17 00:00:00 2001
From: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Date: Wed, 14 Aug 2019 10:59:21 +0900
Subject: [PATCH 20/42] libparted: Fix warnings from GCC 8
-Wsuggest-attribute=pure
As GCC 8 suggests, add 'pure' attribute to 17 functions. After adding
pure attributes, GCC suggested three more functions to add pure
attributes. Add pure attribute to those functions also. In total, add
pure attributes to 20 functions.
I read code of the functions and confirmed the 20 functions are pure:
they have no effect except the return value, and their return value
depend only on the parameters and/or global variables.
Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/fat/bootsector.c | 2 +-
libparted/fs/r/fat/bootsector.c | 2 +-
libparted/fs/r/fat/calc.c | 4 ++--
libparted/fs/r/fat/context.c | 4 ++--
libparted/fs/r/fat/count.c | 4 ++--
libparted/fs/r/fat/table.c | 2 +-
libparted/fs/r/fat/traverse.c | 14 +++++++-------
libparted/fs/r/hfs/advfs.c | 4 ++--
libparted/fs/r/hfs/advfs_plus.c | 4 ++--
9 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/libparted/fs/fat/bootsector.c b/libparted/fs/fat/bootsector.c
index 0c3ae77..2a03696 100644
--- a/libparted/fs/fat/bootsector.c
+++ b/libparted/fs/fat/bootsector.c
@@ -86,7 +86,7 @@ fat_boot_sector_read (FatBootSector** bsp, const PedGeometry *geom)
/*
Don't trust the FAT12, FAT16 or FAT32 label string.
*/
-FatType
+FatType _GL_ATTRIBUTE_PURE
fat_boot_sector_probe_type (const FatBootSector* bs, const PedGeometry* geom)
{
PedSector logical_sector_size;
diff --git a/libparted/fs/r/fat/bootsector.c b/libparted/fs/r/fat/bootsector.c
index 9130900..34134cc 100644
--- a/libparted/fs/r/fat/bootsector.c
+++ b/libparted/fs/r/fat/bootsector.c
@@ -85,7 +85,7 @@ fat_boot_sector_read (FatBootSector** bsp, const PedGeometry *geom)
/*
Don't trust the FAT12, FAT16 or FAT32 label string.
*/
-FatType
+FatType _GL_ATTRIBUTE_PURE
fat_boot_sector_probe_type (const FatBootSector* bs, const PedGeometry* geom)
{
PedSector logical_sector_size;
diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c
index e524007..60c6bac 100644
--- a/libparted/fs/r/fat/calc.c
+++ b/libparted/fs/r/fat/calc.c
@@ -314,7 +314,7 @@ fat_calc_resize_sizes (
friends, to allow room for this space. If too much of this space is left
over, everyone will complain, so we have to be greedy, and use it all up...
*/
-PedSector
+PedSector _GL_ATTRIBUTE_PURE
fat_calc_align_sectors (const PedFileSystem* new_fs,
const PedFileSystem* old_fs)
{
@@ -359,7 +359,7 @@ fat_calc_align_sectors (const PedFileSystem* new_fs,
return align;
}
-int
+int _GL_ATTRIBUTE_PURE
fat_is_sector_in_clusters (const PedFileSystem* fs, PedSector sector)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
diff --git a/libparted/fs/r/fat/context.c b/libparted/fs/r/fat/context.c
index 5c27d09..170094c 100644
--- a/libparted/fs/r/fat/context.c
+++ b/libparted/fs/r/fat/context.c
@@ -124,7 +124,7 @@ fat_op_context_destroy (FatOpContext* ctx)
free (ctx);
}
-FatFragment
+FatFragment _GL_ATTRIBUTE_PURE
fat_op_context_map_static_fragment (const FatOpContext* ctx, FatFragment frag)
{
FatSpecific* new_fs_info = FAT_SPECIFIC (ctx->new_fs);
@@ -160,7 +160,7 @@ fat_op_context_map_static_cluster (const FatOpContext* ctx, FatCluster clst)
return 0;
}
-FatFragment
+FatFragment _GL_ATTRIBUTE_PURE
fat_op_context_map_fragment (const FatOpContext* ctx, FatFragment frag)
{
return ctx->remap [frag];
diff --git a/libparted/fs/r/fat/count.c b/libparted/fs/r/fat/count.c
index 250e80d..2b65e72 100644
--- a/libparted/fs/r/fat/count.c
+++ b/libparted/fs/r/fat/count.c
@@ -338,7 +338,7 @@ fat_collect_cluster_info (PedFileSystem* fs) {
return 1;
}
-FatClusterFlag
+FatClusterFlag _GL_ATTRIBUTE_PURE
fat_get_cluster_flag (PedFileSystem* fs, FatCluster cluster)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -346,7 +346,7 @@ fat_get_cluster_flag (PedFileSystem* fs, FatCluster cluster)
return fs_info->cluster_info [cluster].flag;
}
-PedSector
+PedSector _GL_ATTRIBUTE_PURE
fat_get_cluster_usage (PedFileSystem* fs, FatCluster cluster)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
diff --git a/libparted/fs/r/fat/table.c b/libparted/fs/r/fat/table.c
index fe8e040..98b0499 100644
--- a/libparted/fs/r/fat/table.c
+++ b/libparted/fs/r/fat/table.c
@@ -371,7 +371,7 @@ fat_table_is_bad (const FatTable* ft, FatCluster cluster)
/*
returns true if <cluster> represents an EOF marker
*/
-int
+int _GL_ATTRIBUTE_PURE
fat_table_is_eof (const FatTable* ft, FatCluster cluster)
{
return _test_code_eof (ft, cluster);
diff --git a/libparted/fs/r/fat/traverse.c b/libparted/fs/r/fat/traverse.c
index fc8a795..50b94bd 100644
--- a/libparted/fs/r/fat/traverse.c
+++ b/libparted/fs/r/fat/traverse.c
@@ -31,7 +31,7 @@
static char tmp_buffer [4096];
-int
+int _GL_ATTRIBUTE_PURE
fat_traverse_entries_per_buffer (FatTraverseInfo* trav_info)
{
return trav_info->buffer_size / sizeof (FatDirEntry);
@@ -226,7 +226,7 @@ fat_traverse_next_dir_entry (FatTraverseInfo *trav_info)
return trav_info->dir_entries + trav_info->current_entry;
}
-FatCluster
+FatCluster _GL_ATTRIBUTE_PURE
fat_dir_entry_get_first_cluster (FatDirEntry* dir_entry, PedFileSystem *fs)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -269,7 +269,7 @@ fat_dir_entry_set_first_cluster (FatDirEntry* dir_entry, PedFileSystem* fs,
}
}
-uint32_t
+uint32_t _GL_ATTRIBUTE_PURE
fat_dir_entry_get_length (FatDirEntry* dir_entry)
{
return PED_LE32_TO_CPU (dir_entry->length);
@@ -284,7 +284,7 @@ fat_dir_entry_is_null_term (const FatDirEntry* dir_entry)
return memcmp (&null_entry, dir_entry, sizeof (null_entry)) == 0;
}
-int
+int _GL_ATTRIBUTE_PURE
fat_dir_entry_is_active (FatDirEntry* dir_entry)
{
if ((unsigned char) dir_entry->name[0] == DELETED_FLAG) return 0;
@@ -293,7 +293,7 @@ fat_dir_entry_is_active (FatDirEntry* dir_entry)
return 1;
}
-int
+int _GL_ATTRIBUTE_PURE
fat_dir_entry_is_file (FatDirEntry* dir_entry) {
if (dir_entry->attributes == VFAT_ATTR) return 0;
if (dir_entry->attributes & VOLUME_LABEL_ATTR) return 0;
@@ -302,7 +302,7 @@ fat_dir_entry_is_file (FatDirEntry* dir_entry) {
return 1;
}
-int
+int _GL_ATTRIBUTE_PURE
fat_dir_entry_is_system_file (FatDirEntry* dir_entry)
{
if (!fat_dir_entry_is_file (dir_entry)) return 0;
@@ -310,7 +310,7 @@ fat_dir_entry_is_system_file (FatDirEntry* dir_entry)
|| (dir_entry->attributes & HIDDEN_ATTR);
}
-int
+int _GL_ATTRIBUTE_PURE
fat_dir_entry_is_directory (FatDirEntry* dir_entry)
{
if (dir_entry->attributes == VFAT_ATTR) return 0;
diff --git a/libparted/fs/r/hfs/advfs.c b/libparted/fs/r/hfs/advfs.c
index d0afa30..0a39960 100644
--- a/libparted/fs/r/hfs/advfs.c
+++ b/libparted/fs/r/hfs/advfs.c
@@ -239,7 +239,7 @@ errbb: hfs_free_bad_blocks_list(priv_data->bad_blocks_xtent_list);
}
/* This function check if fblock is a bad block */
-int
+int _GL_ATTRIBUTE_PURE
hfs_is_bad_block (const PedFileSystem *fs, unsigned int fblock)
{
HfsPrivateFSData* priv_data = (HfsPrivateFSData*)
@@ -304,7 +304,7 @@ hfs_get_empty_end (const PedFileSystem *fs)
/* return the block which should be used to pack data to have at
least free fblock blocks at the end of the volume */
-unsigned int
+unsigned int _GL_ATTRIBUTE_PURE
hfs_find_start_pack (const PedFileSystem *fs, unsigned int fblock)
{
HfsPrivateFSData* priv_data = (HfsPrivateFSData*)
diff --git a/libparted/fs/r/hfs/advfs_plus.c b/libparted/fs/r/hfs/advfs_plus.c
index 5453c25..2b6fd87 100644
--- a/libparted/fs/r/hfs/advfs_plus.c
+++ b/libparted/fs/r/hfs/advfs_plus.c
@@ -247,7 +247,7 @@ errbbp: hfsplus_free_bad_blocks_list(priv_data->bad_blocks_xtent_list);
}
/* This function check if fblock is a bad block */
-int
+int _GL_ATTRIBUTE_PURE
hfsplus_is_bad_block (const PedFileSystem *fs, unsigned int fblock)
{
HfsPPrivateFSData* priv_data = (HfsPPrivateFSData*)
@@ -358,7 +358,7 @@ hfsplus_get_min_size (const PedFileSystem *fs)
/* return the block which should be used to pack data to have
at least free fblock blocks at the end of the volume */
-unsigned int
+unsigned int _GL_ATTRIBUTE_PURE
hfsplus_find_start_pack (const PedFileSystem *fs, unsigned int fblock)
{
HfsPPrivateFSData* priv_data = (HfsPPrivateFSData*)
--
2.26.2

View File

@ -1,104 +0,0 @@
From 34347779d3235186a68a040d3f3166ff45e65dac Mon Sep 17 00:00:00 2001
From: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Date: Wed, 14 Aug 2019 10:59:20 +0900
Subject: [PATCH 21/42] libparted: Fix warnings from GCC 8
-Wsuggest-attribute=const
As GCC 8 suggests, add 'const' attribute to six functions. After adding
const attributes, GCC suggested two more functions to add const
attributes. Add const attributes to those functions also. In total, add
const attributes to 8 functions.
I read code of the functions and confirmed they are const: they examine
only their arguments and have no effect other than return value.
Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Signed-off-by: Brian C. Lane <bcl@redhat.com>
---
libparted/fs/r/fat/calc.c | 14 +++++++-------
libparted/fs/r/fat/table.c | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c
index 60c6bac..18e0455 100644
--- a/libparted/fs/r/fat/calc.c
+++ b/libparted/fs/r/fat/calc.c
@@ -23,7 +23,7 @@
#ifndef DISCOVER_ONLY
/* returns the minimum size of clusters for a given file system type */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_min_cluster_size (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1;
@@ -33,7 +33,7 @@ fat_min_cluster_size (FatType fat_type) {
return 0;
}
-static PedSector
+static PedSector _GL_ATTRIBUTE_CONST
_smallest_power2_over (PedSector ceiling)
{
PedSector result = 1;
@@ -45,7 +45,7 @@ _smallest_power2_over (PedSector ceiling)
}
/* returns the minimum size of clusters for a given file system type */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_recommend_min_cluster_size (FatType fat_type, PedSector size) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1;
@@ -59,7 +59,7 @@ fat_recommend_min_cluster_size (FatType fat_type, PedSector size) {
}
/* returns the maxmimum size of clusters for a given file system type */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_max_cluster_size (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 1; /* dunno... who cares? */
@@ -70,7 +70,7 @@ fat_max_cluster_size (FatType fat_type) {
}
/* returns the minimum number of clusters for a given file system type */
-FatCluster
+FatCluster _GL_ATTRIBUTE_CONST
fat_min_cluster_count (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12:
@@ -83,7 +83,7 @@ fat_min_cluster_count (FatType fat_type) {
}
/* returns the maximum number of clusters for a given file system type */
-FatCluster
+FatCluster _GL_ATTRIBUTE_CONST
fat_max_cluster_count (FatType fat_type) {
switch (fat_type) {
case FAT_TYPE_FAT12: return 0xff0;
@@ -94,7 +94,7 @@ fat_max_cluster_count (FatType fat_type) {
}
/* what is this supposed to be? What drugs are M$ on? (Can I have some? :-) */
-PedSector
+PedSector _GL_ATTRIBUTE_CONST
fat_min_reserved_sector_count (FatType fat_type)
{
return (fat_type == FAT_TYPE_FAT32) ? 32 : 1;
diff --git a/libparted/fs/r/fat/table.c b/libparted/fs/r/fat/table.c
index 98b0499..394a519 100644
--- a/libparted/fs/r/fat/table.c
+++ b/libparted/fs/r/fat/table.c
@@ -462,7 +462,7 @@ fat_table_set_avail (FatTable* ft, FatCluster cluster)
#endif /* !DISCOVER_ONLY */
-int
+int _GL_ATTRIBUTE_CONST
fat_table_entry_size (FatType fat_type)
{
switch (fat_type) {
--
2.26.2

View File

@ -1,41 +0,0 @@
From b11bbb5a0b5c357816bff424c2a325806d60f20b Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 9 Nov 2020 14:33:37 -0800
Subject: [PATCH 22/42] bsd: Fix gcc complaints when using boot_code pointer
---
libparted/labels/bsd.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
index 6946563..8483641 100644
--- a/libparted/labels/bsd.c
+++ b/libparted/labels/bsd.c
@@ -307,19 +307,16 @@ error:
static void
_probe_and_add_boot_code (const PedDisk* disk)
{
- char *old_boot_code;
- BSDRawLabel *old_label;
+ BSDDiskData *old_data;
void *s0;
if (!ptt_read_sector (disk->dev, 0, &s0))
return;
- old_boot_code = ((BSDDiskData*) s0)->boot_code;
- old_label = &((BSDDiskData*) s0)->label;
-
- if (old_boot_code [0]
- && old_label->d_magic == PED_CPU_TO_LE32 (BSD_DISKMAGIC)) {
+ old_data = (BSDDiskData*) s0;
+ if (old_data->boot_code [0]
+ && old_data->label.d_magic == PED_CPU_TO_LE32 (BSD_DISKMAGIC)) {
BSDDiskData *bsd_specific = (BSDDiskData*) disk->disk_specific;
- memcpy (bsd_specific, old_boot_code, sizeof (BSDDiskData));
+ memcpy (bsd_specific, old_data, sizeof (BSDDiskData));
}
free (s0);
}
--
2.26.2

View File

@ -1,25 +0,0 @@
From 1ff56b03ec960435d55e200300093581ba874d53 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 9 Nov 2020 15:09:07 -0800
Subject: [PATCH 23/42] dos: Fix gcc complaints when using boot_code pointer
---
libparted/labels/dos.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index d859b33..bfa253b 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -1291,7 +1291,7 @@ msdos_write (const PedDisk* disk)
DosRawTable *table = (DosRawTable *) s0;
if (!table->boot_code[0]) {
- memset (table->boot_code, 0, 512);
+ memset (table, 0, 512);
memcpy (table->boot_code, MBR_BOOT_CODE, sizeof (MBR_BOOT_CODE));
}
--
2.26.2

View File

@ -1,38 +0,0 @@
From c3e648518235e1f77ca496c1234459e4bac300ad Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 9 Nov 2020 15:16:22 -0800
Subject: [PATCH 24/42] linux: Fix gcc complains about signed sccanf variables
---
libparted/arch/linux.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 09ec781..4c17720 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -720,9 +720,9 @@ _get_linux_version ()
static int kver = -1;
struct utsname uts;
- int major = 0;
- int minor = 0;
- int teeny = 0;
+ unsigned int major = 0;
+ unsigned int minor = 0;
+ unsigned int teeny = 0;
if (kver != -1)
return kver;
@@ -2884,7 +2884,7 @@ _dm_get_partition_start_and_length(PedPartition const *part,
char *params;
char *target_type;
dm_get_next_target(task, NULL, (uint64_t *)start, (uint64_t *)length, &target_type, &params);
- if (sscanf (params, "%d:%d %Ld", &major, &minor, start) != 3)
+ if (sscanf (params, "%d:%d %Lu", &major, &minor, start) != 3)
goto err;
rc = 1;
--
2.26.2

View File

@ -1,25 +0,0 @@
From 09fb0fc6dadde9982d243567cf92743149895102 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Mon, 9 Nov 2020 15:53:30 -0800
Subject: [PATCH 25/42] tests: Fix unsigned warning in duplicate.c
---
tests/duplicate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/duplicate.c b/tests/duplicate.c
index a9dde84..771faab 100644
--- a/tests/duplicate.c
+++ b/tests/duplicate.c
@@ -134,7 +134,7 @@ main (int argc, char **argv)
{
if (!ped_partition_is_flag_available(disk_part, flag))
continue;
- fprintf (stderr, "Checking partition flag %d\n", flag);
+ fprintf (stderr, "Checking partition flag %u\n", flag);
fprintf (stderr, "%d ? %d\n", ped_partition_get_flag (disk_part, flag),
ped_partition_get_flag (copy_part, flag));
assert (ped_partition_get_flag (disk_part, flag)
--
2.26.2

View File

@ -1,41 +0,0 @@
From b7ccc1b29674937ab4c97d0e1b7b5bfd6f366b92 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 10 Nov 2020 15:42:46 -0800
Subject: [PATCH 26/42] hfs: Fix gcc 10 bounds check warning
binfo is actually a list of structs that cannot be known until runtime,
so use a variable length array.
---
libparted/fs/hfs/hfs.h | 2 +-
libparted/fs/r/hfs/hfs.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libparted/fs/hfs/hfs.h b/libparted/fs/hfs/hfs.h
index 4fa2e95..0a9392a 100644
--- a/libparted/fs/hfs/hfs.h
+++ b/libparted/fs/hfs/hfs.h
@@ -529,7 +529,7 @@ struct __attribute__ ((packed)) _HfsJBlockListHeader {
uint32_t bytes_used;
uint32_t checksum;
uint32_t pad;
- HfsJBlockInfo binfo[1];
+ HfsJBlockInfo binfo[];
};
typedef struct _HfsJBlockListHeader HfsJBlockListHeader;
diff --git a/libparted/fs/r/hfs/hfs.h b/libparted/fs/r/hfs/hfs.h
index 4fa2e95..0a9392a 100644
--- a/libparted/fs/r/hfs/hfs.h
+++ b/libparted/fs/r/hfs/hfs.h
@@ -529,7 +529,7 @@ struct __attribute__ ((packed)) _HfsJBlockListHeader {
uint32_t bytes_used;
uint32_t checksum;
uint32_t pad;
- HfsJBlockInfo binfo[1];
+ HfsJBlockInfo binfo[];
};
typedef struct _HfsJBlockListHeader HfsJBlockListHeader;
--
2.26.2

View File

@ -1,74 +0,0 @@
From 868fab2fea9ad6422b2ee9b3c1ab9e69d5a4f9a7 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 10 Nov 2020 16:15:49 -0800
Subject: [PATCH 27/42] hfs/advfs: Fix gcc 10 warnings about cast alignment
---
libparted/fs/r/hfs/advfs.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/libparted/fs/r/hfs/advfs.c b/libparted/fs/r/hfs/advfs.c
index 0a39960..1ce4319 100644
--- a/libparted/fs/r/hfs/advfs.c
+++ b/libparted/fs/r/hfs/advfs.c
@@ -87,12 +87,14 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key,
HfsPrivateGenericKey* record_key = NULL;
unsigned int node_number, record_number;
int i;
+ uint16_t record_pos;
/* Read the header node */
if (!hfs_file_read_sector(b_tree_file, node, 0))
return 0;
- header = ((HfsHeaderRecord*) (node + PED_BE16_TO_CPU(*((uint16_t *)
- (node+(PED_SECTOR_SIZE_DEFAULT-2))))));
+ uint16_t offset;
+ memcpy(&offset, node+(PED_SECTOR_SIZE_DEFAULT-2), sizeof(uint16_t));
+ header = (HfsHeaderRecord*) (node + PED_BE16_TO_CPU(offset));
/* Get the node number of the root */
node_number = PED_BE32_TO_CPU(header->root_node);
@@ -107,13 +109,13 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key,
while (1) {
record_number = PED_BE16_TO_CPU (desc->rec_nb);
for (i = record_number; i; i--) {
- record_key = (HfsPrivateGenericKey*)
- (node + PED_BE16_TO_CPU(*((uint16_t *)
- (node+(PED_SECTOR_SIZE_DEFAULT - 2*i)))));
+ uint16_t value;
+ memcpy(&value, node+(PED_SECTOR_SIZE_DEFAULT - (2*i)), sizeof(uint16_t));
+ record_pos = PED_BE16_TO_CPU(value);
+ record_key = (HfsPrivateGenericKey*) (node + record_pos);
/* check for obvious error in FS */
- if (((uint8_t*)record_key - node < HFS_FIRST_REC)
- || ((uint8_t*)record_key - node
- >= PED_SECTOR_SIZE_DEFAULT
+ if ((record_pos< HFS_FIRST_REC)
+ || (record_pos>= PED_SECTOR_SIZE_DEFAULT
- 2 * (signed)(record_number+1))) {
ped_exception_throw (
PED_EXCEPTION_ERROR,
@@ -129,8 +131,9 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key,
unsigned int skip;
skip = (1 + record_key->key_length + 1) & ~1;
- node_number = PED_BE32_TO_CPU (*((uint32_t *)
- (((uint8_t *) record_key) + skip)));
+ uint32_t value;
+ memcpy(&value, node+record_pos+skip, sizeof(uint32_t));
+ node_number = PED_BE32_TO_CPU(value);
if (!hfs_file_read_sector(b_tree_file, node,
node_number))
return 0;
@@ -146,7 +149,7 @@ hfs_btree_search (HfsPrivateFile* b_tree_file, HfsPrivateGenericKey* key,
if (record_ref) {
record_ref->node_size = 1; /* in sectors */
record_ref->node_number = node_number;
- record_ref->record_pos = (uint8_t*)record_key - node;
+ record_ref->record_pos = record_pos;
record_ref->record_number = i;
}
--
2.26.2

View File

@ -1,75 +0,0 @@
From 6cb1ed79543f9a9425de2b334a41e08836edc6b8 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 10 Nov 2020 17:05:59 -0800
Subject: [PATCH 28/42] hfs/advfs_plus: Fix gcc 10 warnings about cast
alignment
---
libparted/fs/r/hfs/advfs_plus.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/libparted/fs/r/hfs/advfs_plus.c b/libparted/fs/r/hfs/advfs_plus.c
index 2b6fd87..2141746 100644
--- a/libparted/fs/r/hfs/advfs_plus.c
+++ b/libparted/fs/r/hfs/advfs_plus.c
@@ -80,6 +80,7 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key,
HfsPPrivateGenericKey* record_key = NULL;
unsigned int node_number, record_number, size, bsize;
int i;
+ uint16_t record_pos;
/* Read the header node */
if (!hfsplus_file_read_sector(b_tree_file, node_1, 0))
@@ -93,7 +94,7 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key,
/* Get the size of a node in sectors and allocate buffer */
size = (bsize = PED_BE16_TO_CPU (header->node_size)) / PED_SECTOR_SIZE_DEFAULT;
- node = (uint8_t*) ped_malloc (bsize);
+ node = ped_malloc (bsize);
if (!node)
return 0;
HfsPNodeDescriptor *desc = (HfsPNodeDescriptor*) node;
@@ -107,13 +108,13 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key,
while (1) {
record_number = PED_BE16_TO_CPU (desc->rec_nb);
for (i = record_number; i; i--) {
- record_key = (HfsPPrivateGenericKey*)
- (node + PED_BE16_TO_CPU(*((uint16_t *)
- (node+(bsize - 2*i)))));
+ uint16_t value;
+ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t));
+ record_pos = PED_BE16_TO_CPU(value);
+ record_key = (HfsPPrivateGenericKey*) (node + record_pos);
/* check for obvious error in FS */
- if (((uint8_t*)record_key - node < HFS_FIRST_REC)
- || ((uint8_t*)record_key - node
- >= (signed)bsize
+ if ((record_pos < HFS_FIRST_REC)
+ || (record_pos >= (signed)bsize
- 2 * (signed)(record_number+1))) {
ped_exception_throw (
PED_EXCEPTION_ERROR,
@@ -131,8 +132,9 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key,
skip = ( 2 + PED_BE16_TO_CPU (record_key->key_length)
+ 1 ) & ~1;
- node_number = PED_BE32_TO_CPU (*((uint32_t *)
- (((uint8_t *) record_key) + skip)));
+ uint32_t value;
+ memcpy(&value, node+record_pos+skip, sizeof(uint32_t));
+ node_number = PED_BE32_TO_CPU(value);
if (!hfsplus_file_read(b_tree_file, node,
(PedSector) node_number * size,
size)) {
@@ -151,7 +153,7 @@ hfsplus_btree_search (HfsPPrivateFile* b_tree_file, HfsPPrivateGenericKey* key,
if (record_ref) {
record_ref->node_size = size; /* in sectors */
record_ref->node_number = node_number;
- record_ref->record_pos = (uint8_t*)record_key - node;
+ record_ref->record_pos = record_pos;
record_ref->record_number = i;
}
--
2.26.2

View File

@ -1,33 +0,0 @@
From 006ad756c70603212309157fa05c5d855e25f07e Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 12 Nov 2020 13:33:36 -0800
Subject: [PATCH 29/42] hfs/hfs: Fix gcc 10 warnings about cast alignment
---
libparted/fs/r/hfs/hfs.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c
index 0aababd..09899da 100644
--- a/libparted/fs/r/hfs/hfs.c
+++ b/libparted/fs/r/hfs/hfs.c
@@ -891,12 +891,11 @@ hfsplus_wrapper_update (PedFileSystem* fs)
ref.record_number = 1;
}
- ref.record_pos =
- PED_BE16_TO_CPU (*((uint16_t *)
- (node + (PED_SECTOR_SIZE_DEFAULT
- - 2*ref.record_number))));
+ uint16_t value;
+ memcpy(&value, node+PED_SECTOR_SIZE_DEFAULT - (2*ref.record_number), sizeof(uint16_t));
+ ref.record_pos = PED_BE16_TO_CPU(value);
ret_key = (HfsExtentKey*) (node + ref.record_pos);
- ret_data = (HfsExtDescriptor*) ( node + ref.record_pos
+ ret_data = (HfsExtDescriptor*) (node + ref.record_pos
+ sizeof (HfsExtentKey) );
}
--
2.26.2

View File

@ -1,47 +0,0 @@
From 1e086dba260630b63e0822731522ce04c081d95e Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 10 Nov 2020 14:39:06 -0800
Subject: [PATCH 30/42] ext2: Fix gcc 10 warnings about cast alignment
---
libparted/fs/ext2/ext2_fs.h | 2 +-
libparted/fs/ext2/interface.c | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/libparted/fs/ext2/ext2_fs.h b/libparted/fs/ext2/ext2_fs.h
index ac1b6a0..362f8bc 100644
--- a/libparted/fs/ext2/ext2_fs.h
+++ b/libparted/fs/ext2/ext2_fs.h
@@ -173,7 +173,7 @@ struct ext2_inode
#define i_size_high i_dir_acl
-struct ext2_super_block
+struct __attribute__ ((packed)) ext2_super_block
{
uint32_t s_inodes_count; /* Inodes count */
uint32_t s_blocks_count; /* Blocks count */
diff --git a/libparted/fs/ext2/interface.c b/libparted/fs/ext2/interface.c
index a49568b..01c224e 100644
--- a/libparted/fs/ext2/interface.c
+++ b/libparted/fs/ext2/interface.c
@@ -33,12 +33,13 @@ struct ext2_dev_handle* ext2_make_dev_handle_from_parted_geometry(PedGeometry* g
static PedGeometry*
_ext2_generic_probe (PedGeometry* geom, int expect_ext_ver)
{
+ struct ext2_super_block *sb;
const int sectors = (4096 + geom->dev->sector_size - 1) /
geom->dev->sector_size;
- char *sb_v = alloca (sectors * geom->dev->sector_size);
- if (!ped_geometry_read(geom, sb_v, 0, sectors))
+ uint8_t *buf = alloca (sectors * geom->dev->sector_size);
+ if (!ped_geometry_read(geom, buf, 0, sectors))
return NULL;
- struct ext2_super_block *sb = (struct ext2_super_block *)(sb_v + 1024);
+ sb = (struct ext2_super_block *)(buf+1024);
if (EXT2_SUPER_MAGIC(*sb) == EXT2_SUPER_MAGIC_CONST) {
PedSector block_size = (EXT2_MIN_BLOCK_SIZE << (EXT2_SUPER_LOG_BLOCK_SIZE(*sb))) / geom->dev->sector_size;
--
2.26.2

View File

@ -1,49 +0,0 @@
From 362571d09da09fb2b6fab7037af26d83b2d39b75 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 12 Nov 2020 16:08:31 -0800
Subject: [PATCH 31/42] nilfs2: Fix gcc 10 warnings about cast alignment
---
libparted/fs/nilfs2/nilfs2.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/libparted/fs/nilfs2/nilfs2.c b/libparted/fs/nilfs2/nilfs2.c
index 3ca4808..2871179 100644
--- a/libparted/fs/nilfs2/nilfs2.c
+++ b/libparted/fs/nilfs2/nilfs2.c
@@ -34,8 +34,7 @@
/* secondary superblock offset in 512byte blocks. */
#define NILFS_SB2_OFFSET(devsize) ((((devsize)>>3) - 1) << 3)
-struct nilfs2_super_block
-{
+struct __attribute__ ((packed)) nilfs2_super_block {
uint32_t s_rev_level;
uint16_t s_minor_rev_level;
uint16_t s_magic;
@@ -112,18 +111,18 @@ nilfs2_probe (PedGeometry* geom)
return NULL;
const int sectors = (4096 + geom->dev->sector_size - 1) /
geom->dev->sector_size;
- char *buf = alloca (sectors * geom->dev->sector_size);
+ uint8_t *buf = alloca (sectors * geom->dev->sector_size);
const int sectors2 = (1024 + geom->dev->sector_size -1 ) /
geom->dev->sector_size;
void *buff2 = alloca (sectors2 * geom->dev->sector_size);
if (ped_geometry_read(geom, buf, 0, sectors))
- sb = (struct nilfs2_super_block *)(buf+1024);
+ sb = (struct nilfs2_super_block*)(buf + 1024);
if (ped_geometry_read(geom, buff2, sb2off, sectors2))
- sb2 = buff2;
+ sb2 = (struct nilfs2_super_block*)buff2;
if ((!sb || !is_valid_nilfs_sb(sb)) &&
- (!sb2 || !is_valid_nilfs_sb(sb2)) )
+ (!sb2 || !is_valid_nilfs_sb(sb2)))
return NULL;
/* reserve 4k bytes for secondary superblock */
--
2.26.2

View File

@ -1,39 +0,0 @@
From e2ee2628c5d75b375db90a486b906c0d2405b8b3 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 12 Nov 2020 16:18:42 -0800
Subject: [PATCH 32/42] ntfs: Fix gcc 10 warnings about cast alignment
---
libparted/fs/ntfs/ntfs.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libparted/fs/ntfs/ntfs.c b/libparted/fs/ntfs/ntfs.c
index 3bfb28e..a3a6550 100644
--- a/libparted/fs/ntfs/ntfs.c
+++ b/libparted/fs/ntfs/ntfs.c
@@ -35,16 +35,17 @@
PedGeometry*
ntfs_probe (PedGeometry* geom)
{
- char *buf = alloca (geom->dev->sector_size);
+ uint8_t *buf = alloca(geom->dev->sector_size);
PedGeometry *newg = NULL;
if (!ped_geometry_read(geom, buf, 0, 1))
return 0;
- if (strncmp (NTFS_SIGNATURE, buf + 3, strlen (NTFS_SIGNATURE)) == 0)
- newg = ped_geometry_new (geom->dev, geom->start,
- PED_LE64_TO_CPU (*(uint64_t*)
- (buf + 0x28)));
+ if (strncmp (NTFS_SIGNATURE, ((char *)buf + 3), strlen (NTFS_SIGNATURE)) == 0) {
+ uint64_t length;
+ memcpy(&length, buf + 0x28, sizeof(uint64_t));
+ newg = ped_geometry_new (geom->dev, geom->start, length);
+ }
return newg;
}
--
2.26.2

View File

@ -1,51 +0,0 @@
From 65d95eaf5692f7d19f2b550dee4c9b585ce79938 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 12 Nov 2020 16:19:10 -0800
Subject: [PATCH 33/42] ufs: Fix gcc 10 warnings about cast alignment
---
libparted/fs/ufs/ufs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libparted/fs/ufs/ufs.c b/libparted/fs/ufs/ufs.c
index 27cb036..f677b60 100644
--- a/libparted/fs/ufs/ufs.c
+++ b/libparted/fs/ufs/ufs.c
@@ -45,14 +45,14 @@
#define UFS_MAGIC_FEA 0x00195612
#define UFS_MAGIC_4GB 0x05231994
-struct ufs_csum {
+struct __attribute__ ((packed)) ufs_csum {
uint32_t cs_ndir; /* number of directories */
uint32_t cs_nbfree; /* number of free blocks */
uint32_t cs_nifree; /* number of free inodes */
uint32_t cs_nffree; /* number of free frags */
};
-struct ufs_super_block {
+struct __attribute__ ((packed)) ufs_super_block {
uint32_t fs_link; /* UNUSED */
uint32_t fs_rlink; /* UNUSED */
uint32_t fs_sblkno; /* addr of super-block in filesys */
@@ -176,7 +176,7 @@ ufs_probe_sun (PedGeometry* geom)
{
const int sectors = ((3 * 512) + geom->dev->sector_size - 1) /
geom->dev->sector_size;
- char * buf = alloca (sectors * geom->dev->sector_size);
+ uint8_t* buf = alloca (sectors * geom->dev->sector_size);
struct ufs_super_block *sb;
if (geom->length < 5)
@@ -212,7 +212,7 @@ ufs_probe_hp (PedGeometry* geom)
return 0;
const int sectors = ((3 * 512) + geom->dev->sector_size - 1) /
geom->dev->sector_size;
- char * buf = alloca (sectors * geom->dev->sector_size);
+ uint8_t* buf = alloca (sectors * geom->dev->sector_size);
if (!ped_geometry_read (geom, buf, 16 * 512 / geom->dev->sector_size, sectors))
return 0;
--
2.26.2

View File

@ -1,27 +0,0 @@
From c21ee3827639343920d3f08cff319620d3582d2a Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 12 Nov 2020 16:19:36 -0800
Subject: [PATCH 34/42] ped_assert: Fix incorrect exception option
PED_EXCEPTION_FATAL is a type, not an option. A PED_EXCEPTION_BUG should
always select CANCEL.
---
libparted/debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libparted/debug.c b/libparted/debug.c
index c4932ca..227673e 100644
--- a/libparted/debug.c
+++ b/libparted/debug.c
@@ -106,7 +106,7 @@ void ped_assert (const char* cond_text,
/* Throw the exception */
ped_exception_throw (
PED_EXCEPTION_BUG,
- PED_EXCEPTION_FATAL,
+ PED_EXCEPTION_CANCEL,
_("Assertion (%s) at %s:%d in function %s() failed."),
cond_text, file, line, function);
abort ();
--
2.26.2

View File

@ -1,27 +0,0 @@
From 45e4c689c81cc55f849d3f90168a6b89c0168191 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 12 Nov 2020 16:30:57 -0800
Subject: [PATCH 35/42] ui: Fix command_line_get_disk_flag
It was using PedPartitionFlag instead of PedDiskFlag when walking the
available flags.
---
parted/ui.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parted/ui.c b/parted/ui.c
index 7b5374d..8e1f2fe 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -1138,7 +1138,7 @@ command_line_get_disk_flag (const char* prompt, const PedDisk* disk,
PedDiskFlag* flag)
{
StrList* opts = NULL;
- PedPartitionFlag walk = 0;
+ PedDiskFlag walk = 0;
char* flag_name;
while ( (walk = ped_disk_flag_next (walk)) ) {
--
2.26.2

View File

@ -1,31 +0,0 @@
From 6e34cb98ddef0c9fd47359a2006265e7251e8830 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 12 Nov 2020 16:49:29 -0800
Subject: [PATCH 36/42] ui: Fix gcc 10 warning about snprintf truncating an int
Double the storage to 20 bytes.
---
parted/ui.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/parted/ui.c b/parted/ui.c
index 8e1f2fe..73fdcf5 100644
--- a/parted/ui.c
+++ b/parted/ui.c
@@ -909,11 +909,11 @@ command_line_get_word (const char* prompt, const char* def,
int
command_line_get_integer (const char* prompt, int* value)
{
- char def_str [10];
+ char def_str [20];
char* input;
long ret;
- snprintf (def_str, 10, "%d", *value);
+ snprintf (def_str, 20, "%d", *value);
input = command_line_get_word (prompt, *value ? def_str : NULL,
NULL, 1);
if (!input)
--
2.26.2

View File

@ -1,98 +0,0 @@
From 76bf966849534a832c30cd89dbbb8a32939dcbed Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 13 Nov 2020 15:12:06 -0800
Subject: [PATCH 37/42] hfs/reloc: Fix gcc 10 warnings about cast alignment
---
libparted/fs/r/hfs/reloc.c | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/libparted/fs/r/hfs/reloc.c b/libparted/fs/r/hfs/reloc.c
index d0477ae..68b14ae 100644
--- a/libparted/fs/r/hfs/reloc.c
+++ b/libparted/fs/r/hfs/reloc.c
@@ -373,6 +373,7 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs,
HfsExtDescriptor* extent;
unsigned int leaf_node, record_number;
unsigned int i, j;
+ uint16_t catalog_pos;
if (!priv_data->catalog_file->sect_nb) {
ped_exception_throw (
@@ -385,8 +386,9 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs,
if (!hfs_file_read_sector (priv_data->catalog_file, node, 0))
return 0;
- header = (HfsHeaderRecord*)(node + PED_BE16_TO_CPU(*((uint16_t*)
- (node+(PED_SECTOR_SIZE_DEFAULT-2)))));
+ uint16_t offset;
+ memcpy(&offset, node+(PED_SECTOR_SIZE_DEFAULT-2), sizeof(uint16_t));
+ header = (HfsHeaderRecord*) (node + PED_BE16_TO_CPU(offset));
for (leaf_node = PED_BE32_TO_CPU (header->first_leaf_node);
leaf_node;
@@ -397,14 +399,15 @@ hfs_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs,
record_number = PED_BE16_TO_CPU (desc->rec_nb);
for (i = 1; i <= record_number; ++i) {
/* undocumented alignement */
+ uint16_t value;
+ memcpy(&value, node+(PED_SECTOR_SIZE_DEFAULT - (2*i)), sizeof(uint16_t));
+ catalog_pos = PED_BE16_TO_CPU(value);
+ catalog_key = (HfsCatalogKey*) (node + catalog_pos);
unsigned int skip;
- catalog_key = (HfsCatalogKey*) (node + PED_BE16_TO_CPU(
- *((uint16_t*)(node+(PED_SECTOR_SIZE_DEFAULT - 2*i)))));
skip = (1 + catalog_key->key_length + 1) & ~1;
- catalog_data = (HfsCatalog*)( ((uint8_t*)catalog_key)
- + skip );
+ catalog_data = (HfsCatalog*)(node+catalog_pos+skip);
/* check for obvious error in FS */
- if (((uint8_t*)catalog_key - node < HFS_FIRST_REC)
+ if ((catalog_pos < HFS_FIRST_REC)
|| ((uint8_t*)catalog_data - node
>= PED_SECTOR_SIZE_DEFAULT
- 2 * (signed)(record_number+1))) {
@@ -467,6 +470,7 @@ hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs,
HfsExtDescriptor* extent;
unsigned int leaf_node, record_number;
unsigned int i, j;
+ uint16_t extent_pos;
if (!priv_data->extent_file->sect_nb) {
ped_exception_throw (
@@ -479,8 +483,9 @@ hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs,
if (!hfs_file_read_sector (priv_data->extent_file, node, 0))
return 0;
- header = ((HfsHeaderRecord*) (node + PED_BE16_TO_CPU(*((uint16_t *)
- (node+(PED_SECTOR_SIZE_DEFAULT-2))))));
+ uint16_t offset;
+ memcpy(&offset, node+(PED_SECTOR_SIZE_DEFAULT-2), sizeof(uint16_t));
+ header = (HfsHeaderRecord*) (node + PED_BE16_TO_CPU(offset));
for (leaf_node = PED_BE32_TO_CPU (header->first_leaf_node);
leaf_node;
@@ -491,14 +496,14 @@ hfs_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs,
record_number = PED_BE16_TO_CPU (desc->rec_nb);
for (i = 1; i <= record_number; i++) {
uint8_t where;
- extent_key = (HfsExtentKey*)
- (node + PED_BE16_TO_CPU(*((uint16_t *)
- (node+(PED_SECTOR_SIZE_DEFAULT - 2*i)))));
+ uint16_t value;
+ memcpy(&value, node+(PED_SECTOR_SIZE_DEFAULT - (2*i)), sizeof(uint16_t));
+ extent_pos = PED_BE16_TO_CPU(value);
+ extent_key = (HfsExtentKey*)(node + extent_pos);
/* size is cst */
- extent = (HfsExtDescriptor*)(((uint8_t*)extent_key)
- + sizeof (HfsExtentKey));
+ extent = (HfsExtDescriptor*)(node+extent_pos+sizeof(HfsExtentKey));
/* check for obvious error in FS */
- if (((uint8_t*)extent_key - node < HFS_FIRST_REC)
+ if ((extent_pos < HFS_FIRST_REC)
|| ((uint8_t*)extent - node
>= PED_SECTOR_SIZE_DEFAULT
- 2 * (signed)(record_number+1))) {
--
2.26.2

View File

@ -1,103 +0,0 @@
From f496795a850976d211d3f5c673b868c3c90a8c3d Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 13 Nov 2020 15:25:35 -0800
Subject: [PATCH 38/42] hfs/reloc_plus: Fix gcc 10 warnings about cast
alignment
---
libparted/fs/r/hfs/reloc_plus.c | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
diff --git a/libparted/fs/r/hfs/reloc_plus.c b/libparted/fs/r/hfs/reloc_plus.c
index cebadbe..44c0a77 100644
--- a/libparted/fs/r/hfs/reloc_plus.c
+++ b/libparted/fs/r/hfs/reloc_plus.c
@@ -486,6 +486,7 @@ hfsplus_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs,
unsigned int i, j, size, bsize;
uint32_t jib = priv_data->jib_start_block,
jl = priv_data->jl_start_block;
+ uint16_t catalog_pos;
if (!priv_data->catalog_file->sect_nb) {
ped_exception_throw (
@@ -520,15 +521,16 @@ hfsplus_cache_from_catalog(HfsCPrivateCache* cache, PedFileSystem* fs,
unsigned int skip;
uint8_t where;
- catalog_key = (HfsPCatalogKey*)
- ( node + PED_BE16_TO_CPU (*((uint16_t *)
- (node+(bsize - 2*i)))) );
+ uint16_t value;
+ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t));
+ catalog_pos = PED_BE16_TO_CPU(value);
+ catalog_key = (HfsPCatalogKey*)(node + catalog_pos);
skip = ( 2 + PED_BE16_TO_CPU (catalog_key->key_length)
+ 1) & ~1;
catalog_data = (HfsPCatalog*)
(((uint8_t*)catalog_key) + skip);
/* check for obvious error in FS */
- if (((uint8_t*)catalog_key - node < HFS_FIRST_REC)
+ if ((catalog_pos < HFS_FIRST_REC)
|| ((uint8_t*)catalog_data - node
>= (signed) bsize
- 2 * (signed)(record_number+1))) {
@@ -609,6 +611,7 @@ hfsplus_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs,
HfsPExtDescriptor* extent;
unsigned int leaf_node, record_number;
unsigned int i, j, size, bsize;
+ uint16_t extent_pos;
if (!priv_data->extents_file->sect_nb) {
ped_exception_throw (
@@ -640,13 +643,14 @@ hfsplus_cache_from_extent(HfsCPrivateCache* cache, PedFileSystem* fs,
record_number = PED_BE16_TO_CPU (desc->rec_nb);
for (i = 1; i <= record_number; i++) {
uint8_t where;
- extent_key = (HfsPExtentKey*)
- (node + PED_BE16_TO_CPU(*((uint16_t *)
- (node+(bsize - 2*i)))));
+ uint16_t value;
+ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t));
+ extent_pos = PED_BE16_TO_CPU(value);
+ extent_key = (HfsPExtentKey*)(node + extent_pos);
extent = (HfsPExtDescriptor*)
(((uint8_t*)extent_key) + sizeof (HfsPExtentKey));
/* check for obvious error in FS */
- if (((uint8_t*)extent_key - node < HFS_FIRST_REC)
+ if ((extent_pos < HFS_FIRST_REC)
|| ((uint8_t*)extent - node
>= (signed)bsize
- 2 * (signed)(record_number+1))) {
@@ -724,6 +728,7 @@ hfsplus_cache_from_attributes(HfsCPrivateCache* cache, PedFileSystem* fs,
HfsPExtDescriptor* extent;
unsigned int leaf_node, record_number;
unsigned int i, j, size, bsize;
+ uint16_t generic_pos;
/* attributes file is facultative */
if (!priv_data->attributes_file->sect_nb)
@@ -751,15 +756,15 @@ hfsplus_cache_from_attributes(HfsCPrivateCache* cache, PedFileSystem* fs,
record_number = PED_BE16_TO_CPU (desc->rec_nb);
for (i = 1; i <= record_number; i++) {
unsigned int skip;
- generic_key = (HfsPPrivateGenericKey*)
- (node + PED_BE16_TO_CPU(*((uint16_t *)
- (node+(bsize - 2*i)))));
+ uint16_t value;
+ memcpy(&value, node+(bsize - (2*i)), sizeof(uint16_t));
+ generic_pos = PED_BE16_TO_CPU(value);
+ generic_key = (HfsPPrivateGenericKey*)(node + generic_pos);
skip = ( 2 + PED_BE16_TO_CPU (generic_key->key_length)
+ 1 ) & ~1;
- fork_ext_data = (HfsPForkDataAttr*)
- (((uint8_t*)generic_key) + skip);
+ fork_ext_data = (HfsPForkDataAttr*)(node+generic_pos+skip);
/* check for obvious error in FS */
- if (((uint8_t*)generic_key - node < HFS_FIRST_REC)
+ if ((generic_pos < HFS_FIRST_REC)
|| ((uint8_t*)fork_ext_data - node
>= (signed) bsize
- 2 * (signed)(record_number+1))) {
--
2.26.2

View File

@ -1,350 +0,0 @@
From d2cc30120427394f6eaaa60acfbe647fb82a9762 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 20 Nov 2020 13:21:25 -0800
Subject: [PATCH 39/42] fs/r/fat: Remove disabled code
---
libparted/fs/r/fat/count.c | 83 -----------------
libparted/fs/r/fat/fat.c | 175 ------------------------------------
libparted/fs/r/fat/resize.c | 17 ----
3 files changed, 275 deletions(-)
diff --git a/libparted/fs/r/fat/count.c b/libparted/fs/r/fat/count.c
index 2b65e72..51e1aa2 100644
--- a/libparted/fs/r/fat/count.c
+++ b/libparted/fs/r/fat/count.c
@@ -27,66 +27,6 @@
#ifndef DISCOVER_ONLY
-#if 0
-/* extremely ugly hack: stick everything that obviously isn't an unmovable file
- * in here. Note: DAT is a bit dubious. Unfortunately, it's used by the
- * registry, so it'll be all over the place :-(
- */
-static char* movable_extensions[] = {
- "",
- "1ST",
- "AVI",
- "BAK", "BAT", "BMP",
- "CFG", "COM", "CSS",
- "DAT", "DLL", "DOC", "DRV",
- "EXE",
- "FAQ", "FLT", "FON",
- "GID", "GIF",
- "HLP", "HTT", "HTM",
- "ICO", "INI",
- "JPG",
- "LNK", "LOG",
- "KBD",
- "ME", "MID", "MSG",
- "OCX", "OLD",
- "PIF", "PNG", "PRV",
- "RTF",
- "SCR", "SYS",
- "TMP", "TTF", "TXT",
- "URL",
- "WAV",
- "VBX", "VOC", "VXD",
- NULL
-};
-
-static char*
-get_extension (char* file_name)
-{
- char* ext;
-
- ext = strrchr (file_name, '.');
- if (!ext)
- return "";
- if (strchr (ext, '\\'))
- return "";
- return ext + 1;
-}
-
-static int
-is_movable_system_file (char* file_name)
-{
- char* ext = get_extension (file_name);
- int i;
-
- for (i = 0; movable_extensions [i]; i++) {
- if (strcasecmp (ext, movable_extensions [i]) == 0)
- return 1;
- }
-
- return 0;
-}
-#endif /* 0 */
-
/*
prints out the sequence of clusters for a given file chain, beginning
at start_cluster.
@@ -248,29 +188,6 @@ flag_traverse_dir (FatTraverseInfo* trav_info) {
print_chain (fs, first_cluster);
#endif
-#if 0
- if (fat_dir_entry_is_system_file (this_entry)
- && !is_movable_system_file (file_name)) {
- PedExceptionOption ex_status;
- ex_status = ped_exception_throw (
- PED_EXCEPTION_WARNING,
- PED_EXCEPTION_IGNORE_CANCEL,
- _("The file %s is marked as a system file. "
- "This means moving it could cause some "
- "programs to stop working."),
- file_name);
-
- switch (ex_status) {
- case PED_EXCEPTION_CANCEL:
- return 0;
-
- case PED_EXCEPTION_UNHANDLED:
- ped_exception_catch ();
- case PED_EXCEPTION_IGNORE:
- }
- }
-#endif /* 0 */
-
if (fat_dir_entry_is_directory (this_entry)) {
if (!flag_traverse_fat (fs, file_name, first_cluster,
FAT_FLAG_DIRECTORY, size))
diff --git a/libparted/fs/r/fat/fat.c b/libparted/fs/r/fat/fat.c
index ad57d36..0b2fee9 100644
--- a/libparted/fs/r/fat/fat.c
+++ b/libparted/fs/r/fat/fat.c
@@ -613,68 +613,6 @@ fat_get_resize_constraint (const PedFileSystem* fs)
return fat_get_copy_constraint (fs, fs->geom->dev);
}
-/* FIXME: fat_calc_sizes() needs to say "too big" or "too small", or
- * something. This is a really difficult (maths) problem to do
- * nicely...
- * So, this algorithm works if dev->length / 2 is a valid fat_type
- * size. (Which is how I got the magic numbers below)
- */
-#if 0
-/* returns: -1 too small, 0 ok, 1 too big */
-static int
-_test_create_size (PedSector length, FatType fat_type,
- PedSector cluster_sectors, PedSector cluster_count)
-{
- PedSector rootdir_sectors;
- PedSector _cluster_sectors;
- FatCluster _cluster_count;
- PedSector _fat_size;
-
- rootdir_sectors = (fat_type == FAT_TYPE_FAT16) ? 16 : 0;
-
- if (!fat_calc_sizes (length, 0, fat_type, rootdir_sectors,
- &_cluster_sectors, &_cluster_count, &_fat_size))
- return -1; // XXX: doesn't work... can't see a better way!
-
- if (_cluster_sectors < cluster_sectors)
- return -1;
- if (_cluster_sectors > cluster_sectors)
- return 1;
-
- if (_cluster_count < cluster_count)
- return -1;
- if (_cluster_count > cluster_count)
- return 1;
-
- return 0;
-}
-
-static PedSector
-_get_create_size (PedSector upper_bound, FatType fat_type,
- PedSector cluster_sectors, FatCluster cluster_count)
-{
- PedSector min_length = 0;
- PedSector max_length = upper_bound;
- PedSector length;
-
- while (1) {
- length = (min_length + max_length) / 2;
- switch (_test_create_size (length, fat_type, cluster_sectors,
- cluster_count)) {
- case -1: min_length = length; break;
- case 0: return length;
- case 1: max_length = length; break;
- }
- /* hack... won't always be able to get max cluster count
- * with max cluster size, etc. */
- if (max_length - min_length == 1)
- return min_length;
- }
-
- return 0; /* shut gcc up */
-}
-#endif
-
PedConstraint*
fat_get_create_constraint_fat16 (const PedDevice* dev)
{
@@ -685,19 +623,8 @@ fat_get_create_constraint_fat16 (const PedDevice* dev)
if (!ped_geometry_init (&full_dev, dev, 0, dev->length - 1))
return NULL;
-#if 0
- min_size = _get_create_size (dev->length, FAT_TYPE_FAT16,
- fat_min_cluster_size (FAT_TYPE_FAT16),
- fat_min_cluster_count (FAT_TYPE_FAT16));
- max_size = _get_create_size (dev->length, FAT_TYPE_FAT16,
- fat_max_cluster_size (FAT_TYPE_FAT16),
- fat_max_cluster_count (FAT_TYPE_FAT16));
- if (!min_size)
- return NULL;
-#else
min_size = 65794;
max_size = 2097153;
-#endif
return ped_constraint_new (
ped_alignment_any, ped_alignment_any,
@@ -714,15 +641,7 @@ fat_get_create_constraint_fat32 (const PedDevice* dev)
if (!ped_geometry_init (&full_dev, dev, 0, dev->length - 1))
return NULL;
-#if 0
- min_size = _get_create_size (dev->length, FAT_TYPE_FAT32,
- fat_min_cluster_size (FAT_TYPE_FAT32),
- fat_min_cluster_count (FAT_TYPE_FAT32));
- if (!min_size)
- return NULL;
-#else
min_size = 525224;
-#endif
return ped_constraint_new (
ped_alignment_any, ped_alignment_any,
@@ -730,97 +649,3 @@ fat_get_create_constraint_fat32 (const PedDevice* dev)
min_size, dev->length);
}
#endif /* !DISCOVER_ONLY */
-
-#if 0
-
-static PedFileSystemOps fat16_ops = {
- probe: fat_probe_fat16,
-#ifndef DISCOVER_ONLY
- clobber: fat_clobber,
- open: fat_open,
- create: fat_create_fat16,
- close: fat_close,
- check: fat_check,
- resize: fat_resize,
- copy: fat_copy,
- get_create_constraint: fat_get_create_constraint_fat16,
- get_resize_constraint: fat_get_resize_constraint,
- get_copy_constraint: fat_get_copy_constraint,
-#else /* !DISCOVER_ONLY */
- clobber: NULL,
- open: NULL,
- create: NULL,
- close: NULL,
- check: NULL,
- resize: NULL,
- copy: NULL,
- get_create_constraint: NULL,
- get_resize_constraint: NULL,
- get_copy_constraint: NULL,
-#endif /* !DISCOVER_ONLY */
-};
-
-static PedFileSystemOps fat32_ops = {
- probe: fat_probe_fat32,
-#ifndef DISCOVER_ONLY
- clobber: fat_clobber,
- open: fat_open,
- create: fat_create_fat32,
- close: fat_close,
- check: fat_check,
- resize: fat_resize,
- copy: fat_copy,
- get_create_constraint: fat_get_create_constraint_fat32,
- get_resize_constraint: fat_get_resize_constraint,
- get_copy_constraint: fat_get_copy_constraint,
-#else /* !DISCOVER_ONLY */
- clobber: NULL,
- open: NULL,
- create: NULL,
- close: NULL,
- check: NULL,
- resize: NULL,
- copy: NULL,
- get_create_constraint: NULL,
- get_resize_constraint: NULL,
- get_copy_constraint: NULL,
-#endif /* !DISCOVER_ONLY */
-};
-
-#define FAT_BLOCK_SIZES ((int[2]){512, 0})
-
-PedFileSystemType fat16_type = {
- next: NULL,
- ops: &fat16_ops,
- name: "fat16",
- block_sizes: FAT_BLOCK_SIZES
-};
-
-PedFileSystemType fat32_type = {
- next: NULL,
- ops: &fat32_ops,
- name: "fat32",
- block_sizes: FAT_BLOCK_SIZES
-};
-
-void
-ped_file_system_fat_init ()
-{
- if (sizeof (FatBootSector) != 512) {
- ped_exception_throw (PED_EXCEPTION_BUG, PED_EXCEPTION_CANCEL,
- _("GNU Parted was miscompiled: the FAT boot sector "
- "should be 512 bytes. FAT support will be disabled."));
- } else {
- ped_file_system_type_register (&fat16_type);
- ped_file_system_type_register (&fat32_type);
- }
-}
-
-void
-ped_file_system_fat_done ()
-{
- ped_file_system_type_unregister (&fat16_type);
- ped_file_system_type_unregister (&fat32_type);
-}
-
-#endif
diff --git a/libparted/fs/r/fat/resize.c b/libparted/fs/r/fat/resize.c
index 71113d4..2a0955d 100644
--- a/libparted/fs/r/fat/resize.c
+++ b/libparted/fs/r/fat/resize.c
@@ -446,23 +446,6 @@ fat_construct_new_fat (FatOpContext* ctx)
fat_table_set (new_fs_info->fat, new_cluster, new_next_cluster);
}
-#if 0
-#ifdef PED_VERBOSE
- for (old_cluster=2; old_cluster < old_fs_info->cluster_count+2;
- old_cluster++) {
- if (fat_table_is_available (old_fs_info->fat, old_cluster))
- continue;
-
- printf ("%d->%d\t(next: %d->%d)\n",
- old_cluster,
- ctx->remap [old_cluster],
- fat_table_get (old_fs_info->fat, old_cluster),
- fat_table_get (new_fs_info->fat,
- ctx->remap [old_cluster]));
- }
-#endif /* PED_VERBOSE */
-#endif
-
if (old_fs_info->fat_type == FAT_TYPE_FAT32
&& new_fs_info->fat_type == FAT_TYPE_FAT32) {
new_fs_info->root_cluster
--
2.26.2

View File

@ -1,228 +0,0 @@
From 0d5f047b2855f3d39fa3afe6ec2a6129d18ddf33 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 20 Nov 2020 13:22:52 -0800
Subject: [PATCH 40/42] fs/r/hfs: Remove disabled code
---
libparted/fs/r/hfs/hfs.c | 194 ---------------------------------------
1 file changed, 194 deletions(-)
diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c
index 09899da..1da093c 100644
--- a/libparted/fs/r/hfs/hfs.c
+++ b/libparted/fs/r/hfs/hfs.c
@@ -59,28 +59,6 @@ static PedFileSystemType hfsplus_type;
/* ----- HFS ----- */
-#if 0
-/* This is a very unundoable operation */
-/* Maybe I shouldn't touch the alternate MDB ? */
-/* Anyway clobber is call before other fs creation */
-/* So this is a non-issue */
-static int
-hfs_clobber (PedGeometry* geom)
-{
- uint8_t buf[PED_SECTOR_SIZE_DEFAULT];
-
- memset (buf, 0, PED_SECTOR_SIZE_DEFAULT);
-
- /* destroy boot blocks, mdb, alternate mdb ... */
- return (!!ped_geometry_write (geom, buf, 0, 1)) &
- (!!ped_geometry_write (geom, buf, 1, 1)) &
- (!!ped_geometry_write (geom, buf, 2, 1)) &
- (!!ped_geometry_write (geom, buf, geom->length - 2, 1)) &
- (!!ped_geometry_write (geom, buf, geom->length - 1, 1)) &
- (!!ped_geometry_sync (geom));
-}
-#endif
-
PedFileSystem *
hfs_open (PedGeometry* geom)
{
@@ -341,44 +319,6 @@ hfs_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer)
#include "reloc_plus.h"
#include "journal.h"
-#if 0
-static int
-hfsplus_clobber (PedGeometry* geom)
-{
- unsigned int i = 1;
- uint8_t buf[PED_SECTOR_SIZE_DEFAULT];
- HfsMasterDirectoryBlock *mdb;
-
- mdb = (HfsMasterDirectoryBlock *) buf;
-
- if (!ped_geometry_read (geom, buf, 2, 1))
- return 0;
-
- if (PED_BE16_TO_CPU (mdb->signature) == HFS_SIGNATURE) {
- /* embedded hfs+ */
- PedGeometry *embedded;
-
- i = PED_BE32_TO_CPU(mdb->block_size) / PED_SECTOR_SIZE_DEFAULT;
- embedded = ped_geometry_new (
- geom->dev,
- (PedSector) geom->start
- + PED_BE16_TO_CPU (mdb->start_block)
- + (PedSector) PED_BE16_TO_CPU (
- mdb->old_new.embedded.location.start_block ) * i,
- (PedSector) PED_BE16_TO_CPU (
- mdb->old_new.embedded.location.block_count ) * i );
- if (!embedded) i = 0;
- else {
- i = hfs_clobber (embedded);
- ped_geometry_destroy (embedded);
- }
- }
-
- /* non-embedded or envelop destroy as hfs */
- return ( hfs_clobber (geom) && i );
-}
-#endif
-
int
hfsplus_close (PedFileSystem *fs)
{
@@ -1224,137 +1164,3 @@ hfsplus_extract (PedFileSystem* fs, PedTimer* timer)
#endif /* HFS_EXTRACT_FS */
#endif /* !DISCOVER_ONLY */
-
-#if 0
-static PedFileSystemOps hfs_ops = {
- probe: hfs_probe,
-#ifndef DISCOVER_ONLY
- clobber: hfs_clobber,
- open: hfs_open,
- create: NULL,
- close: hfs_close,
-#ifndef HFS_EXTRACT_FS
- check: NULL,
-#else
- check: hfs_extract,
-#endif
- copy: NULL,
- resize: hfs_resize,
- get_create_constraint: NULL,
- get_resize_constraint: hfs_get_resize_constraint,
- get_copy_constraint: NULL,
-#else /* DISCOVER_ONLY */
- clobber: NULL,
- open: NULL,
- create: NULL,
- close: NULL,
- check: NULL,
- copy: NULL,
- resize: NULL,
- get_create_constraint: NULL,
- get_resize_constraint: NULL,
- get_copy_constraint: NULL,
-#endif /* DISCOVER_ONLY */
-};
-
-static PedFileSystemOps hfsplus_ops = {
- probe: hfsplus_probe,
-#ifndef DISCOVER_ONLY
- clobber: hfsplus_clobber,
- open: hfsplus_open,
- create: NULL,
- close: hfsplus_close,
-#ifndef HFS_EXTRACT_FS
- check: NULL,
-#else
- check: hfsplus_extract,
-#endif
- copy: NULL,
- resize: hfsplus_resize,
- get_create_constraint: NULL,
- get_resize_constraint: hfsplus_get_resize_constraint,
- get_copy_constraint: NULL,
-#else /* DISCOVER_ONLY */
- clobber: NULL,
- open: NULL,
- create: NULL,
- close: NULL,
- check: NULL,
- copy: NULL,
- resize: NULL,
- get_create_constraint: NULL,
- get_resize_constraint: NULL,
- get_copy_constraint: NULL,
-#endif /* DISCOVER_ONLY */
-};
-
-static PedFileSystemOps hfsx_ops = {
- probe: hfsx_probe,
-#ifndef DISCOVER_ONLY
- clobber: hfs_clobber, /* NOT hfsplus_clobber !
- HFSX can't be embedded */
- open: hfsplus_open,
- create: NULL,
- close: hfsplus_close,
-#ifndef HFS_EXTRACT_FS
- check: NULL,
-#else
- check: hfsplus_extract,
-#endif
- copy: NULL,
- resize: hfsplus_resize,
- get_create_constraint: NULL,
- get_resize_constraint: hfsplus_get_resize_constraint,
- get_copy_constraint: NULL,
-#else /* DISCOVER_ONLY */
- clobber: NULL,
- open: NULL,
- create: NULL,
- close: NULL,
- check: NULL,
- copy: NULL,
- resize: NULL,
- get_create_constraint: NULL,
- get_resize_constraint: NULL,
- get_copy_constraint: NULL,
-#endif /* DISCOVER_ONLY */
-};
-
-
-static PedFileSystemType hfs_type = {
- next: NULL,
- ops: &hfs_ops,
- name: "hfs",
- block_sizes: HFS_BLOCK_SIZES
-};
-
-static PedFileSystemType hfsplus_type = {
- next: NULL,
- ops: &hfsplus_ops,
- name: "hfs+",
- block_sizes: HFSP_BLOCK_SIZES
-};
-
-static PedFileSystemType hfsx_type = {
- next: NULL,
- ops: &hfsx_ops,
- name: "hfsx",
- block_sizes: HFSX_BLOCK_SIZES
-};
-
-void
-ped_file_system_hfs_init ()
-{
- ped_file_system_type_register (&hfs_type);
- ped_file_system_type_register (&hfsplus_type);
- ped_file_system_type_register (&hfsx_type);
-}
-
-void
-ped_file_system_hfs_done ()
-{
- ped_file_system_type_unregister (&hfs_type);
- ped_file_system_type_unregister (&hfsplus_type);
- ped_file_system_type_unregister (&hfsx_type);
-}
-#endif
--
2.26.2

View File

@ -1,108 +0,0 @@
From 945b13aed7e9762e00bda1b54e2c18eb3373a31d Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 20 Nov 2020 13:26:31 -0800
Subject: [PATCH 41/42] libparted: Remove disabled code
---
libparted/arch/gnu.c | 40 ----------------------------------------
libparted/labels/mac.c | 14 --------------
libparted/labels/pc98.c | 5 -----
3 files changed, 59 deletions(-)
diff --git a/libparted/arch/gnu.c b/libparted/arch/gnu.c
index 321b70a..922b93d 100644
--- a/libparted/arch/gnu.c
+++ b/libparted/arch/gnu.c
@@ -359,46 +359,6 @@ gnu_close (PedDevice* dev)
dev->dirty = 0;
}
-#if 0
- if (dev->dirty && dev->boot_dirty && dev->type != PED_DEVICE_FILE) {
- /* ouch! */
- ped_exception_throw (
- PED_EXCEPTION_WARNING,
- PED_EXCEPTION_OK,
- _("The partition table cannot be re-read. This means "
- "you need to reboot before mounting any "
- "modified partitions. You also need to reinstall "
- "your boot loader before you reboot (which may "
- "require mounting modified partitions). It is "
- "impossible do both things! So you'll need to "
- "boot off a rescue disk, and reinstall your boot "
- "loader from the rescue disk. Read section 4 of "
- "the Parted User documentation for more "
- "information."));
- return 1;
- }
-
- if (dev->dirty && dev->type != PED_DEVICE_FILE) {
- ped_exception_throw (
- PED_EXCEPTION_WARNING,
- PED_EXCEPTION_IGNORE,
- _("The partition table on %s cannot be re-read "
- "(%s). This means the Hurd knows nothing about any "
- "modifications you made. You should reboot your "
- "computer before doing anything with %s."),
- dev->path, strerror (errno), dev->path);
- }
-
- if (dev->boot_dirty && dev->type != PED_DEVICE_FILE) {
- ped_exception_throw (
- PED_EXCEPTION_WARNING,
- PED_EXCEPTION_OK,
- _("You should reinstall your boot loader before "
- "rebooting. Read section 4 of the Parted User "
- "documentation for more information."));
- }
-#endif
-
return 1;
}
diff --git a/libparted/labels/mac.c b/libparted/labels/mac.c
index 8980885..af9f4c3 100644
--- a/libparted/labels/mac.c
+++ b/libparted/labels/mac.c
@@ -560,20 +560,6 @@ _rawpart_analyse (MacRawPartition* raw_part, PedDisk* disk, int num)
mac_part_data->data_region_length
= PED_BE32_TO_CPU (raw_part->data_count);
- /* boot region - we have no idea what this is for, but Mac OSX
- * seems to put garbage here, and doesn't pay any attention to
- * it afterwards. [clausen, dan burcaw]
- */
-#if 0
- if (raw_part->boot_start) {
- ped_exception_throw (
- PED_EXCEPTION_ERROR,
- PED_EXCEPTION_CANCEL,
- _("The boot region doesn't start at the start "
- "of the partition."));
- goto error_destroy_part;
- }
-#endif
mac_part_data->boot_region_length
= PED_BE32_TO_CPU (raw_part->boot_count);
diff --git a/libparted/labels/pc98.c b/libparted/labels/pc98.c
index 328cd8d..b8993c4 100644
--- a/libparted/labels/pc98.c
+++ b/libparted/labels/pc98.c
@@ -418,13 +418,8 @@ fill_raw_part (PC98RawPartition* raw_part, const PedPartition* part)
return 0;
}
raw_part->end_cyl = PED_CPU_TO_LE16(c);
-#if 0
- raw_part->end_head = h;
- raw_part->end_sector = s;
-#else
raw_part->end_head = 0;
raw_part->end_sector = 0;
-#endif
return 1;
}
--
2.26.2

View File

@ -1,112 +0,0 @@
From 8df7974ac36fcea82551c3f6990f981b659e2635 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Fri, 20 Nov 2020 14:08:33 -0800
Subject: [PATCH 42/42] libparted/fs: Fix GCC warnings suggesting pure for
PED_ASSERT functions
There was some question about whether or not pure should be used for
functions with PED_ASSERT (or exit) in them. It should be fine, since
the values checked by the ASSERT are passed to the function directly.
Behavior should be exactly the same for the same inputs.
---
libparted/fs/r/fat/calc.c | 12 ++++++------
libparted/fs/r/fat/clstdup.c | 4 ++--
libparted/fs/r/hfs/cache.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libparted/fs/r/fat/calc.c b/libparted/fs/r/fat/calc.c
index 18e0455..26c4d18 100644
--- a/libparted/fs/r/fat/calc.c
+++ b/libparted/fs/r/fat/calc.c
@@ -369,7 +369,7 @@ fat_is_sector_in_clusters (const PedFileSystem* fs, PedSector sector)
+ fs_info->cluster_sectors * fs_info->cluster_count;
}
-FatFragment
+FatFragment _GL_ATTRIBUTE_PURE
fat_cluster_to_frag (const PedFileSystem* fs, FatCluster cluster)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -379,7 +379,7 @@ fat_cluster_to_frag (const PedFileSystem* fs, FatCluster cluster)
return (cluster - 2) * fs_info->cluster_frags;
}
-FatCluster
+FatCluster _GL_ATTRIBUTE_PURE
fat_frag_to_cluster (const PedFileSystem* fs, FatFragment frag)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -389,7 +389,7 @@ fat_frag_to_cluster (const PedFileSystem* fs, FatFragment frag)
return frag / fs_info->cluster_frags + 2;
}
-PedSector
+PedSector _GL_ATTRIBUTE_PURE
fat_frag_to_sector (const PedFileSystem* fs, FatFragment frag)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -399,7 +399,7 @@ fat_frag_to_sector (const PedFileSystem* fs, FatFragment frag)
return frag * fs_info->frag_sectors + fs_info->cluster_offset;
}
-FatFragment
+FatFragment _GL_ATTRIBUTE_PURE
fat_sector_to_frag (const PedFileSystem* fs, PedSector sector)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -409,7 +409,7 @@ fat_sector_to_frag (const PedFileSystem* fs, PedSector sector)
return (sector - fs_info->cluster_offset) / fs_info->frag_sectors;
}
-PedSector
+PedSector _GL_ATTRIBUTE_PURE
fat_cluster_to_sector (const PedFileSystem* fs, FatCluster cluster)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
@@ -420,7 +420,7 @@ fat_cluster_to_sector (const PedFileSystem* fs, FatCluster cluster)
+ fs_info->cluster_offset;
}
-FatCluster
+FatCluster _GL_ATTRIBUTE_PURE
fat_sector_to_cluster (const PedFileSystem* fs, PedSector sector)
{
FatSpecific* fs_info = FAT_SPECIFIC (fs);
diff --git a/libparted/fs/r/fat/clstdup.c b/libparted/fs/r/fat/clstdup.c
index 7456f60..cfd1552 100644
--- a/libparted/fs/r/fat/clstdup.c
+++ b/libparted/fs/r/fat/clstdup.c
@@ -126,7 +126,7 @@ fetch_fragments (FatOpContext* ctx)
/* finds the first fragment that is not going to get overwritten (that needs to
get read in) */
-static FatFragment
+static FatFragment _GL_ATTRIBUTE_PURE
get_first_underlay (const FatOpContext* ctx, int first, int last)
{
int old;
@@ -147,7 +147,7 @@ get_first_underlay (const FatOpContext* ctx, int first, int last)
/* finds the last fragment that is not going to get overwritten (that needs to
get read in) */
-static FatFragment
+static FatFragment _GL_ATTRIBUTE_PURE
get_last_underlay (const FatOpContext* ctx, int first, int last)
{
int old;
diff --git a/libparted/fs/r/hfs/cache.c b/libparted/fs/r/hfs/cache.c
index 5e5b071..fc11fe9 100644
--- a/libparted/fs/r/hfs/cache.c
+++ b/libparted/fs/r/hfs/cache.c
@@ -173,7 +173,7 @@ hfsc_cache_add_extent(HfsCPrivateCache* cache, uint32_t start, uint32_t length,
return ext;
}
-HfsCPrivateExtent*
+HfsCPrivateExtent* _GL_ATTRIBUTE_PURE
hfsc_cache_search_extent(HfsCPrivateCache* cache, uint32_t start)
{
HfsCPrivateExtent* ret;
--
2.26.2

7
gating.yaml Normal file
View File

@ -0,0 +1,7 @@
--- !Policy
product_versions:
- rhel-8
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -1,10 +1,7 @@
%define _sbindir /sbin
%define _libdir /%{_lib}
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.3.52
Release: 1%{?dist}
Version: 3.5
Release: 2%{?dist}
License: GPLv3+
URL: http://www.gnu.org/software/parted
@ -13,6 +10,18 @@ Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
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
Patch0006: 0006-libparted-Fix-handling-of-gpt-partition-types.patch
Patch0007: 0007-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch
Patch0008: 0008-libparted-Fix-handling-of-msdos-partition-types.patch
Patch0009: 0009-tests-Add-a-libparted-test-for-ped_partition_set_sys.patch
BuildRequires: gcc
BuildRequires: e2fsprogs-devel
BuildRequires: readline-devel
@ -24,7 +33,9 @@ BuildRequires: libuuid-devel
BuildRequires: libblkid-devel >= 2.17
BuildRequires: gnupg2
BuildRequires: git
BuildRequires: autoconf automake
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: e2fsprogs
BuildRequires: xfsprogs
BuildRequires: dosfstools
@ -33,6 +44,7 @@ BuildRequires: bc
Buildrequires: python3
BuildRequires: gperf
BuildRequires: make
BuildRequires: check-devel
# bundled gnulib library exception, as per packaging guidelines
# https://fedoraproject.org/wiki/Packaging:No_Bundled_Libraries
@ -64,8 +76,9 @@ gpg2 --verify %{SOURCE1} %{SOURCE0}
iconv -f ISO-8859-1 -t UTF8 AUTHORS > tmp; touch -r AUTHORS tmp; mv tmp AUTHORS
%build
autoreconf
autoconf
# RHEL has 2.69 which works fine with the macros parted uses
sed -i s/2.71/2.69/ configure.ac
autoreconf -fiv
CFLAGS="$RPM_OPT_FLAGS -Wno-unused-but-set-variable"; export CFLAGS
%configure --disable-static --disable-gcc-warnings
# Don't use rpath!
@ -100,9 +113,9 @@ make check
%{_mandir}/man8/parted.8.gz
%{_mandir}/man8/partprobe.8.gz
%{_libdir}/libparted.so.2
%{_libdir}/libparted.so.2.0.3
%{_libdir}/libparted.so.2.0.4
%{_libdir}/libparted-fs-resize.so.0
%{_libdir}/libparted-fs-resize.so.0.0.3
%{_libdir}/libparted-fs-resize.so.0.0.4
%{_infodir}/parted.info.*
%files devel
@ -115,6 +128,42 @@ make check
%changelog
* Tue Aug 09 2022 Brian C. Lane <bcl@redhat.com> - 3.5-2
- Fix ped_partition_set_system handling of existing flags
Resolves: rhbz#2116505
* Fri May 27 2022 Brian C. Lane <bcl@redhat.com> - 3.5-1
- Rebase to upstream release 3.5
- Drop patches included in new upstream tar
- Add upstream patches for new type command
- Add upstream patch for swap flag on DASD
Resolves: rhbz#1999333
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 3.4-6
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Tue Jun 15 2021 Brian C. Lane <bcl@redhat.com> - 3.4-5
- Install to /usr/sbin and /usr/lib64
Resolves: rhbz#1972346
* Thu Jun 10 2021 Brian C. Lane <bcl@redhat.com> - 3.4-4
- Fix issues that covscan classifies as important
Resolves: rhbz#1938836
- Work around a mkswap bug
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 3.4-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Wed Feb 03 2021 Brian C. Lane <bcl@redhat.com> - 3.4-2
- Add --fix support from upstream
* Wed Jan 27 2021 Brian C. Lane <bcl@redhat.com> - 3.4-1
- New stable upstream release v3.4
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.3.52-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Dec 14 2020 Brian C. Lane <bcl@redhat.com> - 3.3.52-1
- New upstream ALPHA release v3.3.52
- Includes all patches
@ -157,245 +206,3 @@ make check
- New upstream release v3.3
Includes the DASD virtio-blk fix.
- Dropping pre-3.2 changelog entries
* Wed Oct 02 2019 Brian C. Lane <bcl@redhat.com> - 3.2.153-2
- libparted/s390: Re-enabled virtio-attached DASD heuristics
Fixes DASD backed virtblk devices
* Mon Aug 12 2019 Brian C. Lane <bcl@redhat.com> - 3.2.153-1
- New upstream ALPHA release v3.2.153
- Includes all patches except the python2 -> python3 change for test helpers
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-43
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed Apr 24 2019 Björn Esser <besser82@fedoraproject.org> - 3.2-42
- Remove hardcoded gzip suffix from GNU info pages
* Tue Apr 09 2019 Brian C. Lane <bcl@redhat.com> - 3.2-41
- Add fix and tests for nilfs2 sigsegv
* Fri Mar 01 2019 Brian C. Lane <bcl@redhat.com> - 3.2-40
- Run the CI tests using rpmbuild
- t6000-dm: Stop using private lvm root
* Sun Feb 17 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.2-39
- Rebuild for readline 8.0
* Thu Jan 31 2019 Brian C. Lane <bcl@redhat.com> - 3.2-38
- Add missing patches from Wang Dong
- fix crash due to improper partition number (dongdwdw)
- fix wrong error label jump in mkpart (dongdwdw)
- clean the disk information when commands fail (dongdwdw)
- Remove PED_ASSERT from ped_partition_set_name (bcl)
- Added support for Windows recovery partition (Hans-Joachim.Baader)
* Tue Oct 16 2018 Brian C. Lane <bcl@redhat.com> - 3.2-37
- Read NVMe model names from sysfs (dann.frazier)
- Fix warnings from GCC 7's -Wimplicit-fallthrough (dann.frazier)
- ped_unit_get_name: Resolve conflicting attributes 'const' and 'pure' (dann.frazier)
- Add udf to t1700-probe-fs and to the manpage (bcl)
- libparted: Add support for MBR id, GPT GUID and detection of UDF filesystem (pali.rohar)
- Fix potential command line buffer overflow (xu.simon)
- t6100-mdraid-partitions: Use v0.90 metadata for the test (bcl)
- parted.c: Make sure dev_name is freed (bcl)
- parted.c: Always free peek_word (bcl)
- Fix the length of several strncpy calls (bcl)
* Thu Jul 19 2018 Brian C. Lane <bcl@redhat.com> - 3.2-36
- drop ldconfig, it no longer needs to be called on un/install (bcl)
- Fix msdos-overlap py3 conversion (bcl)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-35
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Jun 27 2018 Brian C. Lane <bcl@redhat.com> - 3.2-34
- Use python3 in buildroot
- Add make to BuildRequires
- Switch gpt-header-move and msdos-overlap to python3 (bcl)
- Modify gpt-header-move and msdos-overlap to work with py2 or py3 (bcl)
- Fix atari label false positives (psusi)
- Lift 512 byte restriction on fat resize (psusi)
- build: Remove unused traces of dynamic loading (cjwatson)
- Fix resizepart iec unit end sector (psusi)
- mkpart: Allow negative start value when FS-TYPE is not given (mail)
- Fix set and disk_set to not crash when no flags are supported (psusi)
- tests: fix t6100-mdraid-partitions (psusi)
- Fix make check (psusi)
- linux: Include <sys/sysmacros.h> for major() macro. (rjones)
* Thu Jun 07 2018 Brian C. Lane <bcl@redhat.com> - 3.2-33
- Use gpg2 for signature checking
* Sat Mar 24 2018 Richard W.M. Jones <rjones@redhat.com> - 3.2-32
- Fix for missing major/minor() macros in glibc 2.27.
* Mon Feb 19 2018 Brian C. Lane <bcl@redhat.com> - 3.2-31
- Add gcc BuildRequires for future minimal buildroot support
- Remove %%clean section
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-30
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Tue Dec 19 2017 Brian C. Lane <bcl@redhat.com> - 3.2-29
- Add support for NVDIMM devices (sparschauer)
- libparted/labels: link with libiconv if needed (arnout)
* Mon Jul 31 2017 Brian C. Lane <bcl@redhat.com> - 3.2-28
- atari.c: Drop xlocale.h
Resloves: rhbz#1476934
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Tue Jun 06 2017 Brian C. Lane <bcl@redhat.com> - 3.2-26
- libparted: Fix udev cookie leak in _dm_resize_partition (bcl)
Resolves: rhbz#1455564
* Mon May 01 2017 Brian C. Lane <bcl@redhat.com> - 3.2-25
+ Updating to upstream patches
- tests/t1701-rescue-fs wait for the device to appear. (bcl)
- Increase timeout for rmmod scsi_debug and make it a framework failure (bcl)
- libparted/dasd: add test cases for the new fdasd functions (dongdwdw)
- libparted/dasd: add an exception for changing DASD-LDL partition table
(dongdwdw)
- libpartd/dasd: improve flag processing for DASD-LDL (dongdwdw)
- parted/ui: remove unneccesary information of command line (dongdwdw)
- parted: check the name of partition first when to name a partition (dongdwdw)
- Add support for RAM drives (sparschauer)
- Fix crash when localized (psusi)
- libparted: Fix typo in hfs error message (sebras)
- libparted: Fix MacOS boot support (laurent)
- mac: copy partition type and name correctly (saproj)
- libparted: Add support for atari partition tables (glaubitz)
- libparted:tests: Move get_sector_size() to common.c (glaubitz)
- tests: Update t0220 and t0280 for the swap flag. (bcl)
- libparted: set swap flag on GPT partitions (aschnell)
- libparted/dasd: add test cases for the new fdasd functions (dongdwdw)
- libparted/dasd: add new fdasd functions (dongdwdw)
- libparted/dasd: update and improve fdasd functions (dongdwdw)
- libparted/dasd: unify vtoc handling for cdl/ldl (dongdwdw)
- libparted: Don't warn if no HDIO_GET_IDENTITY ioctl (sparschauer)
- libparted: Fix starting CHS in protective MBR (petr.uzel)
- tests: Stop timing t9040 (#1172675) (bcl)
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Thu Jan 12 2017 Igor Gnatenko <ignatenko@redhat.com> - 3.2-23
- Rebuild for readline 7.x
* Tue Oct 04 2016 Brian C. Lane <bcl@redhat.com> - 3.2-22
- tests: t3310-flags.sh: skip pc98 when sector size != 512 (bcl)
- tests: Set optimal blocks to 64 for scsi_debug devices (bcl)
- tests: t3310-flags.sh: Add tests for remaining table types (mike.fleetwood)
- tests: t3310-flags.sh: Add test for dvh table flags (mike.fleetwood)
- tests: t3310-flags.sh: Add test for mac table flags (mike.fleetwood)
- libparted: Remove commented local variable from bsd_partition_set_flag()
(mike.fleetwood)
- libparted: Fix to report success when setting lvm flag on bsd table
(mike.fleetwood)
- tests: t3310-flags.sh: Add test for bsd table flags (mike.fleetwood)
- tests: t3310-flags.sh: Stop excluding certain flags from being tested
(mike.fleetwood)
- tests: t3310-flags.sh: Query libparted for all flags to be tested
(mike.fleetwood)
- libparted: only IEC units are treated as exact (petr.uzel)
- docs: Improve partition description in parted.texi (gareth.randall)
- Add support for NVMe devices (petr.uzel)
- libparted/dasd: correct the offset where the first partition begins
(dongdwdw)
* Wed Jun 15 2016 Brian C. Lane <bcl@redhat.com> - 3.2-21
- Cleanup mkpart manpage entry (#1183077)
- doc: Add information about quoting
* Thu May 26 2016 Brian C. Lane <bcl@redhat.com> - 3.2-20
- libparted: Fix probing AIX disks on other arches
- partprobe: Open the device once for probing
* Tue Apr 12 2016 Brian C. Lane <bcl@redhat.com> 3.2-19
- libparted: Remove fdasd geometry code from alloc_metadata (#1244833) (bcl)
- parted: Display details of partition alignment failure (#726856) (bcl)
- docs: Add list of filesystems for fs-type (#1311596) (bcl)
- Use disk geometry as basis for ext2 sector sizes. (Steven.Lang)
- parted: fix the rescue command (psusi)
* Tue Mar 29 2016 Brian C. Lane <bcl@redhat.com> 3.2-18
- Use BLKSSZGET to get device sector size in _device_probe_geometry()
* Mon Mar 07 2016 Brian C. Lane <bcl@redhat.com> 3.2-17
- lib-fs-resize: Prevent crash resizing FAT with very deep directories
- Add libparted/fs/.libs/ to LD_LIBRARY_PATH during make check
* Mon Feb 29 2016 Brian C. Lane <bcl@redhat.com> 3.2-16
- Cleanup library path usage in specfile
pkgconfig wasn't finding libparted.pc because it was under /usr/lib64/
- Explicitly reference the library files instead of use wildcards.
- Move libparted-fs-resize.so to the -devel package where it belongs.
- Add a pkgconfig file for the filesystem resize library
- tests: Add udevadm settle to wait_for_ loop
- tests: Add wait to t9042
- tests: Fix t1700 failing on a host with a 4k xfs file
* Tue Feb 09 2016 Brian C. Lane <bcl@redhat.com> 3.2-15
- fdasd.c Safeguard against geometry misprobing.patch (#1305931)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.2-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Thu Oct 29 2015 Brian C. Lane <bcl@redhat.com> 3.2-13
- parted: fix build error on s390
* Tue Oct 27 2015 Brian C. Lane <bcl@redhat.com> 3.2-12
- dasd: enhance device probing
- fdasd: geometry handling updated from upstream s390-tools
* Fri Aug 07 2015 Brian C. Lane <bcl@redhat.com> 3.2-11
- tests: Fix patch 0012 test for extended partition length
- UI: Avoid memory leaks
- libparted: Fix memory leaks.patch
- libparted: Fix possible memory leaks.patch
- libparted: Stop converting . in-sys-path-to /
- libparted: Use read-only when probing devices on linux
- tests: Use wait_for_dev_to_ functions
* Mon Jul 13 2015 Brian C. Lane <bcl@redhat.com> 3.2-10
- parted: Fix crash with name command and no disklabel (#1226067)
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Fri Jun 05 2015 Brian C. Lane <bcl@redhat.com> 3.2-8
- tests: Make sure the extended partition length is 2 (#1135493)
- libparted: BLKPG_RESIZE_PARTITION uses bytes not sectors (#1135493)
* Tue Apr 28 2015 Brian C. Lane <bcl@redhat.com> 3.2-7
- Add python2 as a BuildRequires, used in some of the tests
* Tue Apr 28 2015 Brian C. Lane <bcl@redhat.com> 3.2-6
- Update manpage NAME so whatis will work (bcl)
- libparted: device mapper uses 512b sectors (bcl)
- tests: Add a test for device-mapper partition sizes (bcl)
- parted: don't crash in disk_set when disk label not found (psusi)
* Fri Nov 07 2014 Brian C. Lane <bcl@redhat.com> 3.2-5
- tests: Change minimum size to 256MiB for t1700-probe-fs
* Fri Oct 31 2014 Brian C. Lane <bcl@redhat.com> 3.2-4
- Update to current master commit ac74b83 to fix fat16 resize (#1159083)
- tests: t3000-resize-fs.sh: Add requirement on mkfs.vfat (mike.fleetwood)
- tests: t3000-resize-fs.sh: Add FAT16 resizing test (mike.fleetwood)
- lib-fs-resize: Prevent crash resizing FAT16 file systems (mike.fleetwood)
- libparted: also link to UUID_LIBS (heirecka)
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Wed Aug 13 2014 Brian C. Lane <bcl@redhat.com> 3.2-2
- Use a better patch to find the UTF8 locale for t0251
* Wed Jul 30 2014 Brian C. Lane <bcl@redhat.com> 3.2-1
- Rebase on upstream stable release v3.2
- Drop upstream patches.
- Patch t0251 to use en_US.UTF-8 if possible. Fedora doesn't have C.UTF-8

View File

@ -1,2 +1,2 @@
SHA512 (parted-3.3.52.tar.xz) = dceea49a7d26accecf68d447dbfc0078b99d0e4ecbfd565aee972c6a3a72e67165e5a32fad40ebf6b970ad6b93b4b42aa173532082f1a2071e92c1da8f3b4e87
SHA512 (parted-3.3.52.tar.xz.sig) = ffd382193a98213e155b8412cc8058d639d6cac1653fe2b0ba0bd0b4eaf6f89a62a91bb19ff8643bf68ca720fa36723553fd0b38c674a407de89fb3f1b120304
SHA512 (parted-3.5.tar.xz) = 87fc69e947de5f0b670ee5373a7cdf86180cd782f6d7280f970f217f73f55ee1b1b018563f48954f3a54fdde5974b33e07eee68c9ccdf08e621d3dc0e3ce126a
SHA512 (parted-3.5.tar.xz.sig) = 2ea1209325595416aa9ee27a0e85ca38bce50ca885d3b52ab1c1fb1b68b78d7887386ea3120274648056d2f1d9dca00b77236991765d84ad226c1b1f5a3f5c62

View File

@ -1,29 +1,8 @@
#!/bin/sh
set -eux
: ${1?"Usage: $0 TESTSDIR"}
TESTSDIR="$1"
SOURCEDIR="${TESTSDIR}/source/"
PACKAGE=parted
cd "${TESTSDIR}"
if [ ! -e ${PACKAGE}.spec ]; then
echo "Missing ${PACKAGE}.spec"
pwd
ls
exit 1
fi
# This runs from the ./tests/ directory
# Install the dependencies from the spec which MUST be copied over by tests.yml
dnf -y build-dep ${PACKAGE}.spec
# Flattened sources from standard-role-sources
cd "${SOURCEDIR}" || exit
# Rebuild the package in place, also runs the %check
# skip %prep, it was already run on the source before it was copied over
rpmbuild --noprep --nodeps -bb --build-in-place "${TESTSDIR}/${PACKAGE}.spec"
RET=$?
exit ${RET}
# make a small disk image
fallocate -l 100M ./disk.img
parted -s ./disk.img mklabel gpt
parted -s ./disk.img 'mkpart root 1MiB 100%'
parted -m -s ./disk.img u s p

View File

@ -1,14 +1,13 @@
---
# Run a simple parted test
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-source
required_packages:
- dnf
- rpm-build
- git
- role: standard-test-basic
tests:
- simple:
run: "./run_tests.sh {{ tenv_workdir }}"
- role: standard-test-basic
tags:
- classic
required_packages:
- parted
tests:
- simple:
run: ./run_tests.sh