Compare commits
14 Commits
openEuler-
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a528d8fb0b | ||
|
|
6baa6be874 | ||
|
|
ca76a7beaf | ||
|
|
46b3361c31 | ||
|
|
0852d0e10c | ||
|
|
c51f5c7d6f | ||
|
|
ab5ffe2f9a | ||
|
|
73ce41b454 | ||
|
|
18577beecc | ||
|
|
908f37a974 | ||
|
|
61b1abf4cd | ||
|
|
a0742a8d56 | ||
|
|
501e1ed1c3 | ||
|
|
11f8a62952 |
@ -1,19 +1,26 @@
|
|||||||
From 22be792bfd8e4a4da7495ec60084c23dd8a43677 Mon Sep 17 00:00:00 2001
|
From 7c5b213ab881dbf4a49673908092359f78bc13ce Mon Sep 17 00:00:00 2001
|
||||||
From: huangkaibin <huangkaibin@huawei.com>
|
From: huangkaibin <huangkaibin@huawei.com>
|
||||||
Date: Fri, 25 Jan 2019 19:46:52 +0000
|
Date: Fri, 25 Jan 2019 19:46:52 +0000
|
||||||
Subject: [PATCH] add-support-of-gpt_sync_mbr
|
Subject: [PATCH] add-support-of-gpt_sync_mbr
|
||||||
|
|
||||||
Hybrid MBR support is support by adding a new type of 'gpt_sync_mbr' for mklabel command.
|
Hybrid MBR support is support by adding a new type of 'gpt_sync_mbr' for mklabel command.
|
||||||
This feature is migrated from the path of "parted-gpt-mbr-sync.patch" of SUSE 12 SP1.
|
This feature is migrated from the path of "parted-gpt-mbr-sync.patch" of SUSE 12 SP1.
|
||||||
|
|
||||||
|
Compilation Error:
|
||||||
|
gpt.c:1345:50: error: 'GPTPartitionData' {aka 'struct _GPTPartitionData'}
|
||||||
|
has no member named 'boot'
|
||||||
|
This code has been refactored.'boot' is removed.
|
||||||
|
So we should call ped_partition_get_flag to instead.
|
||||||
|
Signed-off-by: Hongtao Zhang <zhanghongtao22@huawei.com>
|
||||||
---
|
---
|
||||||
libparted/labels/gpt.c | 246 ++++++++++++++++++++++++++++++++++++++++++++++++-
|
libparted/labels/gpt.c | 246 ++++++++++++++++++++++++++++++++++++++++-
|
||||||
1 file changed, 242 insertions(+), 4 deletions(-)
|
1 file changed, 242 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
|
||||||
index 4f922b2..b2dad71 100644
|
index 780fb70..f63d414 100644
|
||||||
--- a/libparted/labels/gpt.c
|
--- a/libparted/labels/gpt.c
|
||||||
+++ b/libparted/labels/gpt.c
|
+++ b/libparted/labels/gpt.c
|
||||||
@@ -306,6 +306,7 @@ typedef struct _GPTPartitionData
|
@@ -364,6 +364,7 @@ typedef struct _GPTPartitionData
|
||||||
} GPTPartitionData;
|
} GPTPartitionData;
|
||||||
|
|
||||||
static PedDiskType gpt_disk_type;
|
static PedDiskType gpt_disk_type;
|
||||||
@ -21,7 +28,7 @@ index 4f922b2..b2dad71 100644
|
|||||||
|
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
pth_get_size (const PedDevice *dev)
|
pth_get_size (const PedDevice *dev)
|
||||||
@@ -474,8 +475,54 @@ _pmbr_is_valid (const LegacyMBR_t *mbr)
|
@@ -530,8 +531,54 @@ _pmbr_is_valid (const LegacyMBR_t *mbr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,7 +84,7 @@ index 4f922b2..b2dad71 100644
|
|||||||
{
|
{
|
||||||
int gpt_sig_found = 0;
|
int gpt_sig_found = 0;
|
||||||
|
|
||||||
@@ -509,6 +556,19 @@ gpt_probe (const PedDevice *dev)
|
@@ -565,6 +612,19 @@ gpt_probe (const PedDevice *dev)
|
||||||
return gpt_sig_found;
|
return gpt_sig_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,10 +104,11 @@ index 4f922b2..b2dad71 100644
|
|||||||
static PedDisk *
|
static PedDisk *
|
||||||
gpt_alloc (const PedDevice *dev)
|
gpt_alloc (const PedDevice *dev)
|
||||||
{
|
{
|
||||||
@@ -554,6 +614,36 @@ error:
|
@@ -609,6 +669,36 @@ error:
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PedDisk *
|
+static PedDisk *
|
||||||
+gpt_sync_mbr_alloc (const PedDevice *dev)
|
+gpt_sync_mbr_alloc (const PedDevice *dev)
|
||||||
+{
|
+{
|
||||||
+ PedDisk *disk;
|
+ PedDisk *disk;
|
||||||
@ -130,11 +138,10 @@ index 4f922b2..b2dad71 100644
|
|||||||
+ return NULL;
|
+ return NULL;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static PedDisk *
|
static PedDisk *
|
||||||
gpt_duplicate (const PedDisk *disk)
|
gpt_duplicate (const PedDisk *disk)
|
||||||
{
|
{
|
||||||
PedDisk *new_disk;
|
@@ -983,7 +1073,7 @@ gpt_read (PedDisk *disk)
|
||||||
@@ -967,7 +1057,7 @@ gpt_read (PedDisk *disk)
|
|
||||||
|
|
||||||
/* motivation: let the user decide about the pmbr... during
|
/* motivation: let the user decide about the pmbr... during
|
||||||
ped_disk_probe(), they probably didn't get a choice... */
|
ped_disk_probe(), they probably didn't get a choice... */
|
||||||
@ -143,7 +150,7 @@ index 4f922b2..b2dad71 100644
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
GuidPartitionTableHeader_t *gpt = NULL;
|
GuidPartitionTableHeader_t *gpt = NULL;
|
||||||
@@ -1124,11 +1214,61 @@ error:
|
@@ -1140,11 +1230,61 @@ error:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +213,7 @@ index 4f922b2..b2dad71 100644
|
|||||||
/* The UEFI spec is not clear about what to do with the following
|
/* The UEFI spec is not clear about what to do with the following
|
||||||
elements of the Protective MBR (pmbr): BootCode (0-440B),
|
elements of the Protective MBR (pmbr): BootCode (0-440B),
|
||||||
UniqueMBRSignature (440B-444B) and Unknown (444B-446B).
|
UniqueMBRSignature (440B-444B) and Unknown (444B-446B).
|
||||||
@@ -1142,6 +1282,8 @@ _write_pmbr (PedDevice *dev, bool pmbr_boot)
|
@@ -1158,6 +1298,8 @@ _write_pmbr (PedDevice *dev, bool pmbr_boot)
|
||||||
memset (pmbr->PartitionRecord, 0, sizeof pmbr->PartitionRecord);
|
memset (pmbr->PartitionRecord, 0, sizeof pmbr->PartitionRecord);
|
||||||
|
|
||||||
pmbr->Signature = PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE);
|
pmbr->Signature = PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE);
|
||||||
@ -215,7 +222,7 @@ index 4f922b2..b2dad71 100644
|
|||||||
pmbr->PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI;
|
pmbr->PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI;
|
||||||
pmbr->PartitionRecord[0].StartSector = 2;
|
pmbr->PartitionRecord[0].StartSector = 2;
|
||||||
pmbr->PartitionRecord[0].EndHead = 0xFF;
|
pmbr->PartitionRecord[0].EndHead = 0xFF;
|
||||||
@@ -1154,6 +1296,60 @@ _write_pmbr (PedDevice *dev, bool pmbr_boot)
|
@@ -1170,6 +1312,60 @@ _write_pmbr (PedDevice *dev, bool pmbr_boot)
|
||||||
pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (dev->length - 1UL);
|
pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (dev->length - 1UL);
|
||||||
if (pmbr_boot)
|
if (pmbr_boot)
|
||||||
pmbr->PartitionRecord[0].BootIndicator = 0x80;
|
pmbr->PartitionRecord[0].BootIndicator = 0x80;
|
||||||
@ -268,7 +275,7 @@ index 4f922b2..b2dad71 100644
|
|||||||
+ pmbr->PartitionRecord[i].EndSector = 0xFF;
|
+ pmbr->PartitionRecord[i].EndSector = 0xFF;
|
||||||
+ pmbr->PartitionRecord[i].EndTrack = 0xFF;
|
+ pmbr->PartitionRecord[i].EndTrack = 0xFF;
|
||||||
+ pmbr->PartitionRecord[i].StartingLBA = PED_CPU_TO_LE32 (_part_32bitmax(part->geom.start));
|
+ pmbr->PartitionRecord[i].StartingLBA = PED_CPU_TO_LE32 (_part_32bitmax(part->geom.start));
|
||||||
+ if(((GPTPartitionData*)part->disk_specific)->boot)
|
+ if(ped_partition_get_flag(part, PED_PARTITION_BOOT))
|
||||||
+ pmbr->PartitionRecord[i].BootIndicator = 0x80;
|
+ pmbr->PartitionRecord[i].BootIndicator = 0x80;
|
||||||
+ pmbr->PartitionRecord[i].SizeInLBA = PED_CPU_TO_LE32 (_part_32bitmax(part->geom.end - part->geom.start + 1));
|
+ pmbr->PartitionRecord[i].SizeInLBA = PED_CPU_TO_LE32 (_part_32bitmax(part->geom.end - part->geom.start + 1));
|
||||||
+ }
|
+ }
|
||||||
@ -276,7 +283,7 @@ index 4f922b2..b2dad71 100644
|
|||||||
|
|
||||||
int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA,
|
int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA,
|
||||||
GPT_PMBR_SECTORS);
|
GPT_PMBR_SECTORS);
|
||||||
@@ -1273,7 +1469,7 @@ gpt_write (const PedDisk *disk)
|
@@ -1284,7 +1480,7 @@ gpt_write (const PedDisk *disk)
|
||||||
ptes_crc = efi_crc32 (ptes, ptes_bytes);
|
ptes_crc = efi_crc32 (ptes, ptes_bytes);
|
||||||
|
|
||||||
/* Write protective MBR */
|
/* Write protective MBR */
|
||||||
@ -285,7 +292,7 @@ index 4f922b2..b2dad71 100644
|
|||||||
goto error_free_ptes;
|
goto error_free_ptes;
|
||||||
|
|
||||||
/* Write PTH and PTEs */
|
/* Write PTH and PTEs */
|
||||||
@@ -2070,6 +2266,38 @@ static PedDiskOps gpt_disk_ops =
|
@@ -1916,6 +2112,38 @@ static PedDiskOps gpt_disk_ops =
|
||||||
PT_op_function_initializers (gpt)
|
PT_op_function_initializers (gpt)
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -324,8 +331,8 @@ index 4f922b2..b2dad71 100644
|
|||||||
static PedDiskType gpt_disk_type =
|
static PedDiskType gpt_disk_type =
|
||||||
{
|
{
|
||||||
next: NULL,
|
next: NULL,
|
||||||
@@ -2078,16 +2306,26 @@ static PedDiskType gpt_disk_type =
|
@@ -1925,16 +2153,26 @@ static PedDiskType gpt_disk_type =
|
||||||
features: PED_DISK_TYPE_PARTITION_NAME
|
PED_DISK_TYPE_DISK_UUID | PED_DISK_TYPE_PARTITION_UUID
|
||||||
};
|
};
|
||||||
|
|
||||||
+static PedDiskType gpt_sync_mbr_disk_type =
|
+static PedDiskType gpt_sync_mbr_disk_type =
|
||||||
@ -352,5 +359,5 @@ index 4f922b2..b2dad71 100644
|
|||||||
|
|
||||||
verify (sizeof (GuidPartitionEntryAttributes_t) == 8);
|
verify (sizeof (GuidPartitionEntryAttributes_t) == 8);
|
||||||
--
|
--
|
||||||
1.8.3.1
|
2.33.0
|
||||||
|
|
||||||
|
|||||||
@ -1,30 +0,0 @@
|
|||||||
From 31db44c74a96f8e2b495205d18525449e9b29543 Mon Sep 17 00:00:00 2001
|
|
||||||
From: "Brian C. Lane" <bcl@redhat.com>
|
|
||||||
Date: Wed, 15 Feb 2023 10:13:58 -0800
|
|
||||||
Subject: [PATCH 19/24] libparted: Fix potential NULL dereference in
|
|
||||||
ped_disk_next_partition
|
|
||||||
|
|
||||||
---
|
|
||||||
libparted/disk.c | 5 ++++-
|
|
||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/libparted/disk.c b/libparted/disk.c
|
|
||||||
index 345b9e7..8eba2c2 100644
|
|
||||||
--- a/libparted/disk.c
|
|
||||||
+++ b/libparted/disk.c
|
|
||||||
@@ -1552,8 +1552,11 @@ ped_disk_next_partition (const PedDisk* disk, const PedPartition* part)
|
|
||||||
return part->part_list ? part->part_list : part->next;
|
|
||||||
if (part->next)
|
|
||||||
return part->next;
|
|
||||||
- if (part->type & PED_PARTITION_LOGICAL)
|
|
||||||
+ if (part->type & PED_PARTITION_LOGICAL) {
|
|
||||||
+ if (!ped_disk_extended_partition (disk))
|
|
||||||
+ return NULL;
|
|
||||||
return ped_disk_extended_partition (disk)->next;
|
|
||||||
+ }
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
--
|
|
||||||
2.33.0
|
|
||||||
|
|
||||||
Binary file not shown.
BIN
parted-3.6.tar.xz
Normal file
BIN
parted-3.6.tar.xz
Normal file
Binary file not shown.
20
parted.spec
20
parted.spec
@ -15,8 +15,8 @@
|
|||||||
|
|
||||||
Summary: The GNU disk partition manipulation program
|
Summary: The GNU disk partition manipulation program
|
||||||
Name: parted
|
Name: parted
|
||||||
Version: 3.4
|
Version: 3.6
|
||||||
Release: 6
|
Release: 1
|
||||||
URL: https://www.gnu.org/software/parted/
|
URL: https://www.gnu.org/software/parted/
|
||||||
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
|
Source0: ftp://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
@ -35,8 +35,8 @@ Patch6: 0006-scsi_get_product_info-fix-memleak-and-avoid-to-use-N.patch
|
|||||||
Patch7: 0007-fat_op_context_new-free-ctx-remap-and-goto-correct-l.patch
|
Patch7: 0007-fat_op_context_new-free-ctx-remap-and-goto-correct-l.patch
|
||||||
Patch8: 0008-hfsplus_cache_from_extent-fix-memleak.patch
|
Patch8: 0008-hfsplus_cache_from_extent-fix-memleak.patch
|
||||||
Patch9: 0009-fat_clobber-set-boot_sector-NULL-and-free-boot_secto.patch
|
Patch9: 0009-fat_clobber-set-boot_sector-NULL-and-free-boot_secto.patch
|
||||||
Patch10:0010-parted-remove-patch-which-modifid-cyl-size.patch
|
|
||||||
Patch11:0011-libparted-Fix-potential-NULL-dereference-in-ped_disk.patch
|
Patch9000: 9000-parted-remove-patch-which-modifid-cyl-size.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
The GNU Parted program allows you to create, destroy, resize, move,
|
The GNU Parted program allows you to create, destroy, resize, move,
|
||||||
@ -121,11 +121,15 @@ fi
|
|||||||
%{_libdir}/pkgconfig/libparted*.pc
|
%{_libdir}/pkgconfig/libparted*.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Fri Mar 29 2024 Deyuan Fan <fandeyuan@kylinos.cn> - 3.4-6
|
* Mon Feb 26 2024 wangzhiqiang <wangzhiqiang95@huawei.com> - 3.6-1
|
||||||
- libparted: Fix potential NULL dereference in ped_disk_next_partition
|
- update to 3.6
|
||||||
|
- update version dependency
|
||||||
|
|
||||||
* Fri Dec 15 2023 wangzhiqiang <wangzhiqiang95@huawei.com> - 3.4-5
|
* Thu Dec 14 2023 lingsheng <lingsheng@xfusion.com> - 3.5-2
|
||||||
- remove patch which modify cyl-size
|
- remove patch which modifid cyl-size
|
||||||
|
|
||||||
|
* Wed Oct 26 2022 Hongtao Zhang <zhanghongtao22@huawei.com> - 3.5-1
|
||||||
|
- update to 3.5
|
||||||
|
|
||||||
* Thu Mar 3 2022 Li Jinlin <lijinlin3@huawei.com> - 3.4-4
|
* Thu Mar 3 2022 Li Jinlin <lijinlin3@huawei.com> - 3.4-4
|
||||||
- fix memory leak in libparted
|
- fix memory leak in libparted
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user