From b5a4ceef04faa0ed71e102b723984bdc2815feda6d6c058e7dac20c1f04a1242 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Thu, 9 Jan 2014 16:35:35 +0000 Subject: [PATCH 1/2] - update to parted-3.1 (fate#316110) - changes in parted-3.1: * Changes in behavior - Floppy drives are no longer scanned on linux: they cannot be partitioned anyhow, and some users have a misconfigured BIOS that claims to have a floppy when they don't, and scanning gets hung up. - parted: the mkpart command has changed semantics with regard to specifying the end of the partition. If the end is specified using units of MiB, GiB, etc., parted subtracts one sector from the specified value. With this change, it is now possible to create partitions like 1MiB-2MiB, 2MiB-3MiB and so on. * Many bugfixes (see changelog) - changes in parted-3.0: * Changes in behavior - Remove all FS-related (file system-related) sub-commands; these commands are no longer recognized because they were all dependent on parted "knowing" too much about file system: mkpartfs, mkfs, cp, move, check. - 'resize' command changed semantics: it no longer resizes the filesystem, but only moves end sector of the partition - libparted-devel contains libparted-fs-resize library - add ability to change size of the partition (ignoring contained filesystem) with 'resize' command; this command has different semantics than the former 'resize' command which upstream decided to drop - parted-resize-command.patch (fate#316110) - when using syncmbr on POWER, make the first partition type 0x41 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=79 --- always-resize-part.dif | 67 ---- do-not-create-dm-nodes.patch | 12 +- fix-dm-partition-name.patch | 14 +- fix-error-informing-the-kernel.patch | 8 +- fix-nilfs2-probe-function.patch | 38 --- hfs_fix.dif | 14 +- libparted-fix-mmcblk-partition-name.patch | 8 +- libparted-ppc-prepboot-in-syncmbr.patch | 18 + more-reliable-informing-the-kernel.patch | 21 +- parted-2.4-ncursesw6.patch | 14 +- parted-2.4.tar.gz | 3 - parted-2.4.tar.gz.sig | 17 - parted-3.1.tar.xz | 3 + parted-3.1.tar.xz.sig | 17 + ...tel-Rapid-Start-Technology-partition.patch | 90 ++--- parted-GPT-add-support-for-PReP-GUID.patch | 211 ++++++++++++ parted-btrfs-support.patch | 102 ++---- parted-fix-cciss-partition-naming.patch | 14 +- parted-fix-gpt-sync-on-BE-systems.patch | 33 -- parted-gpt-mbr-sync.patch | 255 +++++++++++--- parted-gpt-sync-mbr-label.patch | 287 ---------------- parted-improve-loop-support.patch | 157 --------- parted-mac.patch | 147 ++++---- parted-resize-command.patch | 122 +++++++ parted-type.patch | 250 +++++++------- parted-use-ext-range.patch | 22 -- parted-wipeaix.patch | 12 +- parted.changes | 49 +++ parted.spec | 78 +++-- ...ommands-to-manipulate-pMBR-boot-flag.patch | 313 ++++++++++++++++++ 30 files changed, 1346 insertions(+), 1050 deletions(-) delete mode 100644 always-resize-part.dif delete mode 100644 fix-nilfs2-probe-function.patch create mode 100644 libparted-ppc-prepboot-in-syncmbr.patch delete mode 100644 parted-2.4.tar.gz delete mode 100644 parted-2.4.tar.gz.sig create mode 100644 parted-3.1.tar.xz create mode 100644 parted-3.1.tar.xz.sig create mode 100644 parted-GPT-add-support-for-PReP-GUID.patch delete mode 100644 parted-fix-gpt-sync-on-BE-systems.patch delete mode 100644 parted-gpt-sync-mbr-label.patch delete mode 100644 parted-improve-loop-support.patch create mode 100644 parted-resize-command.patch delete mode 100644 parted-use-ext-range.patch create mode 100644 revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch diff --git a/always-resize-part.dif b/always-resize-part.dif deleted file mode 100644 index 3125128..0000000 --- a/always-resize-part.dif +++ /dev/null @@ -1,67 +0,0 @@ ---- - parted/parted.c | 24 +++++++++++++++++++++--- - 1 file changed, 21 insertions(+), 3 deletions(-) - -Index: parted/parted.c -=================================================================== ---- parted/parted.c.orig 2010-05-28 17:09:04.000000000 +0200 -+++ parted/parted.c 2010-07-08 13:26:06.000000000 +0200 -@@ -1917,7 +1917,7 @@ do_resize (PedDevice** dev) - issue_fs_op_warning ("resize"); - PedDisk *disk; - PedPartition *part = NULL; -- PedFileSystem *fs; -+ PedFileSystem *fs = NULL; - PedConstraint *constraint; - PedSector start, end; - PedGeometry *range_start = NULL, *range_end = NULL; -@@ -1959,22 +1959,39 @@ do_resize (PedDevice** dev) - goto error_destroy_constraint; - ped_partition_set_system (part, NULL); - } else { -+ int always_resize = getenv( "YAST_IS_RUNNING" ) != NULL; -+ const char* fsname = ""; -+ if( always_resize ) -+ { -+ PedFileSystemType* fst = ped_file_system_probe( &part->geom ); -+ if( fst ) -+ fsname = fst->name; -+ } - fs = ped_file_system_open (&part->geom); -- if (!fs) -+ if (!fs && (!always_resize || strncmp(fsname,"fat",3)==0) ) - goto error_destroy_disk; -+ if (fs) - constraint = constraint_intersect_and_destroy ( - ped_file_system_get_resize_constraint (fs), - constraint_from_start_end ( - *dev, range_start, range_end)); -+ else -+ { -+ new_geom.start = part->geom.start; -+ constraint = ped_constraint_exact(&new_geom); -+ } - if (!ped_disk_set_partition_geom (disk, part, constraint, - new_geom.start, new_geom.end)) - goto error_close_fs; -- if (!ped_file_system_resize (fs, &part->geom, g_timer)) -+ if(fs && (!always_resize || strncmp(fsname,"fat",3)==0)) -+ { -+ if (!ped_file_system_resize (fs, &part->geom, g_timer) && !always_resize ) - goto error_close_fs; - /* may have changed... eg fat16 -> fat32 */ - ped_partition_set_system (part, fs->type); - ped_file_system_close (fs); - } -+ } - - ped_disk_commit (disk); - ped_constraint_destroy (constraint); -@@ -1990,6 +2007,7 @@ do_resize (PedDevice** dev) - return 1; - - error_close_fs: -+ if (fs) - ped_file_system_close (fs); - error_destroy_constraint: - ped_constraint_destroy (constraint); diff --git a/do-not-create-dm-nodes.patch b/do-not-create-dm-nodes.patch index b270d0d..490d17e 100644 --- a/do-not-create-dm-nodes.patch +++ b/do-not-create-dm-nodes.patch @@ -1,7 +1,11 @@ -Index: parted-2.4/libparted/arch/linux.c +--- + libparted/arch/linux.c | 45 ++++++++++++++++++++++++++++----------------- + 1 file changed, 28 insertions(+), 17 deletions(-) + +Index: parted-3.1/libparted/arch/linux.c =================================================================== ---- parted-2.4.orig/libparted/arch/linux.c -+++ parted-2.4/libparted/arch/linux.c +--- parted-3.1.orig/libparted/arch/linux.c ++++ parted-3.1/libparted/arch/linux.c @@ -33,6 +33,7 @@ #include #include @@ -10,7 +14,7 @@ Index: parted-2.4/libparted/arch/linux.c #include #include #include -@@ -2770,29 +2771,39 @@ err: +@@ -2858,29 +2859,39 @@ err: static int _dm_reread_part_table (PedDisk* disk) { diff --git a/fix-dm-partition-name.patch b/fix-dm-partition-name.patch index 8f29361..13321ea 100644 --- a/fix-dm-partition-name.patch +++ b/fix-dm-partition-name.patch @@ -1,10 +1,14 @@ -Index: parted-2.4/libparted/arch/linux.c +--- + libparted/arch/linux.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: parted-3.1/libparted/arch/linux.c =================================================================== ---- parted-2.4.orig/libparted/arch/linux.c -+++ parted-2.4/libparted/arch/linux.c -@@ -2225,7 +2225,7 @@ _device_get_part_path (PedDevice *dev, i +--- parted-3.1.orig/libparted/arch/linux.c ++++ parted-3.1/libparted/arch/linux.c +@@ -2243,7 +2243,7 @@ _device_get_part_path (PedDevice *dev, i + || dev->type == PED_DEVICE_CPQARRAY || dev->type == PED_DEVICE_ATARAID - || dev->type == PED_DEVICE_DM || isdigit (dev->path[path_len - 1]) - ? "p" : ""); + ? "_part" : ""); diff --git a/fix-error-informing-the-kernel.patch b/fix-error-informing-the-kernel.patch index e60a390..23f2ba4 100644 --- a/fix-error-informing-the-kernel.patch +++ b/fix-error-informing-the-kernel.patch @@ -2,11 +2,11 @@ libparted/arch/linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -Index: parted-2.4/libparted/arch/linux.c +Index: parted-3.1/libparted/arch/linux.c =================================================================== ---- parted-2.4.orig/libparted/arch/linux.c -+++ parted-2.4/libparted/arch/linux.c -@@ -2376,7 +2376,7 @@ _blkpg_add_partition (PedDisk* disk, con +--- parted-3.1.orig/libparted/arch/linux.c ++++ parted-3.1/libparted/arch/linux.c +@@ -2370,7 +2370,7 @@ _blkpg_add_partition (PedDisk* disk, con linux_part.start = part->geom.start * disk->dev->sector_size; /* see fs/partitions/msdos.c:msdos_partition(): "leave room for LILO" */ if (part->type & PED_PARTITION_EXTENDED) diff --git a/fix-nilfs2-probe-function.patch b/fix-nilfs2-probe-function.patch deleted file mode 100644 index 47e99ef..0000000 --- a/fix-nilfs2-probe-function.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 2147402b83b27a35011cad032d0519c4a0672280 Mon Sep 17 00:00:00 2001 -From: Jim Meyering -Date: Sat, 25 Jun 2011 08:49:58 +0200 -Subject: [PATCH] libparted: fix a bug in the nilfs2 probe function - -* libparted/fs/nilfs2/nilfs2.c (nilfs2_probe): Reject this partition -if we get a negative sb2 offset. Passing a negative offset to -ped_geometry_read_alloc would evoke a failed assertion. -Bug introduced by 2010-07-09 commit d463e7de. -* NEWS: (Bug fixes): Mention it. -Reported by Daniel Fandrich in -http://thread.gmane.org/gmane.comp.gnu.parted.bugs/10466/focus=10472 ---- - NEWS | 3 +++ - libparted/fs/nilfs2/nilfs2.c | 5 +++-- - 2 files changed, 6 insertions(+), 2 deletions(-) - -Index: parted-2.4/libparted/fs/nilfs2/nilfs2.c -=================================================================== ---- parted-2.4.orig/libparted/fs/nilfs2/nilfs2.c -+++ parted-2.4/libparted/fs/nilfs2/nilfs2.c -@@ -108,13 +108,14 @@ nilfs2_probe (PedGeometry* geom) - struct nilfs2_super_block *sb = NULL; - struct nilfs2_super_block *sb2 = NULL; - PedSector length = geom->length; -- PedSector sb2off; - - /* ignore if sector size is not 512bytes for now */ - if (geom->dev->sector_size != PED_SECTOR_SIZE_DEFAULT) - return NULL; - -- sb2off = NILFS_SB2_OFFSET(length); -+ PedSector sb2off = NILFS_SB2_OFFSET(length); -+ if (sb2off <= 2) -+ return NULL; - - if (ped_geometry_read_alloc(geom, &sb_v, 2, 1)) - sb = sb_v; diff --git a/hfs_fix.dif b/hfs_fix.dif index 25d4a7d..85bae86 100644 --- a/hfs_fix.dif +++ b/hfs_fix.dif @@ -1,8 +1,12 @@ -Index: parted-2.3/libparted/labels/mac.c +--- + libparted/labels/mac.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +Index: parted-3.1/libparted/labels/mac.c =================================================================== ---- parted-2.3.orig/libparted/labels/mac.c 2010-07-08 13:29:24.000000000 +0200 -+++ parted-2.3/libparted/labels/mac.c 2010-07-08 13:29:25.000000000 +0200 -@@ -469,7 +469,7 @@ _rawpart_is_void (MacRawPartition* raw_p +--- parted-3.1.orig/libparted/labels/mac.c ++++ parted-3.1/libparted/labels/mac.c +@@ -468,7 +468,7 @@ _rawpart_is_void (MacRawPartition* raw_p return _rawpart_cmp_type (raw_part, "Apple_Void"); } @@ -11,7 +15,7 @@ Index: parted-2.3/libparted/labels/mac.c * doesn't represent a partition at all. NOTE: some people make Apple_Free * partitions with MacOS, because they can't select another type. So, if the * name is anything other than "Extra" or "", it is treated as a "real" -@@ -534,6 +534,13 @@ _rawpart_analyse (MacRawPartition* raw_p +@@ -533,6 +533,13 @@ _rawpart_analyse (MacRawPartition* raw_p if (!part) goto error; diff --git a/libparted-fix-mmcblk-partition-name.patch b/libparted-fix-mmcblk-partition-name.patch index 96fb5ea..e0a11aa 100644 --- a/libparted-fix-mmcblk-partition-name.patch +++ b/libparted-fix-mmcblk-partition-name.patch @@ -2,11 +2,11 @@ libparted/arch/linux.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -Index: parted-2.4/libparted/arch/linux.c +Index: parted-3.1/libparted/arch/linux.c =================================================================== ---- parted-2.4.orig/libparted/arch/linux.c -+++ parted-2.4/libparted/arch/linux.c -@@ -2227,7 +2227,8 @@ _device_get_part_path (PedDevice *dev, i +--- parted-3.1.orig/libparted/arch/linux.c ++++ parted-3.1/libparted/arch/linux.c +@@ -2240,7 +2240,8 @@ _device_get_part_path (PedDevice *dev, i (int) (path_len - 5), dev->path, num); } else { const char *p; diff --git a/libparted-ppc-prepboot-in-syncmbr.patch b/libparted-ppc-prepboot-in-syncmbr.patch new file mode 100644 index 0000000..ac83d9c --- /dev/null +++ b/libparted-ppc-prepboot-in-syncmbr.patch @@ -0,0 +1,18 @@ +--- + libparted/labels/gpt.c | 3 +++ + 1 file changed, 3 insertions(+) + +Index: parted-3.1/libparted/labels/gpt.c +=================================================================== +--- parted-3.1.orig/libparted/labels/gpt.c ++++ parted-3.1/libparted/labels/gpt.c +@@ -1181,6 +1181,9 @@ _part_to_ostype (PedPartition* part) + if (strncmp (part->fs_type->name, "hfs", 3) == 0) return 0xaf; + if (strstr (part->fs_type->name, "swap")) return 0x82; + } ++#ifdef __PPC__ ++ if (part->num == 1) return 0x41; /* PARTITION_PREP */ ++#endif + return 0x83; // Everything else is Linux + } + diff --git a/more-reliable-informing-the-kernel.patch b/more-reliable-informing-the-kernel.patch index f48327b..868ecf0 100644 --- a/more-reliable-informing-the-kernel.patch +++ b/more-reliable-informing-the-kernel.patch @@ -10,13 +10,14 @@ # 3. call 'udevadm settle' before doing BLKPG_DEL_PARTITION ioctl() --- libparted/arch/linux.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) + parted/parted.c | 28 +++++++++++++++++++++++++++- + 2 files changed, 30 insertions(+), 2 deletions(-) -Index: parted-2.3/libparted/arch/linux.c +Index: parted-3.1/libparted/arch/linux.c =================================================================== ---- parted-2.3.orig/libparted/arch/linux.c -+++ parted-2.3/libparted/arch/linux.c -@@ -2460,10 +2460,12 @@ _disk_sync_part_table (PedDisk* disk) +--- parted-3.1.orig/libparted/arch/linux.c ++++ parted-3.1/libparted/arch/linux.c +@@ -2585,10 +2585,12 @@ _disk_sync_part_table (PedDisk* disk) if (!errnums) goto cleanup; @@ -30,11 +31,11 @@ Index: parted-2.3/libparted/arch/linux.c unsigned int n_sleep = (max_sleep_seconds * 1000000 / sleep_microseconds); int i; -Index: parted-2.3/parted/parted.c +Index: parted-3.1/parted/parted.c =================================================================== ---- parted-2.3.orig/parted/parted.c -+++ parted-2.3/parted/parted.c -@@ -272,6 +272,32 @@ _disk_warn_loss (PedDisk* disk) +--- parted-3.1.orig/parted/parted.c ++++ parted-3.1/parted/parted.c +@@ -258,6 +258,32 @@ _disk_warn_loss (PedDisk* disk) disk->dev->path) == PED_EXCEPTION_YES; } @@ -67,7 +68,7 @@ Index: parted-2.3/parted/parted.c /* This function changes "sector" to "new_sector" if the new value lies * within the required range. */ -@@ -2200,7 +2226,7 @@ do_set (PedDevice** dev) +@@ -1643,7 +1669,7 @@ do_set (PedDevice** dev) if (!ped_partition_set_flag (part, flag, state)) goto error_destroy_disk; diff --git a/parted-2.4-ncursesw6.patch b/parted-2.4-ncursesw6.patch index 54cbfb2..0a3e1ea 100644 --- a/parted-2.4-ncursesw6.patch +++ b/parted-2.4-ncursesw6.patch @@ -1,6 +1,12 @@ ---- configure.ac.orig -+++ configure.ac -@@ -178,7 +178,8 @@ AM_CPPFLAGS="$AM_CPPFLAGS -D_REENTRANT" +--- + configure.ac | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +Index: parted-3.1/configure.ac +=================================================================== +--- parted-3.1.orig/configure.ac ++++ parted-3.1/configure.ac +@@ -164,7 +164,8 @@ AM_CPPFLAGS="$AM_CPPFLAGS -D_REENTRANT" dnl Check for programs. AC_ISC_POSIX @@ -10,7 +16,7 @@ AC_PROG_GCC_TRADITIONAL AM_PROG_CC_C_O -@@ -384,7 +385,7 @@ dnl Check for termcap +@@ -371,7 +372,7 @@ dnl Check for termcap if test "$with_readline" = yes; then OLD_LIBS="$LIBS" LIBS="" diff --git a/parted-2.4.tar.gz b/parted-2.4.tar.gz deleted file mode 100644 index d14cc12..0000000 --- a/parted-2.4.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:965e5a661d3cb721c0aafc64f440c6c88699c8ec44bae09b7d3dc816df00ab14 -size 3177408 diff --git a/parted-2.4.tar.gz.sig b/parted-2.4.tar.gz.sig deleted file mode 100644 index 10de6c6..0000000 --- a/parted-2.4.tar.gz.sig +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.11 (GNU/Linux) - -iQIcBAABCAAGBQJN0/ZsAAoJEH/Z/MsAC+7uOTAQAKniexcRs0Qh3j454i3HI6O+ -aVbcfKfb3BmPLNK97dL1gXoslagO/NEjTmV1SdMtyHp7wqQBnXmM88WudS7aHK85 -YKEDlkknUtttEG8WornCJCG40VX2Z4dvEYLekVxr7bR8ZM1KzTVKioihm71/9oYe -eP3JsVREGQ8w62ovZeOx5aVcCXGUxMe6KPebf3XUWtxGj52hVf2Jpc3tA7B4+2IR -mM514AUIMT5yrk2djcoAEmaRvwtQ5F94HPrYwz80META5DZ3ABRmCt5feAqdTgUU -4YM11KiN2fFf4TWalN+ol8LyUyNOTcT7zScVeIw8Pt5L/7vnFmgwlh2mVUFtLz5b -wKSIn02LD8d5az+dZGjJFU16CvvwimIxdLRdMIIer5gLdPPVPQcmxA88sinu7VAn -8VywCCz8EF64Y+KsPDfRKV4Tx/8k+MVF33u/3yV9x2xEEKv3+4lX3w9JCCgZzKdv -KwX6XpNYClRGoc6IeeNoyJvOnV8eh/2wBMywbXY9GQiqeLryLJ2r0JIHrVYtVqje -dfoSMIKnl1cYi+kWdprdSfBzLoVxNGRly5zq2LGPl9NPIR5SCzd9iOw8ValBY7X4 -lqY5umyvGL09VHGRPJ5c70ygMvYg+hvRz7jbCzjtlx9bxu4ukXQtrHp7WeYG4OY0 -0NW0+mn/FTrphvKCs1Ri -=mleT ------END PGP SIGNATURE----- diff --git a/parted-3.1.tar.xz b/parted-3.1.tar.xz new file mode 100644 index 0000000..33f576a --- /dev/null +++ b/parted-3.1.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5e9cc1f91eaf016e5033d85b9b893fd6d3ffaca532a48de1082df9b94225ca15 +size 1524344 diff --git a/parted-3.1.tar.xz.sig b/parted-3.1.tar.xz.sig new file mode 100644 index 0000000..544eaa5 --- /dev/null +++ b/parted-3.1.tar.xz.sig @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.12 (GNU/Linux) + +iQIcBAABCAAGBQJPUQeUAAoJEH/Z/MsAC+7uwS0P/iplXKYgLCZ7PXhAy2QWSEgC +yEDNUN2hdK5RqXPzmyzTEObflRRkVQV8nWLBg9r5jCXKBKl0OEiBDSd9jwbdUSwI +6ueSsbrLLpwnQkqBsh7F9zwIJ2xDsPYmhOqxTbXpITn8fv9MAMPFm0+pGYgIPC4o +JITcP+8ufjjQpdecv/EmiM+3rrcMxgVi7/F158uj+ih4mxl7L4APG2hIib+Xdd8x +lqzVogAQoW6n5uoQo/F2zcGv/NPMH7LqwH435VEzc3FTEKQ4ArZ6o/hYasMALW2F +iXyjxQKDPBmiXOkKwmhRCBQtFVk1rpy6JSw07ljL2sZlScnKvq3AA9ufomdlgtIR +vBDRjkJeB1W12sk75eQRiP1RS3+TT1rpo9kvE4a1iZkMWrHPvaCDKM48MdN/Nvb6 +nLafTM2FsHPEZ9HJCmEY4LRH0zmTJQy8KW5XSHFJgEhk22Jk5S951uTkM1sEbvHL +RRZHIGs/RZwetIUvFFEE87hZJ6OWO0XVStUnA+ik255XgN8Ik5o4K50hI3qU0/e3 +3faMq6MpBYfQn5z1SO99/TE70hjyi8Q5E+SpuF3qn4cfhYi3zn8e6OaGNLVOXcWU +5/9WI5v9a5br/74RmIElsieetnMvlpbe9feAvsziQooNPe584qlQq7SXVegcXGNu +MUrTB6SjxheBtLqH0PlX +=0NA7 +-----END PGP SIGNATURE----- diff --git a/parted-Add-Intel-Rapid-Start-Technology-partition.patch b/parted-Add-Intel-Rapid-Start-Technology-partition.patch index 17f37b0..11ccac5 100644 --- a/parted-Add-Intel-Rapid-Start-Technology-partition.patch +++ b/parted-Add-Intel-Rapid-Start-Technology-partition.patch @@ -15,9 +15,11 @@ This adds support for the irst partition type flag. Sets the type to libparted/labels/gpt.c | 37 +++++++++++++++++++++++++++++++++++++ 5 files changed, 64 insertions(+), 3 deletions(-) ---- parted-2.4.orig/doc/C/parted.8 -+++ parted-2.4/doc/C/parted.8 -@@ -132,7 +132,7 @@ or an LVM logical volume if necessary. +Index: parted-3.1/doc/C/parted.8 +=================================================================== +--- parted-3.1.orig/doc/C/parted.8 ++++ parted-3.1/doc/C/parted.8 +@@ -104,7 +104,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", @@ -26,9 +28,29 @@ This adds support for the irst partition type flag. Sets the type to \fIstate\fP should be either "on" or "off". .TP .B unit \fIunit\fP ---- parted-2.4.orig/libparted/disk.c -+++ parted-2.4/libparted/disk.c -@@ -2472,6 +2472,8 @@ ped_partition_flag_get_name (PedPartitio +Index: parted-3.1/include/parted/disk.h +=================================================================== +--- parted-3.1.orig/include/parted/disk.h ++++ parted-3.1/include/parted/disk.h +@@ -73,10 +73,11 @@ enum _PedPartitionFlag { + PED_PARTITION_APPLE_TV_RECOVERY=13, + PED_PARTITION_DIAG=14, + PED_PARTITION_LEGACY_BOOT=15, +- PED_PARTITION_TYPE=16 ++ PED_PARTITION_TYPE=16, ++ PED_PARTITION_IRST=17 + }; + #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT +-#define PED_PARTITION_LAST_FLAG PED_PARTITION_TYPE ++#define PED_PARTITION_LAST_FLAG PED_PARTITION_IRST + + enum _PedDiskTypeFeature { + PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ +Index: parted-3.1/libparted/disk.c +=================================================================== +--- parted-3.1.orig/libparted/disk.c ++++ parted-3.1/libparted/disk.c +@@ -2473,6 +2473,8 @@ ped_partition_flag_get_name (PedPartitio return N_("diag"); case PED_PARTITION_LEGACY_BOOT: return N_("legacy_boot"); @@ -37,8 +59,10 @@ This adds support for the irst partition type flag. Sets the type to default: ped_exception_throw ( ---- parted-2.4.orig/libparted/labels/dos.c -+++ parted-2.4/libparted/labels/dos.c +Index: parted-3.1/libparted/labels/dos.c +=================================================================== +--- parted-3.1.orig/libparted/labels/dos.c ++++ parted-3.1/libparted/labels/dos.c @@ -85,6 +85,7 @@ static const char MBR_BOOT_CODE[] = { #define PARTITION_LDM 0x42 #define PARTITION_LINUX_SWAP 0x82 @@ -137,8 +161,10 @@ This adds support for the irst partition type flag. Sets the type to case PED_PARTITION_DIAG: return 1; ---- parted-2.4.orig/libparted/labels/gpt.c -+++ parted-2.4/libparted/labels/gpt.c +Index: parted-3.1/libparted/labels/gpt.c +=================================================================== +--- parted-3.1.orig/libparted/labels/gpt.c ++++ parted-3.1/libparted/labels/gpt.c @@ -142,6 +142,10 @@ typedef struct ((efi_guid_t) { PED_CPU_TO_LE32 (0x5265636F), PED_CPU_TO_LE16 (0x7665), \ PED_CPU_TO_LE16 (0x11AA), 0xaa, 0x11, \ @@ -158,7 +184,7 @@ This adds support for the irst partition type flag. Sets the type to } GPTPartitionData; static PedDiskType gpt_disk_type; -@@ -879,6 +884,7 @@ _parse_part_entry (PedDisk *disk, GuidPa +@@ -883,6 +888,7 @@ _parse_part_entry (PedDisk *disk, GuidPa = gpt_part_data->hidden = gpt_part_data->msftres = gpt_part_data->msftrecv = gpt_part_data->legacy_boot @@ -166,7 +192,7 @@ This adds support for the irst partition type flag. Sets the type to = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; if (pte->Attributes.RequiredToFunction & 0x1) -@@ -902,6 +908,8 @@ _parse_part_entry (PedDisk *disk, GuidPa +@@ -906,6 +912,8 @@ _parse_part_entry (PedDisk *disk, GuidPa gpt_part_data->msftrecv = 1; else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID)) gpt_part_data->atvrecv = 1; @@ -175,7 +201,7 @@ This adds support for the irst partition type flag. Sets the type to return part; } -@@ -1509,6 +1517,7 @@ gpt_partition_new (const PedDisk *disk, +@@ -1518,6 +1526,7 @@ gpt_partition_new (const PedDisk *disk, gpt_part_data->msftrecv = 0; gpt_part_data->atvrecv = 0; gpt_part_data->legacy_boot = 0; @@ -183,7 +209,7 @@ This adds support for the irst partition type flag. Sets the type to uuid_generate ((unsigned char *) &gpt_part_data->uuid); swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid)); memset (gpt_part_data->name, 0, sizeof gpt_part_data->name); -@@ -1614,6 +1623,11 @@ gpt_partition_set_system (PedPartition * +@@ -1621,6 +1630,11 @@ gpt_partition_set_system (PedPartition * gpt_part_data->type = PARTITION_APPLE_TV_RECOVERY_GUID; return 1; } @@ -195,7 +221,7 @@ This adds support for the irst partition type flag. Sets the type to if (fs_type) { -@@ -1714,6 +1728,7 @@ gpt_partition_set_flag (PedPartition *pa +@@ -1721,6 +1735,7 @@ gpt_partition_set_flag (PedPartition *pa = gpt_part_data->hp_service = gpt_part_data->msftres = gpt_part_data->msftrecv @@ -203,7 +229,7 @@ This adds support for the irst partition type flag. Sets the type to = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_BIOS_GRUB: -@@ -1725,6 +1740,7 @@ gpt_partition_set_flag (PedPartition *pa +@@ -1732,6 +1747,7 @@ gpt_partition_set_flag (PedPartition *pa = gpt_part_data->hp_service = gpt_part_data->msftres = gpt_part_data->msftrecv @@ -211,7 +237,7 @@ This adds support for the irst partition type flag. Sets the type to = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_RAID: -@@ -1736,6 +1752,7 @@ gpt_partition_set_flag (PedPartition *pa +@@ -1743,6 +1759,7 @@ gpt_partition_set_flag (PedPartition *pa = gpt_part_data->hp_service = gpt_part_data->msftres = gpt_part_data->msftrecv @@ -219,7 +245,7 @@ This adds support for the irst partition type flag. Sets the type to = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_LVM: -@@ -1747,6 +1764,7 @@ gpt_partition_set_flag (PedPartition *pa +@@ -1754,6 +1771,7 @@ gpt_partition_set_flag (PedPartition *pa = gpt_part_data->hp_service = gpt_part_data->msftres = gpt_part_data->msftrecv @@ -227,7 +253,7 @@ This adds support for the irst partition type flag. Sets the type to = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_HPSERVICE: -@@ -1758,6 +1776,7 @@ gpt_partition_set_flag (PedPartition *pa +@@ -1765,6 +1783,7 @@ gpt_partition_set_flag (PedPartition *pa = gpt_part_data->bios_grub = gpt_part_data->msftres = gpt_part_data->msftrecv @@ -235,7 +261,7 @@ This adds support for the irst partition type flag. Sets the type to = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_MSFT_RESERVED: -@@ -1769,6 +1788,7 @@ gpt_partition_set_flag (PedPartition *pa +@@ -1776,6 +1795,7 @@ gpt_partition_set_flag (PedPartition *pa = gpt_part_data->bios_grub = gpt_part_data->hp_service = gpt_part_data->msftrecv @@ -243,7 +269,7 @@ This adds support for the irst partition type flag. Sets the type to = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_DIAG: -@@ -1780,6 +1800,7 @@ gpt_partition_set_flag (PedPartition *pa +@@ -1787,6 +1807,7 @@ gpt_partition_set_flag (PedPartition *pa = gpt_part_data->bios_grub = gpt_part_data->hp_service = gpt_part_data->msftres @@ -251,7 +277,7 @@ This adds support for the irst partition type flag. Sets the type to = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_APPLE_TV_RECOVERY: -@@ -1791,8 +1812,21 @@ gpt_partition_set_flag (PedPartition *pa +@@ -1798,8 +1819,21 @@ gpt_partition_set_flag (PedPartition *pa = gpt_part_data->bios_grub = gpt_part_data->hp_service = gpt_part_data->msftres @@ -273,7 +299,7 @@ This adds support for the irst partition type flag. Sets the type to case PED_PARTITION_HIDDEN: gpt_part_data->hidden = state; return 1; -@@ -1837,6 +1871,8 @@ gpt_partition_get_flag (const PedPartiti +@@ -1844,6 +1878,8 @@ gpt_partition_get_flag (const PedPartiti return gpt_part_data->hidden; case PED_PARTITION_LEGACY_BOOT: return gpt_part_data->legacy_boot; @@ -282,7 +308,7 @@ This adds support for the irst partition type flag. Sets the type to case PED_PARTITION_SWAP: case PED_PARTITION_LBA: case PED_PARTITION_ROOT: -@@ -1862,6 +1898,7 @@ gpt_partition_is_flag_available (const P +@@ -1869,6 +1905,7 @@ gpt_partition_is_flag_available (const P case PED_PARTITION_APPLE_TV_RECOVERY: case PED_PARTITION_HIDDEN: case PED_PARTITION_LEGACY_BOOT: @@ -290,19 +316,3 @@ This adds support for the irst partition type flag. Sets the type to return 1; case PED_PARTITION_SWAP: case PED_PARTITION_ROOT: ---- parted-2.4.orig/include/parted/disk.h -+++ parted-2.4/include/parted/disk.h -@@ -71,10 +71,11 @@ enum _PedPartitionFlag { - PED_PARTITION_APPLE_TV_RECOVERY=13, - PED_PARTITION_DIAG=14, - PED_PARTITION_LEGACY_BOOT=15, -- PED_PARTITION_TYPE=16 -+ PED_PARTITION_TYPE=16, -+ PED_PARTITION_IRST=17 - }; - #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT --#define PED_PARTITION_LAST_FLAG PED_PARTITION_TYPE -+#define PED_PARTITION_LAST_FLAG PED_PARTITION_IRST - - enum _PedDiskTypeFeature { - PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ diff --git a/parted-GPT-add-support-for-PReP-GUID.patch b/parted-GPT-add-support-for-PReP-GUID.patch new file mode 100644 index 0000000..48ddada --- /dev/null +++ b/parted-GPT-add-support-for-PReP-GUID.patch @@ -0,0 +1,211 @@ +From d151cc20af79c89383ffacc89c1f646f831fc3e6 Mon Sep 17 00:00:00 2001 +From: Daniel Battaiola Kreling +Date: Mon, 7 Oct 2013 11:51:50 +0530 +Subject: [PATCH] GPT: add support for PReP GUID + +PReP (PowerPC Reference Platform) boot partition is the first partition used in +PowerPC platform for containing the bootable kernel or bootloader. The firmware +searches for this partition and jumps to it for booting. So far no GUID was +specified for this partition type and hence booting from GPT disk was not +supported on this platform. A new GUID 9e1a2d38-c612-4316-aa26-8b49521e5a8b for +PReP partition is proposed to be included in GPT. +--- + NEWS | 7 +++++++ + doc/parted.texi | 2 +- + libparted/labels/gpt.c | 38 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 46 insertions(+), 1 deletion(-) + +Index: parted-3.1/NEWS +=================================================================== +--- parted-3.1.orig/NEWS ++++ parted-3.1/NEWS +@@ -1,5 +1,12 @@ + GNU parted NEWS -*- outline -*- + ++* Noteworthy changes post release 3.1 ++ ++** New features ++ ++ Add support for prep flag to GPT to select PowerPC Reference Platform ++ boot partition type. ++ + * Noteworthy changes in release 3.1 (2012-03-02) [stable] + + ** New features +Index: parted-3.1/doc/parted.texi +=================================================================== +--- parted-3.1.orig/doc/parted.texi ++++ parted-3.1/doc/parted.texi +@@ -822,7 +822,7 @@ physical volume. + by the Linux/PA-RISC boot loader, palo. + + @item PREP +-(MS-DOS) - this flag can be enabled so that the partition can be used ++(MS-DOS, GPT) - this flag can be enabled so that the partition can be used + as a PReP boot partition on PowerPC PReP or IBM RS6K/CHRP hardware. + + @item DIAG +Index: parted-3.1/libparted/labels/gpt.c +=================================================================== +--- parted-3.1.orig/libparted/labels/gpt.c ++++ parted-3.1/libparted/labels/gpt.c +@@ -142,6 +142,10 @@ typedef struct + ((efi_guid_t) { PED_CPU_TO_LE32 (0x5265636F), PED_CPU_TO_LE16 (0x7665), \ + PED_CPU_TO_LE16 (0x11AA), 0xaa, 0x11, \ + { 0x00, 0x30, 0x65, 0x43, 0xEC, 0xAC }}) ++#define PARTITION_PREP_GUID \ ++ ((efi_guid_t) { PED_CPU_TO_LE32 (0x9e1a2d38), PED_CPU_TO_LE16 (0xc612), \ ++ PED_CPU_TO_LE16 (0x4316), 0xaa, 0x26, \ ++ { 0x8b, 0x49, 0x52, 0x1e, 0x5a, 0x8b }}) + #define PARTITION_IRST_GUID \ + ((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \ + PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \ +@@ -286,6 +290,7 @@ typedef struct _GPTPartitionData + int atvrecv; + int msftrecv; + int legacy_boot; ++ int prep; + int irst; + } GPTPartitionData; + +@@ -888,6 +893,7 @@ _parse_part_entry (PedDisk *disk, GuidPa + = gpt_part_data->hidden = gpt_part_data->msftres + = gpt_part_data->msftrecv + = gpt_part_data->legacy_boot ++ = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; + +@@ -912,6 +918,8 @@ _parse_part_entry (PedDisk *disk, GuidPa + gpt_part_data->msftrecv = 1; + else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID)) + gpt_part_data->atvrecv = 1; ++ else if (!guid_cmp (gpt_part_data->type, PARTITION_PREP_GUID)) ++ gpt_part_data->prep = 1; + else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID)) + gpt_part_data->irst = 1; + +@@ -1526,6 +1534,7 @@ gpt_partition_new (const PedDisk *disk, + gpt_part_data->msftrecv = 0; + gpt_part_data->atvrecv = 0; + gpt_part_data->legacy_boot = 0; ++ gpt_part_data->prep = 0; + gpt_part_data->irst = 0; + uuid_generate ((unsigned char *) &gpt_part_data->uuid); + swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid)); +@@ -1600,6 +1609,11 @@ gpt_partition_set_system (PedPartition * + gpt_part_data->type = PARTITION_RAID_GUID; + return 1; + } ++ if (gpt_part_data->prep) ++ { ++ gpt_part_data->type = PARTITION_PREP_GUID; ++ return 1; ++ } + if (gpt_part_data->boot) + { + gpt_part_data->type = PARTITION_SYSTEM_GUID; +@@ -1735,6 +1749,7 @@ gpt_partition_set_flag (PedPartition *pa + = gpt_part_data->hp_service + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); +@@ -1747,6 +1762,7 @@ gpt_partition_set_flag (PedPartition *pa + = gpt_part_data->hp_service + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); +@@ -1759,6 +1775,7 @@ gpt_partition_set_flag (PedPartition *pa + = gpt_part_data->hp_service + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); +@@ -1771,6 +1788,7 @@ gpt_partition_set_flag (PedPartition *pa + = gpt_part_data->hp_service + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); +@@ -1783,6 +1801,7 @@ gpt_partition_set_flag (PedPartition *pa + = gpt_part_data->bios_grub + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); +@@ -1795,6 +1814,7 @@ gpt_partition_set_flag (PedPartition *pa + = gpt_part_data->bios_grub + = gpt_part_data->hp_service + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); +@@ -1807,6 +1827,7 @@ gpt_partition_set_flag (PedPartition *pa + = gpt_part_data->bios_grub + = gpt_part_data->hp_service + = gpt_part_data->msftres ++ = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); +@@ -1819,9 +1840,22 @@ gpt_partition_set_flag (PedPartition *pa + = gpt_part_data->bios_grub + = gpt_part_data->hp_service + = gpt_part_data->msftres ++ = gpt_part_data->prep + = gpt_part_data->irst + = gpt_part_data->msftrecv = 0; + return gpt_partition_set_system (part, part->fs_type); ++ case PED_PARTITION_PREP: ++ gpt_part_data->prep = state; ++ if (state) ++ gpt_part_data->boot ++ = gpt_part_data->raid ++ = gpt_part_data->lvm ++ = gpt_part_data->bios_grub ++ = gpt_part_data->hp_service ++ = gpt_part_data->msftres ++ = gpt_part_data->msftrecv ++ = gpt_part_data->atvrecv = 0; ++ return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_IRST: + gpt_part_data->irst = state; + if (state) +@@ -1832,6 +1866,7 @@ gpt_partition_set_flag (PedPartition *pa + = gpt_part_data->hp_service + = gpt_part_data->msftres + = gpt_part_data->msftrecv ++ = gpt_part_data->prep + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HIDDEN: +@@ -1878,6 +1913,8 @@ gpt_partition_get_flag (const PedPartiti + return gpt_part_data->hidden; + case PED_PARTITION_LEGACY_BOOT: + return gpt_part_data->legacy_boot; ++ case PED_PARTITION_PREP: ++ return gpt_part_data->prep; + case PED_PARTITION_IRST: + return gpt_part_data->irst; + case PED_PARTITION_SWAP: +@@ -1906,6 +1943,7 @@ gpt_partition_is_flag_available (const P + case PED_PARTITION_HIDDEN: + case PED_PARTITION_LEGACY_BOOT: + case PED_PARTITION_IRST: ++ case PED_PARTITION_PREP: + return 1; + case PED_PARTITION_SWAP: + case PED_PARTITION_ROOT: diff --git a/parted-btrfs-support.patch b/parted-btrfs-support.patch index d1b2b52..0fd7c12 100644 --- a/parted-btrfs-support.patch +++ b/parted-btrfs-support.patch @@ -11,62 +11,28 @@ Date: Thu Feb 12 15:15:30 2009 +0100 Signed-off-by: Luca Bruno --- - configure.ac | 4 - - libparted/fs/Makefile.am | 3 - - libparted/fs/btrfs/Makefile.am | 8 ++ - libparted/fs/btrfs/btrfs.c | 110 +++++++++++++++++++++++++++++++++++++++++ - libparted/libparted.c | 4 + - 5 files changed, 126 insertions(+), 3 deletions(-) + libparted/fs/Makefile.am | 1 + libparted/fs/btrfs/btrfs.c | 96 ++ + libparted/libparted.c | 4 + 4 files changed, 1933 insertions(+) -Index: parted-2.4/configure.ac +Index: parted-3.1/libparted/fs/Makefile.am =================================================================== -@@ -626,6 +625,7 @@ libparted/Makefile - libparted/labels/Makefile - libparted/fs/Makefile - libparted/fs/amiga/Makefile -+libparted/fs/btrfs/Makefile - libparted/fs/ext2/Makefile - libparted/fs/fat/Makefile - libparted/fs/hfs/Makefile -Index: parted-2.4/libparted/fs/Makefile.am -=================================================================== ---- parted-2.4.orig/libparted/fs/Makefile.am -+++ parted-2.4/libparted/fs/Makefile.am -@@ -4,7 +4,7 @@ - # This file may be modified and/or distributed without restriction. - - SUBDIRS = amiga ext2 ufs fat ntfs hfs linux_swap xfs jfs reiserfs \ -- nilfs2 # bfs -+ nilfs2 btrfs # bfs - - partedincludedir = -I$(top_srcdir)/include - noinst_LTLIBRARIES = libfs.la -@@ -25,6 +25,7 @@ libfs_la_LIBADD = $(UUID_LIBS) \ - xfs/libxfs.la \ - jfs/libjfs.la \ - reiserfs/libreiserfs.la \ -+ btrfs/libbtrfs.la \ - nilfs2/libnilfs2.la - # bfs/libbfs.la - -Index: parted-2.4/libparted/fs/btrfs/Makefile.am +--- parted-3.1.orig/libparted/fs/Makefile.am ++++ parted-3.1/libparted/fs/Makefile.am +@@ -25,6 +25,7 @@ libfs_la_SOURCES = \ + amiga/asfs.c \ + amiga/asfs.h \ + amiga/a-interface.c \ ++ btrfs/btrfs.c \ + ext2/ext2.h \ + ext2/ext2_fs.h \ + ext2/interface.c \ +Index: parted-3.1/libparted/fs/btrfs/btrfs.c =================================================================== --- /dev/null -+++ parted-2.4/libparted/fs/btrfs/Makefile.am -@@ -0,0 +1,8 @@ -+partedincludedir = -I$(top_srcdir)/include -+ -+noinst_LTLIBRARIES = libbtrfs.la -+libbtrfs_la_SOURCES = btrfs.c -+ -+INCLUDES = $(partedincludedir) $(INTLINCS) -+ -+MAINTAINERCLEANFILES = Makefile.in -Index: parted-2.4/libparted/fs/btrfs/btrfs.c -=================================================================== ---- /dev/null -+++ parted-2.4/libparted/fs/btrfs/btrfs.c -@@ -0,0 +1,110 @@ ++++ parted-3.1/libparted/fs/btrfs/btrfs.c +@@ -0,0 +1,96 @@ +/* + libparted - a library for manipulating disk partitions + Copyright (C) 2009 Free Software Foundation, Inc. @@ -141,20 +107,6 @@ Index: parted-2.4/libparted/fs/btrfs/btrfs.c + +static PedFileSystemOps btrfs_ops = { + probe: btrfs_probe, -+#ifndef DISCOVER_ONLY -+ clobber: btrfs_clobber, -+#else -+ clobber: NULL, -+#endif -+ open: NULL, -+ create: NULL, -+ close: NULL, -+ check: NULL, -+ copy: NULL, -+ resize: NULL, -+ get_create_constraint: NULL, -+ get_resize_constraint: NULL, -+ get_copy_constraint: NULL +}; + +static PedFileSystemType btrfs_type = { @@ -177,11 +129,11 @@ Index: parted-2.4/libparted/fs/btrfs/btrfs.c +} + + -Index: parted-2.4/libparted/libparted.c +Index: parted-3.1/libparted/libparted.c =================================================================== ---- parted-2.4.orig/libparted/libparted.c -+++ parted-2.4/libparted/libparted.c -@@ -110,6 +110,7 @@ extern void ped_file_system_hfs_init (vo +--- parted-3.1.orig/libparted/libparted.c ++++ parted-3.1/libparted/libparted.c +@@ -109,6 +109,7 @@ extern void ped_file_system_hfs_init (vo extern void ped_file_system_fat_init (void); extern void ped_file_system_ext2_init (void); extern void ped_file_system_nilfs2_init (void); @@ -189,15 +141,15 @@ Index: parted-2.4/libparted/libparted.c static void init_file_system_types () -@@ -125,6 +126,7 @@ init_file_system_types () +@@ -124,6 +125,7 @@ init_file_system_types () ped_file_system_fat_init (); ped_file_system_ext2_init (); ped_file_system_nilfs2_init (); + ped_file_system_btrfs_init (); } - #endif /* ENABLE_FS */ -@@ -191,6 +193,7 @@ extern void ped_file_system_ntfs_done (v + extern void ped_disk_aix_done (); +@@ -185,6 +187,7 @@ extern void ped_file_system_ntfs_done (v extern void ped_file_system_reiserfs_done (void); extern void ped_file_system_ufs_done (void); extern void ped_file_system_xfs_done (void); @@ -205,11 +157,11 @@ Index: parted-2.4/libparted/libparted.c extern void ped_file_system_amiga_done (void); static void -@@ -206,6 +209,7 @@ done_file_system_types () +@@ -200,6 +203,7 @@ done_file_system_types () ped_file_system_reiserfs_done (); ped_file_system_ufs_done (); ped_file_system_xfs_done (); + ped_file_system_btrfs_done (); ped_file_system_amiga_done (); } - #endif /* ENABLE_FS */ + diff --git a/parted-fix-cciss-partition-naming.patch b/parted-fix-cciss-partition-naming.patch index 085dbd4..d0f91ea 100644 --- a/parted-fix-cciss-partition-naming.patch +++ b/parted-fix-cciss-partition-naming.patch @@ -1,8 +1,12 @@ -Index: parted-2.4/libparted/arch/linux.c +--- + libparted/arch/linux.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +Index: parted-3.1/libparted/arch/linux.c =================================================================== ---- parted-2.4.orig/libparted/arch/linux.c -+++ parted-2.4/libparted/arch/linux.c -@@ -2226,8 +2226,11 @@ _device_get_part_path (PedDevice *dev, i +--- parted-3.1.orig/libparted/arch/linux.c ++++ parted-3.1/libparted/arch/linux.c +@@ -2239,8 +2239,11 @@ _device_get_part_path (PedDevice *dev, i result = zasprintf ("%.*s/part%d", (int) (path_len - 5), dev->path, num); } else { @@ -14,5 +18,5 @@ Index: parted-2.4/libparted/arch/linux.c + else + p = (dev->type == PED_DEVICE_DAC960 || dev->type == PED_DEVICE_ATARAID - || dev->type == PED_DEVICE_DM || isdigit (dev->path[path_len - 1]) + ? "_part" : ""); diff --git a/parted-fix-gpt-sync-on-BE-systems.patch b/parted-fix-gpt-sync-on-BE-systems.patch deleted file mode 100644 index 2c1f31b..0000000 --- a/parted-fix-gpt-sync-on-BE-systems.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- - libparted/labels/gpt.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -Index: parted-2.4/libparted/labels/gpt.c -=================================================================== ---- parted-2.4.orig/libparted/labels/gpt.c -+++ parted-2.4/libparted/labels/gpt.c -@@ -1256,9 +1256,9 @@ _write_pmbr (const PedDisk *disk) - pmbr->PartitionRecord[pmbr_id].EndSector = 0xFF; - pmbr->PartitionRecord[pmbr_id].EndTrack = 0xFF; - pmbr->PartitionRecord[pmbr_id].StartingLBA = PED_CPU_TO_LE32(1); -- pmbr->PartitionRecord[pmbr_id].SizeInLBA = 1; -+ pmbr->PartitionRecord[pmbr_id].SizeInLBA = PED_CPU_TO_LE32 (1); - if (esp) -- pmbr->PartitionRecord[pmbr_id].SizeInLBA = esp->geom.end - 1; -+ pmbr->PartitionRecord[pmbr_id].SizeInLBA = PED_CPU_TO_LE32 (esp->geom.end - 1); - - /* sync the first 3 GPT entries to MBR primary partitions */ - for (i=first_entry; i < last_entry; i++) { -@@ -1284,10 +1284,10 @@ _write_pmbr (const PedDisk *disk) - pmbr->PartitionRecord[i].EndHead = 0xFE; - pmbr->PartitionRecord[i].EndSector = 0xFF; - pmbr->PartitionRecord[i].EndTrack = 0xFF; -- pmbr->PartitionRecord[i].StartingLBA = _part_32bitmax(part->geom.start); -+ pmbr->PartitionRecord[i].StartingLBA = PED_CPU_TO_LE32 (_part_32bitmax(part->geom.start)); - if(((GPTPartitionData*)part->disk_specific)->boot) - pmbr->PartitionRecord[i].BootIndicator = 0x80; -- pmbr->PartitionRecord[i].SizeInLBA = _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)); - } - } - int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA, diff --git a/parted-gpt-mbr-sync.patch b/parted-gpt-mbr-sync.patch index b679671..a7c6e3f 100644 --- a/parted-gpt-mbr-sync.patch +++ b/parted-gpt-mbr-sync.patch @@ -1,29 +1,142 @@ --- - libparted/labels/gpt.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++- - 1 file changed, 107 insertions(+), 2 deletions(-) + libparted/labels/gpt.c | 239 ++++++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 235 insertions(+), 4 deletions(-) -Index: libparted/labels/gpt.c +Index: parted-3.1/libparted/labels/gpt.c =================================================================== ---- libparted/labels/gpt.c.orig -+++ libparted/labels/gpt.c -@@ -51,6 +51,11 @@ - # define _(String) (String) - #endif /* ENABLE_NLS */ +--- parted-3.1.orig/libparted/labels/gpt.c ++++ parted-3.1/libparted/labels/gpt.c +@@ -285,6 +285,7 @@ typedef struct _GPTPartitionData + } GPTPartitionData; -+/* IA64 always has a properly working EFI implementation */ -+#ifndef __ia64__ -+#define GPT_SYNC_MBR -+#endif + static PedDiskType gpt_disk_type; ++static PedDiskType gpt_sync_mbr_disk_type; + + static inline uint32_t + pth_get_size (const PedDevice *dev) +@@ -453,8 +454,50 @@ _pmbr_is_valid (const LegacyMBR_t *mbr) + return 0; + } + ++/* checks if device has a hybrid protective MBR partition table ++ * ++ * If the 1st partition has type 0xEE that spans the entire ++ * size of the disk from sector 1 to the last sector ++ * (or 2 TiB, whichever is smaller), we consider it 'normal' GPT. ++ * Otherwise it is synced GPT with hybridized pMBR. ++ */ ++static inline int ++_has_hybrid_pmbr (const PedDevice *dev) ++{ ++ int has_hybrid_pmbr = 1; + - #define EFI_PMBR_OSTYPE_EFI 0xEE - #define MSDOS_MBR_SIGNATURE 0xaa55 ++ PED_ASSERT (dev != NULL); ++ ++ void *label; ++ if (!ptt_read_sector (dev, 0, &label)) ++ return 0; ++ ++ LegacyMBR_t mbr; ++ memcpy(&mbr, label, sizeof(mbr)); ++ ++ if (mbr.Signature != PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE)) { ++ free(label); ++ return 0; ++ } ++ ++ uint32_t efi_gpt_expected_size; ++ if ((dev->length - 1ULL) > 0xFFFFFFFFULL) ++ efi_gpt_expected_size = 0xFFFFFFFF; ++ else ++ efi_gpt_expected_size = dev->length - 1UL; ++ ++ if ((mbr.PartitionRecord[0].OSType == EFI_PMBR_OSTYPE_EFI) && ++ (mbr.PartitionRecord[0].StartingLBA == PED_CPU_TO_LE32(1)) && ++ (mbr.PartitionRecord[0].SizeInLBA == PED_CPU_TO_LE32(efi_gpt_expected_size))) ++ /* pMBR is not hybrid */ ++ has_hybrid_pmbr = 0; ++ ++ free(label); ++ return has_hybrid_pmbr; ++} ++ + static int +-gpt_probe (const PedDevice *dev) ++_gpt_probe_generic(const PedDevice *dev) + { + GuidPartitionTableHeader_t *gpt = NULL; + int gpt_sig_found = 0; +@@ -507,6 +550,19 @@ gpt_probe (const PedDevice *dev) + return ok; + } -@@ -1072,11 +1077,60 @@ error: ++static int ++gpt_probe (const PedDevice *dev) ++{ ++ return _gpt_probe_generic(dev) && !_has_hybrid_pmbr(dev); ++} ++ ++ ++static int ++gpt_sync_mbr_probe (const PedDevice *dev) ++{ ++ return _gpt_probe_generic(dev) && _has_hybrid_pmbr(dev); ++} ++ + static PedDisk * + gpt_alloc (const PedDevice *dev) + { +@@ -544,6 +600,36 @@ error: + } + + static PedDisk * ++gpt_sync_mbr_alloc (const PedDevice *dev) ++{ ++ PedDisk *disk; ++ GPTDiskData *gpt_disk_data; ++ PedSector data_start, data_end; ++ ++ disk = _ped_disk_alloc ((PedDevice *) dev, &gpt_sync_mbr_disk_type); ++ if (!disk) ++ goto error; ++ disk->disk_specific = gpt_disk_data = ped_malloc (sizeof (GPTDiskData)); ++ if (!disk->disk_specific) ++ goto error_free_disk; ++ ++ data_start = 2 + GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size; ++ data_end = dev->length - 2 ++ - GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size; ++ ped_geometry_init (&gpt_disk_data->data_area, dev, data_start, ++ data_end - data_start + 1); ++ gpt_disk_data->entry_count = GPT_DEFAULT_PARTITION_ENTRIES; ++ uuid_generate ((unsigned char *) &gpt_disk_data->uuid); ++ swap_uuid_and_efi_guid ((unsigned char *) (&gpt_disk_data->uuid)); ++ return disk; ++ ++error_free_disk: ++ free (disk); ++error: ++ return NULL; ++} ++ ++static PedDisk * + gpt_duplicate (const PedDisk *disk) + { + PedDisk *new_disk; +@@ -920,7 +1006,7 @@ gpt_read (PedDisk *disk) + + /* motivation: let the user decide about the pmbr... during + ped_disk_probe(), they probably didn't get a choice... */ +- if (!gpt_probe (disk->dev)) ++ if (!gpt_probe (disk->dev) && !gpt_sync_mbr_probe(disk->dev)) + goto error; + + GuidPartitionTableHeader_t *gpt = NULL; +@@ -1077,11 +1163,59 @@ error: return 0; } + -+#ifdef GPT_SYNC_MBR +static inline unsigned char +_part_to_ostype (PedPartition* part) +{ @@ -61,7 +174,6 @@ Index: libparted/labels/gpt.c + else + return (uint32_t)in; +} -+#endif + + #ifndef DISCOVER_ONLY @@ -72,33 +184,29 @@ Index: libparted/labels/gpt.c { + PedDevice * dev = disk->dev; + -+#ifdef GPT_SYNC_MBR ++ /* need sync GPT -> hybrid pMBR ? */ ++ int sync_pmbr = !strcmp(disk->type->name, "gpt_sync_mbr") ? 1 : 0; ++ + int i, pmbr_id, first_entry = 0, last_entry = 3; + PedPartition *part = NULL, *esp; -+#endif + /* The UEFI spec is not clear about what to do with the following elements of the Protective MBR (pmbr): BootCode (0-440B), UniqueMBRSignature (440B-444B) and Unknown (444B-446B). -@@ -1086,10 +1140,13 @@ _write_pmbr (PedDevice *dev) - return 0; - LegacyMBR_t *pmbr = s0; - -+#ifndef GPT_SYNC_MBR - /* Zero out the legacy partitions. */ +@@ -1095,6 +1229,8 @@ _write_pmbr (PedDevice *dev) memset (pmbr->PartitionRecord, 0, sizeof pmbr->PartitionRecord); -+#endif pmbr->Signature = PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE); -+#ifndef GPT_SYNC_MBR ++ ++ if (!sync_pmbr) { pmbr->PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI; pmbr->PartitionRecord[0].StartSector = 1; pmbr->PartitionRecord[0].EndHead = 0xFE; -@@ -1100,6 +1157,53 @@ _write_pmbr (PedDevice *dev) +@@ -1105,7 +1241,60 @@ _write_pmbr (PedDevice *dev) pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (0xFFFFFFFF); else pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (dev->length - 1UL); -+#else ++ } else { + /* Search for an EFI System Partition */ + esp = _find_first_part(disk); + if (!esp || !esp->fs_type || strncmp (esp->fs_type->name, "fat", 3) != 0) @@ -118,9 +226,9 @@ Index: libparted/labels/gpt.c + pmbr->PartitionRecord[pmbr_id].EndSector = 0xFF; + pmbr->PartitionRecord[pmbr_id].EndTrack = 0xFF; + pmbr->PartitionRecord[pmbr_id].StartingLBA = PED_CPU_TO_LE32(1); -+ pmbr->PartitionRecord[pmbr_id].SizeInLBA = 1; ++ pmbr->PartitionRecord[pmbr_id].SizeInLBA = PED_CPU_TO_LE32 (1); + if (esp) -+ pmbr->PartitionRecord[pmbr_id].SizeInLBA = esp->geom.end - 1; ++ pmbr->PartitionRecord[pmbr_id].SizeInLBA = PED_CPU_TO_LE32 (esp->geom.end - 1); + + /* sync the first 3 GPT entries to MBR primary partitions */ + for (i=first_entry; i < last_entry; i++) { @@ -132,6 +240,13 @@ Index: libparted/labels/gpt.c + i--; + continue; + } ++ ++ /* partition can not be represented by dos label - don't sync it */ ++ if (part->geom.start > 0xFFFFFFFF || ++ (part->geom.end - part->geom.start + 1) > 0xFFFFFFFF) { ++ continue; ++ } + + pmbr->PartitionRecord[i].OSType = _part_to_ostype(part); + pmbr->PartitionRecord[i].StartHead = 0xFE; + pmbr->PartitionRecord[i].StartSector = 0xFF; @@ -139,17 +254,17 @@ Index: libparted/labels/gpt.c + pmbr->PartitionRecord[i].EndHead = 0xFE; + pmbr->PartitionRecord[i].EndSector = 0xFF; + pmbr->PartitionRecord[i].EndTrack = 0xFF; -+ pmbr->PartitionRecord[i].StartingLBA = _part_32bitmax(part->geom.start); ++ pmbr->PartitionRecord[i].StartingLBA = PED_CPU_TO_LE32 (_part_32bitmax(part->geom.start)); + if(((GPTPartitionData*)part->disk_specific)->boot) + pmbr->PartitionRecord[i].BootIndicator = 0x80; -+ pmbr->PartitionRecord[i].SizeInLBA = _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)); ++ } + } -+#endif - int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA, GPT_PMBR_SECTORS); -@@ -1216,7 +1320,7 @@ gpt_write (const PedDisk *disk) - ptes_crc = efi_crc32 (ptes, ptes_size); + free (s0); +@@ -1225,7 +1414,7 @@ gpt_write (const PedDisk *disk) + ptes_crc = efi_crc32 (ptes, ptes_bytes); /* Write protective MBR */ - if (!_write_pmbr (disk->dev)) @@ -157,3 +272,69 @@ Index: libparted/labels/gpt.c goto error_free_ptes; /* Write PTH and PTEs */ +@@ -1802,6 +1991,38 @@ static PedDiskOps gpt_disk_ops = + PT_op_function_initializers (gpt) + }; + ++static PedDiskOps gpt_sync_mbr_disk_ops = ++{ ++ clobber: NULL, ++ write: NULL_IF_DISCOVER_ONLY (gpt_write), ++ ++ partition_set_name: gpt_partition_set_name, ++ partition_get_name: gpt_partition_get_name, ++ ++ /* probe function redefined */ ++ probe: gpt_sync_mbr_probe, ++ /* alloc function redefined */ ++ alloc: gpt_sync_mbr_alloc, ++ duplicate: gpt_duplicate, ++ free: gpt_free, ++ read: gpt_read, ++ partition_new: gpt_partition_new, ++ partition_duplicate: gpt_partition_duplicate, ++ partition_set_flag: gpt_partition_set_flag, ++ partition_get_flag: gpt_partition_get_flag, ++ partition_set_system: gpt_partition_set_system, ++ partition_is_flag_available: gpt_partition_is_flag_available, ++ partition_align: gpt_partition_align, ++ partition_destroy: gpt_partition_destroy, ++ partition_enumerate: gpt_partition_enumerate, ++ alloc_metadata: gpt_alloc_metadata, ++ get_max_primary_partition_count: gpt_get_max_primary_partition_count, ++ get_max_supported_partition_count: gpt_get_max_supported_partition_count, ++ partition_check: gpt_partition_check, ++ max_length: gpt_partition_max_length, ++ max_start_sector: gpt_partition_max_start_sector ++}; ++ + static PedDiskType gpt_disk_type = + { + next: NULL, +@@ -1810,16 +2031,26 @@ static PedDiskType gpt_disk_type = + features: PED_DISK_TYPE_PARTITION_NAME + }; + ++static PedDiskType gpt_sync_mbr_disk_type = ++{ ++ next: NULL, ++ name: "gpt_sync_mbr", ++ ops: &gpt_sync_mbr_disk_ops, ++ features: PED_DISK_TYPE_PARTITION_NAME ++}; ++ + void + ped_disk_gpt_init () + { + ped_disk_type_register (&gpt_disk_type); ++ ped_disk_type_register (&gpt_sync_mbr_disk_type); + } + + void + ped_disk_gpt_done () + { + ped_disk_type_unregister (&gpt_disk_type); ++ ped_disk_type_unregister (&gpt_sync_mbr_disk_type); + } + + verify (sizeof (GuidPartitionEntryAttributes_t) == 8); diff --git a/parted-gpt-sync-mbr-label.patch b/parted-gpt-sync-mbr-label.patch deleted file mode 100644 index f098b12..0000000 --- a/parted-gpt-sync-mbr-label.patch +++ /dev/null @@ -1,287 +0,0 @@ -Index: parted-2.4/libparted/labels/gpt.c -=================================================================== ---- parted-2.4.orig/libparted/labels/gpt.c -+++ parted-2.4/libparted/labels/gpt.c -@@ -51,11 +51,6 @@ - # define _(String) (String) - #endif /* ENABLE_NLS */ - --/* IA64 always has a properly working EFI implementation */ --#ifndef __ia64__ --#define GPT_SYNC_MBR --#endif -- - #define EFI_PMBR_OSTYPE_EFI 0xEE - #define MSDOS_MBR_SIGNATURE 0xaa55 - -@@ -290,6 +285,7 @@ typedef struct _GPTPartitionData - } GPTPartitionData; - - static PedDiskType gpt_disk_type; -+static PedDiskType gpt_sync_mbr_disk_type; - - static inline uint32_t - pth_get_size (const PedDevice *dev) -@@ -458,8 +454,50 @@ _pmbr_is_valid (const LegacyMBR_t *mbr) - return 0; - } - -+/* checks if device has a hybrid protective MBR partition table -+ * -+ * If the 1st partition has type 0xEE that spans the entire -+ * size of the disk from sector 1 to the last sector -+ * (or 2 TiB, whichever is smaller), we consider it 'normal' GPT. -+ * Otherwise it is synced GPT with hybridized pMBR. -+ */ -+static inline int -+_has_hybrid_pmbr (const PedDevice *dev) -+{ -+ int has_hybrid_pmbr = 1; -+ -+ PED_ASSERT (dev != NULL); -+ -+ void *label; -+ if (!ptt_read_sector (dev, 0, &label)) -+ return 0; -+ -+ LegacyMBR_t mbr; -+ memcpy(&mbr, label, sizeof(mbr)); -+ -+ if (mbr.Signature != PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE)) { -+ free(label); -+ return 0; -+ } -+ -+ uint32_t efi_gpt_expected_size; -+ if ((dev->length - 1ULL) > 0xFFFFFFFFULL) -+ efi_gpt_expected_size = 0xFFFFFFFF; -+ else -+ efi_gpt_expected_size = dev->length - 1UL; -+ -+ if ((mbr.PartitionRecord[0].OSType == EFI_PMBR_OSTYPE_EFI) && -+ (mbr.PartitionRecord[0].StartingLBA == PED_CPU_TO_LE32(1)) && -+ (mbr.PartitionRecord[0].SizeInLBA == PED_CPU_TO_LE32(efi_gpt_expected_size))) -+ /* pMBR is not hybrid */ -+ has_hybrid_pmbr = 0; -+ -+ free(label); -+ return has_hybrid_pmbr; -+} -+ - static int --gpt_probe (const PedDevice *dev) -+_gpt_probe_generic(const PedDevice *dev) - { - GuidPartitionTableHeader_t *gpt = NULL; - int gpt_sig_found = 0; -@@ -512,6 +550,19 @@ gpt_probe (const PedDevice *dev) - return ok; - } - -+static int -+gpt_probe (const PedDevice *dev) -+{ -+ return _gpt_probe_generic(dev) && !_has_hybrid_pmbr(dev); -+} -+ -+ -+static int -+gpt_sync_mbr_probe (const PedDevice *dev) -+{ -+ return _gpt_probe_generic(dev) && _has_hybrid_pmbr(dev); -+} -+ - static PedDisk * - gpt_alloc (const PedDevice *dev) - { -@@ -543,6 +594,36 @@ error: - } - - static PedDisk * -+gpt_sync_mbr_alloc (const PedDevice *dev) -+{ -+ PedDisk *disk; -+ GPTDiskData *gpt_disk_data; -+ PedSector data_start, data_end; -+ -+ disk = _ped_disk_alloc ((PedDevice *) dev, &gpt_sync_mbr_disk_type); -+ if (!disk) -+ goto error; -+ disk->disk_specific = gpt_disk_data = ped_malloc (sizeof (GPTDiskData)); -+ if (!disk->disk_specific) -+ goto error_free_disk; -+ -+ data_start = 2 + GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size; -+ data_end = dev->length - 2 -+ - GPT_DEFAULT_PARTITION_ENTRY_ARRAY_SIZE / dev->sector_size; -+ ped_geometry_init (&gpt_disk_data->data_area, dev, data_start, -+ data_end - data_start + 1); -+ gpt_disk_data->entry_count = GPT_DEFAULT_PARTITION_ENTRIES; -+ uuid_generate ((unsigned char *) &gpt_disk_data->uuid); -+ swap_uuid_and_efi_guid ((unsigned char *) (&gpt_disk_data->uuid)); -+ return disk; -+ -+error_free_disk: -+ free (disk); -+error: -+ return NULL; -+} -+ -+static PedDisk * - gpt_duplicate (const PedDisk *disk) - { - PedDisk *new_disk; -@@ -920,7 +1001,7 @@ gpt_read (PedDisk *disk) - - /* motivation: let the user decide about the pmbr... during - ped_disk_probe(), they probably didn't get a choice... */ -- if (!gpt_probe (disk->dev)) -+ if (!gpt_probe (disk->dev) && !gpt_sync_mbr_probe(disk->dev)) - goto error; - - GuidPartitionTableHeader_t *gpt = NULL; -@@ -1078,7 +1159,6 @@ error: - } - - --#ifdef GPT_SYNC_MBR - static inline unsigned char - _part_to_ostype (PedPartition* part) - { -@@ -1116,7 +1196,6 @@ _part_32bitmax (uint64_t in) - else - return (uint32_t)in; - } --#endif - - - #ifndef DISCOVER_ONLY -@@ -1126,10 +1205,11 @@ _write_pmbr (const PedDisk *disk) - { - PedDevice * dev = disk->dev; - --#ifdef GPT_SYNC_MBR -+ /* need sync GPT -> hybrid pMBR ? */ -+ int sync_pmbr = !strcmp(disk->type->name, "gpt_sync_mbr") ? 1 : 0; -+ - int i, pmbr_id, first_entry = 0, last_entry = 3; - PedPartition *part = NULL, *esp; --#endif - - /* The UEFI spec is not clear about what to do with the following - elements of the Protective MBR (pmbr): BootCode (0-440B), -@@ -1140,13 +1220,12 @@ _write_pmbr (const PedDisk *disk) - return 0; - LegacyMBR_t *pmbr = s0; - --#ifndef GPT_SYNC_MBR - /* Zero out the legacy partitions. */ - memset (pmbr->PartitionRecord, 0, sizeof pmbr->PartitionRecord); --#endif - - pmbr->Signature = PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE); --#ifndef GPT_SYNC_MBR -+ -+ if (!sync_pmbr) { - pmbr->PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI; - pmbr->PartitionRecord[0].StartSector = 1; - pmbr->PartitionRecord[0].EndHead = 0xFE; -@@ -1157,7 +1236,7 @@ _write_pmbr (const PedDisk *disk) - pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (0xFFFFFFFF); - else - pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (dev->length - 1UL); --#else -+ } else { - /* Search for an EFI System Partition */ - esp = _find_first_part(disk); - if (!esp || !esp->fs_type || strncmp (esp->fs_type->name, "fat", 3) != 0) -@@ -1191,6 +1270,13 @@ _write_pmbr (const PedDisk *disk) - i--; - continue; - } -+ -+ /* partition can not be represented by dos label - don't sync it */ -+ if (part->geom.start > 0xFFFFFFFF || -+ (part->geom.end - part->geom.start + 1) > 0xFFFFFFFF) { -+ continue; -+ } -+ - pmbr->PartitionRecord[i].OSType = _part_to_ostype(part); - pmbr->PartitionRecord[i].StartHead = 0xFE; - pmbr->PartitionRecord[i].StartSector = 0xFF; -@@ -1203,8 +1289,7 @@ _write_pmbr (const PedDisk *disk) - pmbr->PartitionRecord[i].BootIndicator = 0x80; - pmbr->PartitionRecord[i].SizeInLBA = _part_32bitmax(part->geom.end - part->geom.start + 1); - } --#endif -- -+ } - int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA, - GPT_PMBR_SECTORS); - free (s0); -@@ -1902,6 +1987,38 @@ static PedDiskOps gpt_disk_ops = - PT_op_function_initializers (gpt) - }; - -+static PedDiskOps gpt_sync_mbr_disk_ops = -+{ -+ clobber: NULL, -+ write: NULL_IF_DISCOVER_ONLY (gpt_write), -+ -+ partition_set_name: gpt_partition_set_name, -+ partition_get_name: gpt_partition_get_name, -+ -+ /* probe function redefined */ -+ probe: gpt_sync_mbr_probe, -+ /* alloc function redefined */ -+ alloc: gpt_sync_mbr_alloc, -+ duplicate: gpt_duplicate, -+ free: gpt_free, -+ read: gpt_read, -+ partition_new: gpt_partition_new, -+ partition_duplicate: gpt_partition_duplicate, -+ partition_set_flag: gpt_partition_set_flag, -+ partition_get_flag: gpt_partition_get_flag, -+ partition_set_system: gpt_partition_set_system, -+ partition_is_flag_available: gpt_partition_is_flag_available, -+ partition_align: gpt_partition_align, -+ partition_destroy: gpt_partition_destroy, -+ partition_enumerate: gpt_partition_enumerate, -+ alloc_metadata: gpt_alloc_metadata, -+ get_max_primary_partition_count: gpt_get_max_primary_partition_count, -+ get_max_supported_partition_count: gpt_get_max_supported_partition_count, -+ partition_check: gpt_partition_check, -+ max_length: gpt_partition_max_length, -+ max_start_sector: gpt_partition_max_start_sector -+}; -+ - static PedDiskType gpt_disk_type = - { - next: NULL, -@@ -1910,16 +2027,26 @@ static PedDiskType gpt_disk_type = - features: PED_DISK_TYPE_PARTITION_NAME - }; - -+static PedDiskType gpt_sync_mbr_disk_type = -+{ -+ next: NULL, -+ name: "gpt_sync_mbr", -+ ops: &gpt_sync_mbr_disk_ops, -+ features: PED_DISK_TYPE_PARTITION_NAME -+}; -+ - void - ped_disk_gpt_init () - { - ped_disk_type_register (&gpt_disk_type); -+ ped_disk_type_register (&gpt_sync_mbr_disk_type); - } - - void - ped_disk_gpt_done () - { - ped_disk_type_unregister (&gpt_disk_type); -+ ped_disk_type_unregister (&gpt_sync_mbr_disk_type); - } - - verify (sizeof (GuidPartitionEntryAttributes_t) == 8); diff --git a/parted-improve-loop-support.patch b/parted-improve-loop-support.patch deleted file mode 100644 index cccdc89..0000000 --- a/parted-improve-loop-support.patch +++ /dev/null @@ -1,157 +0,0 @@ -Index: parted-2.4/NEWS -=================================================================== ---- parted-2.4.orig/NEWS -+++ parted-2.4/NEWS -@@ -2,6 +2,10 @@ GNU parted NEWS - - * Noteworthy changes in release 2.4 (2011-05-18) [stable] - -+** New features -+ -+ parted has improved support for partitionable loopback devices -+ - ** Bug fixes - - parted no longer allows the modification of certain in-use partitions. -Index: parted-2.4/include/parted/device.h -=================================================================== ---- parted-2.4.orig/include/parted/device.h -+++ parted-2.4/include/parted/device.h -@@ -48,7 +48,8 @@ typedef enum { - PED_DEVICE_SDMMC = 14, - PED_DEVICE_VIRTBLK = 15, - PED_DEVICE_AOE = 16, -- PED_DEVICE_MD = 17 -+ PED_DEVICE_MD = 17, -+ PED_DEVICE_LOOP = 18 - } PedDeviceType; - - typedef struct _PedDevice PedDevice; -Index: parted-2.4/libparted/arch/linux.c -=================================================================== ---- parted-2.4.orig/libparted/arch/linux.c -+++ parted-2.4/libparted/arch/linux.c -@@ -586,7 +586,7 @@ _device_probe_type (PedDevice* dev) - } else if (_is_virtblk_major(dev_major)) { - dev->type = PED_DEVICE_VIRTBLK; - } else if (dev_major == LOOP_MAJOR) { -- dev->type = PED_DEVICE_FILE; -+ dev->type = PED_DEVICE_LOOP; - } else if (dev_major == MD_MAJOR) { - dev->type = PED_DEVICE_MD; - } else { -@@ -1376,6 +1376,11 @@ linux_new (const char* path) - goto error_free_arch_specific; - break; - -+ case PED_DEVICE_LOOP: -+ if (!init_generic (dev, _("Loopback device"))) -+ goto error_free_arch_specific; -+ break; -+ - case PED_DEVICE_DM: - { - char* type; -@@ -2411,6 +2416,61 @@ _blkpg_remove_partition (PedDisk* disk, - BLKPG_DEL_PARTITION); - } - -+/* Read the integer from /sys/block/DEV_BASE/ENTRY and set *VAL -+ to that value, where DEV_BASE is the last component of DEV->path. -+ Upon success, return true. Otherwise, return false. */ -+static bool -+_sysfs_int_entry_from_dev(PedDevice const* dev, const char *entry, int *val) -+{ -+ char path[128]; -+ int r = snprintf(path, sizeof(path), "/sys/block/%s/%s", -+ last_component(dev->path), entry); -+ if (r < 0 || r >= sizeof(path)) -+ return false; -+ -+ FILE *fp = fopen(path, "r"); -+ if (!fp) -+ return false; -+ -+ bool ok = fscanf(fp, "%d", val) == 1; -+ fclose(fp); -+ -+ return ok; -+} -+ -+/* Return the maximum number of partitions that the loopback device can hold. -+ First, check the loop-module-exported max_part parameter (since linux-3.0). -+ If that is not available, fall back to checking ext_range, which seems to -+ have (for some reason) different semantics compared to other devices; -+ specifically, ext_range <= 1 means that the loopback device does -+ not support partitions. */ -+static unsigned int -+_loop_get_partition_range(PedDevice const* dev) -+{ -+ int max_part; -+ bool ok = false; -+ -+ /* max_part module param is exported since kernel 3.0 */ -+ FILE *fp = fopen("/sys/module/loop/parameters/max_part", "r"); -+ if (fp) { -+ ok = fscanf(fp, "%d", &max_part) == 1; -+ fclose(fp); -+ } -+ -+ if (ok) -+ return max_part > 0 ? max_part : 0; -+ -+ /* -+ * max_part is not exported - check ext_range; -+ * device supports partitions if ext_range > 1 -+ */ -+ int range; -+ ok = _sysfs_int_entry_from_dev(dev, "range", &range); -+ -+ return ok && range > 1 ? range : 0; -+} -+ -+ - /* - * The number of partitions that a device can have depends on the kernel. - * If we don't find this value in /sys/block/DEV/ext_range, we will use our own -@@ -2419,22 +2479,12 @@ _blkpg_remove_partition (PedDisk* disk, - static unsigned int - _device_get_partition_range(PedDevice* dev) - { -- int range, r; -- char path[128]; -- FILE* fp; -- bool ok; -- -- r = snprintf(path, sizeof(path), "/sys/block/%s/ext_range", -- last_component(dev->path)); -- if (r < 0 || r >= sizeof(path)) -- return MAX_NUM_PARTS; -+ /* loop handling is special */ -+ if (dev->type == PED_DEVICE_LOOP) -+ return _loop_get_partition_range(dev); - -- fp = fopen(path, "r"); -- if (!fp) -- return MAX_NUM_PARTS; -- -- ok = fscanf(fp, "%d", &range) == 1; -- fclose(fp); -+ int range; -+ bool ok = _sysfs_int_entry_from_dev(dev, "ext_range", &range); - - /* (range <= 0) is none sense.*/ - return ok && range > 0 ? range : MAX_NUM_PARTS; -Index: parted-2.4/parted/parted.c -=================================================================== ---- parted-2.4.orig/parted/parted.c -+++ parted-2.4/parted/parted.c -@@ -1464,7 +1464,7 @@ _print_disk_info (const PedDevice *dev, - "cpqarray", "file", "ataraid", "i2o", - "ubd", "dasd", "viodasd", "sx8", "dm", - "xvd", "sd/mmc", "virtblk", "aoe", -- "md"}; -+ "md", "loopback"}; - - char* start = ped_unit_format (dev, 0); - PedUnit default_unit = ped_unit_get_default (); diff --git a/parted-mac.patch b/parted-mac.patch index a2f29a9..32ff01f 100644 --- a/parted-mac.patch +++ b/parted-mac.patch @@ -1,7 +1,51 @@ -Index: parted-2.4/libparted/disk.c +--- + include/parted/disk.h | 9 +++++++-- + libparted/disk.c | 33 +++++++++++++++++++++++++++++++++ + libparted/labels/mac.c | 34 +++++++++++++++++++++++++++++++++- + parted/parted.c | 12 ++++++++++++ + 4 files changed, 85 insertions(+), 3 deletions(-) + +Index: parted-3.1/include/parted/disk.h =================================================================== ---- parted-2.4.orig/libparted/disk.c -+++ parted-2.4/libparted/disk.c +--- parted-3.1.orig/include/parted/disk.h ++++ parted-3.1/include/parted/disk.h +@@ -80,10 +80,11 @@ enum _PedPartitionFlag { + + enum _PedDiskTypeFeature { + PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ +- PED_DISK_TYPE_PARTITION_NAME=2 /**< supports partition names */ ++ PED_DISK_TYPE_PARTITION_NAME=2, /**< supports partition names */ ++ PED_DISK_TYPE_SYSTEM_NAME=4 /**< supports system names */ + }; + #define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED +-#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_NAME ++#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_SYSTEM_NAME + + struct _PedDisk; + struct _PedPartition; +@@ -243,6 +244,8 @@ struct _PedDiskOps { + /* other */ + int (*alloc_metadata) (PedDisk* disk); + int (*get_max_primary_partition_count) (const PedDisk* disk); ++ void (*partition_set_system_name) (PedPartition* part, const char* name); ++ const char* (*partition_get_system_name) (const PedPartition* part); + bool (*get_max_supported_partition_count) (const PedDisk* disk, + int* supported); + PedAlignment *(*get_partition_alignment)(const PedDisk *disk); +@@ -362,7 +365,9 @@ extern int ped_partition_is_flag_availab + extern int ped_partition_set_system (PedPartition* part, + const PedFileSystemType* fs_type); + extern int ped_partition_set_name (PedPartition* part, const char* name); ++extern int ped_partition_set_system_name (PedPartition* part, const char* name); + extern const char* ped_partition_get_name (const PedPartition* part); ++extern const char* ped_partition_get_system_name (const PedPartition* part); + extern int ped_partition_is_busy (const PedPartition* part); + extern char* ped_partition_get_path (const PedPartition* part); + +Index: parted-3.1/libparted/disk.c +=================================================================== +--- parted-3.1.orig/libparted/disk.c ++++ parted-3.1/libparted/disk.c @@ -1179,6 +1179,39 @@ _disk_pop_update_mode (PedDisk* disk) * @{ */ @@ -42,11 +86,11 @@ Index: parted-2.4/libparted/disk.c PedPartition* _ped_partition_alloc (const PedDisk* disk, PedPartitionType type, const PedFileSystemType* fs_type, -Index: parted-2.4/libparted/labels/mac.c +Index: parted-3.1/libparted/labels/mac.c =================================================================== ---- parted-2.4.orig/libparted/labels/mac.c -+++ parted-2.4/libparted/labels/mac.c -@@ -1386,6 +1386,36 @@ mac_get_partition_alignment(const PedDis +--- parted-3.1.orig/libparted/labels/mac.c ++++ parted-3.1/libparted/labels/mac.c +@@ -1395,6 +1395,36 @@ mac_get_partition_alignment(const PedDis return ped_alignment_new(0, sector_size); } @@ -83,7 +127,7 @@ Index: parted-2.4/libparted/labels/mac.c static PedConstraint* _primary_constraint (PedDisk* disk) { -@@ -1589,6 +1619,8 @@ static PedDiskOps mac_disk_ops = { +@@ -1598,6 +1628,8 @@ static PedDiskOps mac_disk_ops = { partition_set_name: mac_partition_set_name, partition_get_name: mac_partition_get_name, @@ -92,7 +136,7 @@ Index: parted-2.4/libparted/labels/mac.c get_partition_alignment: mac_get_partition_alignment, -@@ -1599,7 +1631,7 @@ static PedDiskType mac_disk_type = { +@@ -1608,7 +1640,7 @@ static PedDiskType mac_disk_type = { next: NULL, name: "mac", ops: &mac_disk_ops, @@ -101,76 +145,33 @@ Index: parted-2.4/libparted/labels/mac.c }; void -Index: parted-2.4/include/parted/disk.h +Index: parted-3.1/parted/parted.c =================================================================== ---- parted-2.4.orig/include/parted/disk.h -+++ parted-2.4/include/parted/disk.h -@@ -78,10 +78,11 @@ enum _PedPartitionFlag { - - enum _PedDiskTypeFeature { - PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -- PED_DISK_TYPE_PARTITION_NAME=2 /**< supports partition names */ -+ PED_DISK_TYPE_PARTITION_NAME=2, /**< supports partition names */ -+ PED_DISK_TYPE_SYSTEM_NAME=4 /**< supports system names */ - }; - #define PED_DISK_TYPE_FIRST_FEATURE PED_DISK_TYPE_EXTENDED --#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_PARTITION_NAME -+#define PED_DISK_TYPE_LAST_FEATURE PED_DISK_TYPE_SYSTEM_NAME - - struct _PedDisk; - struct _PedPartition; -@@ -241,6 +242,8 @@ struct _PedDiskOps { - /* other */ - int (*alloc_metadata) (PedDisk* disk); - int (*get_max_primary_partition_count) (const PedDisk* disk); -+ void (*partition_set_system_name) (PedPartition* part, const char* name); -+ const char* (*partition_get_system_name) (const PedPartition* part); - bool (*get_max_supported_partition_count) (const PedDisk* disk, - int* supported); - PedAlignment *(*get_partition_alignment)(const PedDisk *disk); -@@ -327,7 +330,9 @@ extern int ped_partition_is_flag_availab - extern int ped_partition_set_system (PedPartition* part, - const PedFileSystemType* fs_type); - extern int ped_partition_set_name (PedPartition* part, const char* name); -+extern int ped_partition_set_system_name (PedPartition* part, const char* name); - extern const char* ped_partition_get_name (const PedPartition* part); -+extern const char* ped_partition_get_system_name (const PedPartition* part); - extern int ped_partition_is_busy (const PedPartition* part); - extern char* ped_partition_get_path (const PedPartition* part); - -Index: parted-2.4/parted/parted.c -=================================================================== ---- parted-2.4.orig/parted/parted.c -+++ parted-2.4/parted/parted.c -@@ -1292,6 +1292,7 @@ partition_print_flags (PedPartition* par - char* res = ped_malloc(1); - void* _res = res; - int xtype; -+ const char* sysname; - - *res = '\0'; - -@@ -1326,6 +1327,23 @@ partition_print_flags (PedPartition* par - } +--- parted-3.1.orig/parted/parted.c ++++ parted-3.1/parted/parted.c +@@ -889,6 +889,7 @@ static char* + partition_print_flags (PedPartition const *part) + { + int xtype; ++ const char* sysname; + char *res = xstrdup (""); + if (!part) + return res; +@@ -921,6 +922,17 @@ partition_print_flags (PedPartition cons + } } + sysname = ped_partition_get_system_name( part ); + if (sysname) { -+ if (first_flag) -+ first_flag = 0; -+ else { -+ _res = res; -+ ped_realloc (&_res, strlen (res) -+ + 1 + 2); -+ res = _res; -+ strncat (res, ", ", 2); -+ } -+ _res = res; -+ ped_realloc (&_res, strlen (res) + 6 + strlen(sysname)); -+ res = _res; -+ strcat (res, "type="); -+ strcat (res, sysname); ++ char tmpstr[21]; ++ snprintf(tmpstr, sizeof(tmpstr) - 1, "type=%s", sysname); ++ size_t new_len = res_buf_len + strlen(sep) + strlen(tmpstr); ++ res = xrealloc(res, new_len); ++ stpcpy (stpcpy (res + res_buf_len - 1, sep), tmpstr); ++ res_buf_len = new_len; ++ sep = ", "; + } ++ return res; } diff --git a/parted-resize-command.patch b/parted-resize-command.patch new file mode 100644 index 0000000..ab27894 --- /dev/null +++ b/parted-resize-command.patch @@ -0,0 +1,122 @@ +--- + parted/parted.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 86 insertions(+) + +Index: parted-3.1/parted/parted.c +=================================================================== +--- parted-3.1.orig/parted/parted.c ++++ parted-3.1/parted/parted.c +@@ -152,6 +152,9 @@ static const char* fs_type_msg_start = N + static const char* start_end_msg = N_("START and END are disk locations, such as " + "4GB or 10%. Negative values count from the end of the disk. " + "For example, -1s specifies exactly the last sector.\n"); ++static const char* end_msg = N_("END is disk location, such as " ++ "4GB or 10%. Negative value counts from the end of the disk. " ++ "For example, -1s specifies exactly the last sector.\n"); + static const char* state_msg = N_("STATE is one of: on, off\n"); + static const char* device_msg = N_("DEVICE is usually /dev/hda or /dev/sda\n"); + static const char* name_msg = N_("NAME is any word you want\n"); +@@ -461,6 +464,21 @@ constraint_from_start_end (PedDevice* de + range_start, range_end, 1, dev->length); + } + ++static PedConstraint* ++constraint_from_start_end_fixed_start (PedDevice* dev, PedSector start_sector, ++ PedGeometry* range_end) ++{ ++ PedGeometry range_start; ++ range_start.dev = dev; ++ range_start.start = start_sector; ++ range_start.end = start_sector; ++ range_start.length = 1; ++ ++ return ped_constraint_new (ped_alignment_any, ped_alignment_any, ++ &range_start, range_end, 1, dev->length); ++} ++ ++ + void + help_on (char* topic) + { +@@ -1527,6 +1545,66 @@ error: + return 0; + } + ++ ++static int ++do_resize (PedDevice** dev) ++{ ++ PedDisk *disk; ++ PedPartition *part = NULL; ++ PedSector start, end, oldend; ++ PedGeometry *range_end = NULL; ++ PedConstraint* constraint; ++ ++ disk = ped_disk_new (*dev); ++ if (!disk) ++ goto error; ++ ++ if (ped_disk_is_flag_available(disk, PED_DISK_CYLINDER_ALIGNMENT)) ++ if (!ped_disk_set_flag(disk, PED_DISK_CYLINDER_ALIGNMENT, ++ alignment == ALIGNMENT_CYLINDER)) ++ goto error; ++ ++ if (!command_line_get_partition (_("Partition number?"), disk, &part)) ++ goto error; ++ if (!_partition_warn_busy (part)) ++ goto error; ++ ++ start = part->geom.start; ++ end = oldend = part->geom.end; ++ if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, NULL)) ++ goto error; ++ /* Do not move start of the partition */ ++ constraint = constraint_from_start_end_fixed_start (*dev, start, range_end); ++ if (!ped_disk_set_partition_geom (disk, part, constraint, ++ start, end)) ++ goto error_destroy_constraint; ++ /* warn when shrinking partition - might lose data */ ++ if (part->geom.end < oldend) ++ if (ped_exception_throw ( ++ PED_EXCEPTION_WARNING, ++ PED_EXCEPTION_YES_NO, ++ _("Shrinking a partition can cause data loss, " \ ++ "are you sure you want to continue?")) != PED_EXCEPTION_YES) ++ goto error_destroy_constraint; ++ ped_disk_commit (disk); ++ ped_constraint_destroy (constraint); ++ if (range_end != NULL) ++ ped_geometry_destroy (range_end); ++ ++ if ((*dev)->type != PED_DEVICE_FILE) ++ disk_is_modified = 1; ++ ++ return 1; ++ ++error_destroy_constraint: ++ ped_constraint_destroy (constraint); ++error: ++ if (range_end != NULL) ++ ped_geometry_destroy (range_end); ++ return 0; ++} ++ ++ + static int + do_rm (PedDevice** dev) + { +@@ -1899,6 +1977,14 @@ NULL), + str_list_create (_(start_end_msg), NULL), 1)); + + command_register (commands, command_create ( ++ str_list_create_unique ("resize", _("resize"), NULL), ++ do_resize, ++ str_list_create ( ++_("resize NUMBER END change end sector of partition NUMBER"), ++NULL), ++ str_list_create (_(number_msg), _(end_msg), NULL), 1)); ++ ++command_register (commands, command_create ( + str_list_create_unique ("rm", _("rm"), NULL), + do_rm, + str_list_create ( diff --git a/parted-type.patch b/parted-type.patch index acedc6d..218e597 100644 --- a/parted-type.patch +++ b/parted-type.patch @@ -1,76 +1,16 @@ --- - include/parted/disk.h | 9 +++++---- - libparted/disk.c | 2 ++ - libparted/labels/dos.c | 8 ++++++++ - parted/parted.c | 24 +++++++++++++++++++++--- - parted/ui.c | 3 +++ - 5 files changed, 39 insertions(+), 7 deletions(-) + include/parted/disk.h | 5 ++-- + libparted/disk.c | 2 + + libparted/labels/dos.c | 8 ++++++ + parted/parted.c | 59 ++++++++++++++++++++++++++++++++----------------- + parted/ui.c | 3 ++ + 5 files changed, 55 insertions(+), 22 deletions(-) -Index: parted-2.4/libparted/disk.c +Index: parted-3.1/include/parted/disk.h =================================================================== ---- parted-2.4.orig/libparted/disk.c -+++ parted-2.4/libparted/disk.c -@@ -2425,6 +2425,8 @@ ped_partition_flag_get_name (PedPartitio - return N_("lba"); - case PED_PARTITION_HPSERVICE: - return N_("hp-service"); -+ case PED_PARTITION_TYPE: -+ return N_("type"); - case PED_PARTITION_PALO: - return N_("palo"); - case PED_PARTITION_PREP: -Index: parted-2.4/libparted/labels/dos.c -=================================================================== ---- parted-2.4.orig/libparted/labels/dos.c -+++ parted-2.4/libparted/labels/dos.c -@@ -1496,6 +1496,10 @@ msdos_partition_set_flag (PedPartition* - disk = part->disk; - - switch (flag) { -+ case PED_PARTITION_TYPE: -+ dos_data->system = state; -+ return 1; -+ - case PED_PARTITION_HIDDEN: - if (part->type == PED_PARTITION_EXTENDED) { - ped_exception_throw ( -@@ -1591,6 +1595,9 @@ msdos_partition_get_flag (const PedParti - case PED_PARTITION_LBA: - return dos_data->lba; - -+ case PED_PARTITION_TYPE: -+ return dos_data->system; -+ - case PED_PARTITION_PALO: - return dos_data->palo; - -@@ -1617,6 +1624,7 @@ msdos_partition_is_flag_available (const - case PED_PARTITION_RAID: - case PED_PARTITION_LVM: - case PED_PARTITION_LBA: -+ case PED_PARTITION_TYPE: - case PED_PARTITION_PALO: - case PED_PARTITION_PREP: - case PED_PARTITION_DIAG: -Index: parted-2.4/parted/ui.c -=================================================================== ---- parted-2.4.orig/parted/ui.c -+++ parted-2.4/parted/ui.c -@@ -917,6 +917,9 @@ command_line_get_integer (const char* pr - NULL, 1); - if (!input) - return 0; -+ if (strstr(input, "0x") == input) -+ valid = sscanf (input, "%x", value); -+ else - valid = sscanf (input, "%d", value); - free (input); - return valid; -Index: parted-2.4/include/parted/disk.h -=================================================================== ---- parted-2.4.orig/include/parted/disk.h -+++ parted-2.4/include/parted/disk.h -@@ -70,10 +70,11 @@ enum _PedPartitionFlag { +--- parted-3.1.orig/include/parted/disk.h ++++ parted-3.1/include/parted/disk.h +@@ -72,10 +72,11 @@ enum _PedPartitionFlag { PED_PARTITION_BIOS_GRUB=12, PED_PARTITION_APPLE_TV_RECOVERY=13, PED_PARTITION_DIAG=14, @@ -84,59 +24,123 @@ Index: parted-2.4/include/parted/disk.h enum _PedDiskTypeFeature { PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -Index: parted-2.4/parted/parted.c +Index: parted-3.1/libparted/disk.c =================================================================== ---- parted-2.4.orig/parted/parted.c -+++ parted-2.4/parted/parted.c -@@ -1291,13 +1291,14 @@ partition_print_flags (PedPartition* par - const char* name; - char* res = ped_malloc(1); - void* _res = res; -+ int xtype; +--- parted-3.1.orig/libparted/disk.c ++++ parted-3.1/libparted/disk.c +@@ -2426,6 +2426,8 @@ ped_partition_flag_get_name (PedPartitio + return N_("lba"); + case PED_PARTITION_HPSERVICE: + return N_("hp-service"); ++ case PED_PARTITION_TYPE: ++ return N_("type"); + case PED_PARTITION_PALO: + return N_("palo"); + case PED_PARTITION_PREP: +Index: parted-3.1/libparted/labels/dos.c +=================================================================== +--- parted-3.1.orig/libparted/labels/dos.c ++++ parted-3.1/libparted/labels/dos.c +@@ -1509,6 +1509,10 @@ msdos_partition_set_flag (PedPartition* + disk = part->disk; - *res = '\0'; + switch (flag) { ++ case PED_PARTITION_TYPE: ++ dos_data->system = state; ++ return 1; ++ + case PED_PARTITION_HIDDEN: + if (part->type == PED_PARTITION_EXTENDED) { + ped_exception_throw ( +@@ -1604,6 +1608,9 @@ msdos_partition_get_flag (const PedParti + case PED_PARTITION_LBA: + return dos_data->lba; - first_flag = 1; - for (flag = ped_partition_flag_next (0); flag; - flag = ped_partition_flag_next (flag)) { -- if (ped_partition_get_flag (part, flag)) { -+ if (xtype = ped_partition_get_flag (part, flag)) { - if (first_flag) - first_flag = 0; - else { -@@ -1306,7 +1307,16 @@ partition_print_flags (PedPartition* par - res = _res; - strncat (res, ", ", 2); - } ++ case PED_PARTITION_TYPE: ++ return dos_data->system; ++ + case PED_PARTITION_PALO: + return dos_data->palo; + +@@ -1630,6 +1637,7 @@ msdos_partition_is_flag_available (const + case PED_PARTITION_RAID: + case PED_PARTITION_LVM: + case PED_PARTITION_LBA: ++ case PED_PARTITION_TYPE: + case PED_PARTITION_PALO: + case PED_PARTITION_PREP: + case PED_PARTITION_DIAG: +Index: parted-3.1/parted/parted.c +=================================================================== +--- parted-3.1.orig/parted/parted.c ++++ parted-3.1/parted/parted.c +@@ -888,28 +888,40 @@ error: + static char* + partition_print_flags (PedPartition const *part) + { +- char *res = xstrdup (""); +- if (!part) +- return res; - -+ if (flag == PED_PARTITION_TYPE) { -+ char tmpstr[21]; -+ int len = snprintf(tmpstr,sizeof(tmpstr)-1,"type=%02x",xtype); -+ _res = res; -+ ped_realloc (&_res, strlen (res) + 1 + -+ ((len>sizeof(tmpstr))?sizeof(tmpstr):len) ); -+ res = _res; -+ strncat (res, tmpstr, 21); +- PedPartitionFlag flag; +- size_t res_buf_len = 1; +- char const *sep = ""; +- for (flag = ped_partition_flag_next (0); flag; +- flag = ped_partition_flag_next (flag)) +- { +- if (ped_partition_get_flag (part, flag)) ++ int xtype; ++ char *res = xstrdup (""); ++ if (!part) ++ return res; ++ ++ PedPartitionFlag flag; ++ size_t res_buf_len = 1; ++ char const *sep = ""; ++ for (flag = ped_partition_flag_next (0); flag; ++ flag = ped_partition_flag_next (flag)) + { +- const char *name = _(ped_partition_flag_get_name (flag)); +- size_t new_len = res_buf_len + strlen (sep) + strlen (name); +- res = xrealloc (res, new_len); +- stpcpy (stpcpy (res + res_buf_len - 1, sep), name); +- res_buf_len = new_len; +- sep = ", "; ++ if (xtype = ped_partition_get_flag (part, flag)) ++ { ++ if (flag == PED_PARTITION_TYPE) { ++ char tmpstr[21]; ++ int len = snprintf(tmpstr, sizeof(tmpstr) - 1, "type=%02x", xtype); ++ size_t new_len = res_buf_len + strlen(sep) + strlen(tmpstr); ++ res = xrealloc(res, new_len); ++ stpcpy (stpcpy (res + res_buf_len - 1, sep), tmpstr); ++ res_buf_len = new_len; ++ sep = ", "; ++ } ++ else { ++ const char *name = _(ped_partition_flag_get_name (flag)); ++ size_t new_len = res_buf_len + strlen (sep) + strlen (name); ++ res = xrealloc (res, new_len); ++ stpcpy (stpcpy (res + res_buf_len - 1, sep), name); ++ res_buf_len = new_len; ++ sep = ", "; ++ } + } -+ else { - name = _(ped_partition_flag_get_name (flag)); - _res = res; - ped_realloc (&_res, strlen (res) + 1 + strlen (name)); -@@ -1314,6 +1324,7 @@ partition_print_flags (PedPartition* par - strcat(res, name); - } } -+ } +- } - return res; +- return res; ++ return res; } -@@ -2156,12 +2167,19 @@ do_set (PedDevice** dev) + + static int +@@ -1623,12 +1635,19 @@ do_set (PedDevice** dev) goto error_destroy_disk; if (!command_line_get_part_flag (_("Flag to Invert?"), part, &flag)) goto error_destroy_disk; -+ if( flag == PED_PARTITION_TYPE ) -+ state = ped_partition_get_flag (part, flag); -+ else ++ if( flag == PED_PARTITION_TYPE ) ++ state = ped_partition_get_flag (part, flag); ++ else state = (ped_partition_get_flag (part, flag) == 0 ? 1 : 0); - if (!is_toggle_mode) { @@ -144,10 +148,24 @@ Index: parted-2.4/parted/parted.c if (!command_line_get_state (_("New state?"), &state)) goto error_destroy_disk; } -+ else if( flag == PED_PARTITION_TYPE ) { -+ if (!command_line_get_integer (_("New type?"), &state)) -+ goto error_destroy_disk; -+ } ++ else if( flag == PED_PARTITION_TYPE ) { ++ if (!command_line_get_integer (_("New type?"), &state)) ++ goto error_destroy_disk; ++ } if (!ped_partition_set_flag (part, flag, state)) goto error_destroy_disk; +Index: parted-3.1/parted/ui.c +=================================================================== +--- parted-3.1.orig/parted/ui.c ++++ parted-3.1/parted/ui.c +@@ -917,6 +917,9 @@ command_line_get_integer (const char* pr + NULL, 1); + if (!input) + return 0; ++ if (strstr(input, "0x") == input) ++ valid = sscanf (input, "%x", value); ++ else + valid = sscanf (input, "%d", value); + free (input); + return valid; diff --git a/parted-use-ext-range.patch b/parted-use-ext-range.patch deleted file mode 100644 index 3abfe95..0000000 --- a/parted-use-ext-range.patch +++ /dev/null @@ -1,22 +0,0 @@ -Index: parted-2.4/libparted/arch/linux.c -=================================================================== ---- parted-2.4.orig/libparted/arch/linux.c -+++ parted-2.4/libparted/arch/linux.c -@@ -2413,7 +2413,7 @@ _blkpg_remove_partition (PedDisk* disk, - - /* - * The number of partitions that a device can have depends on the kernel. -- * If we don't find this value in /sys/block/DEV/range, we will use our own -+ * If we don't find this value in /sys/block/DEV/ext_range, we will use our own - * value. - */ - static unsigned int -@@ -2424,7 +2424,7 @@ _device_get_partition_range(PedDevice* d - FILE* fp; - bool ok; - -- r = snprintf(path, sizeof(path), "/sys/block/%s/range", -+ r = snprintf(path, sizeof(path), "/sys/block/%s/ext_range", - last_component(dev->path)); - if (r < 0 || r >= sizeof(path)) - return MAX_NUM_PARTS; diff --git a/parted-wipeaix.patch b/parted-wipeaix.patch index fe47747..518ae85 100644 --- a/parted-wipeaix.patch +++ b/parted-wipeaix.patch @@ -1,8 +1,12 @@ -Index: parted-2.3/libparted/labels/dos.c +--- + libparted/labels/dos.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +Index: parted-3.1/libparted/labels/dos.c =================================================================== ---- parted-2.3.orig/libparted/labels/dos.c 2010-07-08 13:28:03.000000000 +0200 -+++ parted-2.3/libparted/labels/dos.c 2010-07-08 13:28:13.000000000 +0200 -@@ -1176,7 +1176,13 @@ msdos_write (const PedDisk* disk) +--- parted-3.1.orig/libparted/labels/dos.c ++++ parted-3.1/libparted/labels/dos.c +@@ -1260,7 +1260,13 @@ msdos_write (const PedDisk* disk) return 0; DosRawTable *table = (DosRawTable *) s0; diff --git a/parted.changes b/parted.changes index 59700fb..accabe5 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,52 @@ +------------------------------------------------------------------- +Wed Jan 8 15:32:34 UTC 2014 - puzel@suse.com + +- update to parted-3.1 (fate#316110) +- changes in parted-3.1: + * Changes in behavior + - Floppy drives are no longer scanned on linux: they cannot be + partitioned anyhow, and some users have a misconfigured BIOS + that claims to have a floppy when they don't, and scanning + gets hung up. + - parted: the mkpart command has changed semantics with regard + to specifying the end of the partition. If the end is + specified using units of MiB, GiB, etc., parted subtracts one + sector from the specified value. With this change, it is now + possible to create partitions like 1MiB-2MiB, 2MiB-3MiB and + so on. + * Many bugfixes (see changelog) +- changes in parted-3.0: + * Changes in behavior + - Remove all FS-related (file system-related) sub-commands; + these commands are no longer recognized because they were all + dependent on parted "knowing" too much about file system: + mkpartfs, mkfs, cp, move, check. + - 'resize' command changed semantics: + it no longer resizes the filesystem, but only moves end + sector of the partition +- libparted-devel contains libparted-fs-resize library +- add ability to change size of the partition (ignoring contained + filesystem) with 'resize' command; this command has different + semantics than the former 'resize' command which upstream + decided to drop + - parted-resize-command.patch (fate#316110) +- when using syncmbr on POWER, make the first partition type 0x41 + (PReP boot) (bnc#797485) + - add libparted-ppc-prepboot-in-syncmbr.patch +- support for PReP GUID (bnc#797485) + - parted-GPT-add-support-for-PReP-GUID.patch +- Build requires makeinfo +- drop fix-function-def.patch (not needed) +- drop parted-stdio.h.patch (not needed) +- drop parted-use-ext-range.patch (upstream) +- drop fix-nilfs2-probe-function.patch (upstream) +- drop parted-improve-loop-support.patch (upstream) +- drop always-resize-part.dif (FS support removed) +- merged following hybrid pMBR patches: + parted-gpt-mbr-sync.patch, + parted-gpt-sync-mbr-label.patch, + parted-fix-gpt-sync-on-BE-systems.patch + ------------------------------------------------------------------- Mon Dec 30 09:15:06 UTC 2013 - puzel@suse.com diff --git a/parted.spec b/parted.spec index d305e1f..ae49e99 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ # # spec file for package parted # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,43 +17,44 @@ Name: parted -Version: 2.4 +Version: 3.1 Release: 0 Summary: GNU partitioner License: GPL-3.0+ Group: System/Filesystems Url: http://www.gnu.org/software/parted/ -Source0: ftp://ftp.gnu.org/gnu/parted/%{name}-%{version}.tar.gz -Source1: ftp://ftp.gnu.org/gnu/parted/%{name}-%{version}.tar.gz.sig +Source0: ftp://ftp.gnu.org/gnu/parted/%{name}-%{version}.tar.xz +Source1: ftp://ftp.gnu.org/gnu/parted/%{name}-%{version}.tar.xz.sig Source2: parted.keyring Source3: baselibs.conf -Patch0: always-resize-part.dif -Patch1: parted-type.patch -Patch2: parted-mac.patch -Patch3: parted-wipeaix.patch -Patch5: hfs_fix.dif -Patch7: fix-function-def.patch -Patch8: parted-gpt-mbr-sync.patch -#PATCH-FEATURE-OPENSUSE fix-dm-partition-name.patch bnc471440,447591 petr.uzel@suse.cz -Patch10: fix-dm-partition-name.patch -#PATCH-FEATURE-OPENSUSE do-not-create-dm-nodes.patch bnc#501773 petr.uzel@suse.cz -Patch11: do-not-create-dm-nodes.patch -#PATCH-FEATURE-OPENSUSE more-reliable-informing-the-kernel.patch bnc#657360 petr.uzel@suse.cz -Patch12: more-reliable-informing-the-kernel.patch -Patch13: parted-2.4-ncursesw6.patch -Patch14: parted-gpt-sync-mbr-label.patch -Patch15: parted-use-ext-range.patch -Patch16: parted-improve-loop-support.patch -Patch17: fix-nilfs2-probe-function.patch -Patch18: parted-fix-cciss-partition-naming.patch -Patch19: dummy-bootcode-only-for-x86.patch -Patch20: parted-stdio.h.patch +# Build patches +Patch1: parted-2.4-ncursesw6.patch + +# Other patches +Patch10: hfs_fix.dif +Patch11: parted-wipeaix.patch +Patch12: fix-error-informing-the-kernel.patch +#PATCH-FEATURE-SUSE fix-dm-partition-name.patch bnc471440,447591 petr.uzel@suse.cz +Patch13: fix-dm-partition-name.patch +Patch14: parted-fix-cciss-partition-naming.patch +Patch15: libparted-fix-mmcblk-partition-name.patch +#PATCH-FEATURE-SUSE do-not-create-dm-nodes.patch bnc#501773 petr.uzel@suse.cz +Patch16: do-not-create-dm-nodes.patch +#PATCH-FEATURE-SUSE more-reliable-informing-the-kernel.patch bnc#657360 petr.uzel@suse.cz +Patch17: more-reliable-informing-the-kernel.patch +#PATCH-FEATURE-SUSE revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch +# (clashes with our hybrid pMBR patches) +Patch18: revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch +Patch19: parted-gpt-mbr-sync.patch +Patch20: libparted-ppc-prepboot-in-syncmbr.patch Patch21: parted-workaround-windows7-gpt-implementation.patch -Patch22: fix-error-informing-the-kernel.patch -Patch23: parted-fix-gpt-sync-on-BE-systems.patch -Patch24: parted-btrfs-support.patch +Patch22: dummy-bootcode-only-for-x86.patch +Patch23: parted-type.patch +Patch24: parted-mac.patch Patch25: parted-Add-Intel-Rapid-Start-Technology-partition.patch -Patch26: libparted-fix-mmcblk-partition-name.patch +Patch26: parted-btrfs-support.patch +Patch27: parted-GPT-add-support-for-PReP-GUID.patch +Patch28: parted-resize-command.patch Requires: /sbin/udevadm BuildRequires: check-devel BuildRequires: device-mapper-devel >= 1.02.33 @@ -64,6 +65,7 @@ BuildRequires: libselinux-devel BuildRequires: libsepol-devel BuildRequires: libtool BuildRequires: libuuid-devel +BuildRequires: makeinfo BuildRequires: pkg-config BuildRequires: readline-devel %if %suse_version >= 1230 @@ -108,17 +110,11 @@ to develop applications that require these. %prep %{?gpg_verify: %gpg_verify %{S:1}} %setup -q -%patch0 %patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch5 -p1 -%patch7 -%patch8 %patch10 -p1 %patch11 -p1 %patch12 -p1 -%patch13 +%patch13 -p1 %patch14 -p1 %patch15 -p1 %patch16 -p1 @@ -132,18 +128,20 @@ to develop applications that require these. %patch24 -p1 %patch25 -p1 %patch26 -p1 +%patch27 -p1 +%patch28 -p1 %build export CFLAGS="%{optflags} `ncursesw6-config --cflags`" export LDFLAGS="`ncursesw6-config --libs`" AUTOPOINT=true autoreconf --force --install -%configure --disable-static \ - --with-pic \ +%configure --disable-static \ + --with-pic \ --enable-device-mapper=yes \ --enable-dynamic-loading=no \ --enable-selinux \ - --disable-Werror \ - --disable-silent-rules + --disable-Werror \ + --disable-silent-rules make %{?_smp_mflags} %install diff --git a/revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch b/revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch new file mode 100644 index 0000000..21a7ab2 --- /dev/null +++ b/revert-gpt-add-commands-to-manipulate-pMBR-boot-flag.patch @@ -0,0 +1,313 @@ +From ff10810537db7b9d1f287bed3c71a7570d395ba2 Mon Sep 17 00:00:00 2001 +From: Petr Uzel +Date: Wed, 8 Jan 2014 18:01:15 +0100 +Subject: [PATCH] Revert "gpt: add commands to manipulate pMBR boot flag" + +This reverts commit a73918ea6d9477ac3e8dad11ed62c87aecc49714. + +Conflicts: + libparted/labels/gpt.c +--- + include/parted/disk.in.h | 4 -- + libparted/disk.c | 3 -- + libparted/labels/gpt.c | 59 +----------------------------------------- + parted/parted.c | 66 ----------------------------------------------- + parted/ui.c | 29 -------------------- + parted/ui.h | 3 -- + 6 files changed, 4 insertions(+), 160 deletions(-) + +Index: parted-3.1/include/parted/disk.in.h +=================================================================== +--- parted-3.1.orig/include/parted/disk.in.h ++++ parted-3.1/include/parted/disk.in.h +@@ -36,11 +36,9 @@ enum _PedDiskFlag { + This flag is available for msdos and sun disklabels (for sun labels + it only controls the aligning of the end of the partition) */ + PED_DISK_CYLINDER_ALIGNMENT=1, +- /* This flag controls whether the boot flag of a GPT PMBR is set */ +- PED_DISK_GPT_PMBR_BOOT=2, + }; + #define PED_DISK_FIRST_FLAG PED_DISK_CYLINDER_ALIGNMENT +-#define PED_DISK_LAST_FLAG PED_DISK_GPT_PMBR_BOOT ++#define PED_DISK_LAST_FLAG PED_DISK_CYLINDER_ALIGNMENT + + /** + * Partition types +Index: parted-3.1/libparted/disk.c +=================================================================== +--- parted-3.1.orig/libparted/disk.c ++++ parted-3.1/libparted/disk.c +@@ -836,8 +836,7 @@ ped_disk_flag_get_name(PedDiskFlag flag) + switch (flag) { + case PED_DISK_CYLINDER_ALIGNMENT: + return N_("cylinder_alignment"); +- case PED_DISK_GPT_PMBR_BOOT: +- return N_("pmbr_boot"); ++ + default: + ped_exception_throw ( + PED_EXCEPTION_BUG, +Index: parted-3.1/libparted/labels/gpt.c +=================================================================== +--- parted-3.1.orig/libparted/labels/gpt.c ++++ parted-3.1/libparted/labels/gpt.c +@@ -264,7 +264,6 @@ struct __attribute__ ((packed)) _GPTDisk + PedGeometry data_area; + int entry_count; + efi_guid_t uuid; +- int pmbr_boot; + }; + + /* uses libparted's disk_specific field in PedPartition, to store our info */ +@@ -536,7 +535,6 @@ gpt_alloc (const PedDevice *dev) + gpt_disk_data->entry_count = GPT_DEFAULT_PARTITION_ENTRIES; + uuid_generate ((unsigned char *) &gpt_disk_data->uuid); + swap_uuid_and_efi_guid ((unsigned char *) (&gpt_disk_data->uuid)); +- gpt_disk_data->pmbr_boot = 0; + return disk; + + error_free_disk: +@@ -845,14 +843,6 @@ gpt_read_headers (PedDisk const *disk, + *backup_gpt = NULL; + PedDevice const *dev = disk->dev; + GPTDiskData *gpt_disk_data = disk->disk_specific; +- LegacyMBR_t *mbr; +- +- if (!ptt_read_sector (dev, 0, (void *)&mbr)) +- return 1; +- +- if (mbr->PartitionRecord[0].BootIndicator == 0x80) +- gpt_disk_data->pmbr_boot = 1; +- free (mbr); + + void *s1; + if (!ptt_read_sector (dev, 1, &s1)) +@@ -1090,7 +1080,7 @@ error: + #ifndef DISCOVER_ONLY + /* Write the protective MBR (to keep DOS happy) */ + static int +-_write_pmbr (PedDevice *dev, bool pmbr_boot) ++_write_pmbr (PedDevice *dev) + { + /* The UEFI spec is not clear about what to do with the following + elements of the Protective MBR (pmbr): BootCode (0-440B), +@@ -1115,8 +1105,6 @@ _write_pmbr (PedDevice *dev, bool pmbr_b + pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (0xFFFFFFFF); + else + pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (dev->length - 1UL); +- if (pmbr_boot) +- pmbr->PartitionRecord[0].BootIndicator = 0x80; + + int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA, + GPT_PMBR_SECTORS); +@@ -1237,7 +1225,7 @@ gpt_write (const PedDisk *disk) + ptes_crc = efi_crc32 (ptes, ptes_bytes); + + /* Write protective MBR */ +- if (!_write_pmbr (disk->dev, gpt_disk_data->pmbr_boot)) ++ if (!_write_pmbr (disk->dev)) + goto error_free_ptes; + + /* Write PTH and PTEs */ +@@ -1523,46 +1511,6 @@ gpt_partition_enumerate (PedPartition *p + } + + static int +-gpt_disk_set_flag (PedDisk *disk, PedDiskFlag flag, int state) +-{ +- GPTDiskData *gpt_disk_data = disk->disk_specific; +- switch (flag) +- { +- case PED_DISK_GPT_PMBR_BOOT: +- gpt_disk_data->pmbr_boot = state; +- return 1; +- default: +- return 0; +- } +-} +- +-static int +-gpt_disk_is_flag_available(const PedDisk *disk, PedDiskFlag flag) +-{ +- switch (flag) +- { +- case PED_DISK_GPT_PMBR_BOOT: +- return 1; +- default: +- return 0; +- } +-} +- +-static int +-gpt_disk_get_flag (const PedDisk *disk, PedDiskFlag flag) +-{ +- GPTDiskData *gpt_disk_data = disk->disk_specific; +- switch (flag) +- { +- case PED_DISK_GPT_PMBR_BOOT: +- return gpt_disk_data->pmbr_boot; +- break; +- default: +- return 0; +- } +-} +- +-static int + gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) + { + GPTPartitionData *gpt_part_data; +@@ -1850,9 +1798,6 @@ static PedDiskOps gpt_disk_ops = + + partition_set_name: gpt_partition_set_name, + partition_get_name: gpt_partition_get_name, +- disk_set_flag: gpt_disk_set_flag, +- disk_get_flag: gpt_disk_get_flag, +- disk_is_flag_available: gpt_disk_is_flag_available, + + PT_op_function_initializers (gpt) + }; +Index: parted-3.1/parted/parted.c +=================================================================== +--- parted-3.1.orig/parted/parted.c ++++ parted-3.1/parted/parted.c +@@ -1608,43 +1608,6 @@ error: + } + + static int +-do_disk_set (PedDevice** dev) +-{ +- PedDisk* disk; +- PedDiskFlag flag; +- int state; +- +- disk = ped_disk_new (*dev); +- if (!disk) +- goto error; +- +- if (!command_line_get_disk_flag (_("Flag to Invert?"), disk, &flag)) +- goto error_destroy_disk; +- state = (ped_disk_get_flag (disk, flag) == 0 ? 1 : 0); +- +- if (!is_toggle_mode) { +- if (!command_line_get_state (_("New state?"), &state)) +- goto error_destroy_disk; +- } +- +- if (!ped_disk_set_flag (disk, flag, state)) +- goto error_destroy_disk; +- if (!ped_disk_commit (disk)) +- goto error_destroy_disk; +- ped_disk_destroy (disk); +- +- if ((*dev)->type != PED_DEVICE_FILE) +- disk_is_modified = 1; +- +- return 1; +- +-error_destroy_disk: +- ped_disk_destroy (disk); +-error: +- return 0; +-} +- +-static int + do_set (PedDevice** dev) + { + PedDisk* disk; +@@ -1685,18 +1648,6 @@ error: + } + + static int +-do_disk_toggle (PedDevice **dev) +-{ +- int result; +- +- is_toggle_mode = 1; +- result = do_disk_set (dev); +- is_toggle_mode = 0; +- +- return result; +-} +- +-static int + do_toggle (PedDevice **dev) + { + int result; +@@ -1933,23 +1884,6 @@ NULL), + str_list_create (_(device_msg), NULL), 1)); + + command_register (commands, command_create ( +- str_list_create_unique ("disk_set", _("disk_set"), NULL), +- do_disk_set, +- str_list_create ( +-_("disk_set FLAG STATE change the FLAG on selected device"), +-NULL), +- str_list_create (flag_msg, _(state_msg), NULL), 1)); +- +-command_register (commands, command_create ( +- str_list_create_unique ("disk_toggle", _("disk_toggle"), NULL), +- do_disk_toggle, +- str_list_create ( +-_("disk_toggle [FLAG] toggle the state of FLAG on " +-"selected device"), +-NULL), +- str_list_create (flag_msg, NULL), 1)); +- +-command_register (commands, command_create ( + str_list_create_unique ("set", _("set"), NULL), + do_set, + str_list_create ( +Index: parted-3.1/parted/ui.c +=================================================================== +--- parted-3.1.orig/parted/ui.c ++++ parted-3.1/parted/ui.c +@@ -1116,35 +1116,6 @@ command_line_get_disk_type (const char* + } + + int +-command_line_get_disk_flag (const char* prompt, const PedDisk* disk, +- PedDiskFlag* flag) +-{ +- StrList* opts = NULL; +- PedPartitionFlag walk = 0; +- char* flag_name; +- +- while ( (walk = ped_disk_flag_next (walk)) ) { +- if (ped_disk_is_flag_available (disk, walk)) { +- const char* walk_name; +- +- walk_name = ped_disk_flag_get_name (walk); +- opts = str_list_append (opts, walk_name); +- opts = str_list_append_unique (opts, _(walk_name)); +- } +- } +- +- flag_name = command_line_get_word (prompt, NULL, opts, 1); +- str_list_destroy (opts); +- +- if (flag_name) { +- *flag = ped_disk_flag_get_by_name (flag_name); +- free (flag_name); +- return 1; +- } else +- return 0; +-} +- +-int + command_line_get_part_flag (const char* prompt, const PedPartition* part, + PedPartitionFlag* flag) + { +Index: parted-3.1/parted/ui.h +=================================================================== +--- parted-3.1.orig/parted/ui.h ++++ parted-3.1/parted/ui.h +@@ -63,9 +63,6 @@ extern int command_line_get_fs_type (con + const PedFileSystemType*(* value)); + extern int command_line_get_disk_type (const char* prompt, + const PedDiskType*(* value)); +-extern int command_line_get_disk_flag (const char* prompt, +- const PedDisk* disk, +- PedDiskFlag* flag); + extern int command_line_get_part_flag (const char* prompt, + const PedPartition* part, + PedPartitionFlag* flag); From 688bfd6e83c7e74d4f4f842d59d0c7ead6829c522d3753393b8f09190ac07f91 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Fri, 10 Jan 2014 10:19:46 +0000 Subject: [PATCH 2/2] delete dropped patches from source directory OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=80 --- fix-function-def.patch | 13 ------------- parted-stdio.h.patch | 18 ------------------ 2 files changed, 31 deletions(-) delete mode 100644 fix-function-def.patch delete mode 100644 parted-stdio.h.patch diff --git a/fix-function-def.patch b/fix-function-def.patch deleted file mode 100644 index 2bdcfaa..0000000 --- a/fix-function-def.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: libparted/fs/reiserfs/reiserfs.c -=================================================================== ---- libparted/fs/reiserfs/reiserfs.c.orig 2010-07-08 13:33:05.000000000 +0200 -+++ libparted/fs/reiserfs/reiserfs.c 2010-07-08 13:33:10.000000000 +0200 -@@ -86,7 +86,7 @@ FCLASS int (FPTR libreiserfs_exception_t - FCLASS int (FPTR libreiserfs_exception_option) (reiserfs_exception_t *); - FCLASS char *(FPTR libreiserfs_exception_message) (reiserfs_exception_t *); - FCLASS void (FPTR libreiserfs_exception_set_handler) -- (int(FPTR)(reiserfs_exception_t *)); -+ (int(*)(reiserfs_exception_t *)); - - FCLASS void (FPTR dal_realize) (dal_t *); - FCLASS size_t (FPTR dal_block_size) (dal_t *); diff --git a/parted-stdio.h.patch b/parted-stdio.h.patch deleted file mode 100644 index 778f9b3..0000000 --- a/parted-stdio.h.patch +++ /dev/null @@ -1,18 +0,0 @@ -Index: parted-2.4/lib/stdio.in.h -=================================================================== ---- parted-2.4.orig/lib/stdio.in.h -+++ parted-2.4/lib/stdio.in.h -@@ -731,11 +731,13 @@ _GL_CXXALIAS_RPL (gets, char *, (char *s - _GL_CXXALIAS_SYS (gets, char *, (char *s)); - # undef gets - # endif -+# if HAVE_RAW_DECL_GETS - _GL_CXXALIASWARN (gets); - /* It is very rare that the developer ever has full control of stdin, - so any use of gets warrants an unconditional warning. Assume it is - always declared, since it is required by C89. */ - _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); -+# endif - #endif - -