From bd04deb025e06c4c6c710ceee6c8d9618cc45ebf Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 5 Jun 2008 21:32:09 +0000 Subject: [PATCH] - Fix some of the atvrecv code (and the msftres code) so that the flags actually stick. --- parted-1.8.8-appletv.patch | 77 ++++++++++++++++++++++++-------------- parted.spec | 6 ++- 2 files changed, 54 insertions(+), 29 deletions(-) diff --git a/parted-1.8.8-appletv.patch b/parted-1.8.8-appletv.patch index b6c0df3..525e9bf 100644 --- a/parted-1.8.8-appletv.patch +++ b/parted-1.8.8-appletv.patch @@ -1,6 +1,6 @@ -diff -rup parted-1.8.8/include/parted/disk.h parted-1.8.8_atv/include/parted/disk.h ---- parted-1.8.8/include/parted/disk.h 2007-08-09 11:20:33.000000000 -0400 -+++ parted-1.8.8_atv/include/parted/disk.h 2008-01-11 23:28:45.000000000 -0500 +diff -up parted-1.8.8/include/parted/disk.h.appletv parted-1.8.8/include/parted/disk.h +--- parted-1.8.8/include/parted/disk.h.appletv 2007-08-09 11:20:33.000000000 -0400 ++++ parted-1.8.8/include/parted/disk.h 2008-06-05 16:04:16.000000000 -0400 @@ -52,10 +52,11 @@ enum _PedPartitionFlag { PED_PARTITION_HPSERVICE=8, PED_PARTITION_PALO=9, @@ -15,9 +15,9 @@ diff -rup parted-1.8.8/include/parted/disk.h parted-1.8.8_atv/include/parted/dis enum _PedDiskTypeFeature { PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -diff -rup parted-1.8.8/libparted/disk.c parted-1.8.8_atv/libparted/disk.c ---- parted-1.8.8/libparted/disk.c 2007-08-09 14:47:57.000000000 -0400 -+++ parted-1.8.8_atv/libparted/disk.c 2008-01-11 23:28:45.000000000 -0500 +diff -up parted-1.8.8/libparted/disk.c.appletv parted-1.8.8/libparted/disk.c +--- parted-1.8.8/libparted/disk.c.appletv 2007-08-09 14:47:57.000000000 -0400 ++++ parted-1.8.8/libparted/disk.c 2008-06-05 16:04:16.000000000 -0400 @@ -2181,6 +2181,8 @@ ped_partition_flag_get_name (PedPartitio return N_("prep"); case PED_PARTITION_MSFT_RESERVED: @@ -27,9 +27,9 @@ diff -rup parted-1.8.8/libparted/disk.c parted-1.8.8_atv/libparted/disk.c default: ped_exception_throw ( -diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/gpt.c ---- parted-1.8.8/libparted/labels/gpt.c 2007-07-31 13:36:57.000000000 -0400 -+++ parted-1.8.8_atv/libparted/labels/gpt.c 2008-01-11 23:28:45.000000000 -0500 +diff -up parted-1.8.8/libparted/labels/gpt.c.appletv parted-1.8.8/libparted/labels/gpt.c +--- parted-1.8.8/libparted/labels/gpt.c.appletv 2008-06-05 16:04:16.000000000 -0400 ++++ parted-1.8.8/libparted/labels/gpt.c 2008-06-05 17:27:07.000000000 -0400 @@ -122,6 +122,10 @@ typedef struct { ((efi_guid_t) { PED_CPU_TO_LE32 (0x48465300), PED_CPU_TO_LE16 (0x0000), \ PED_CPU_TO_LE16 (0x11AA), 0xaa, 0x11, \ @@ -41,7 +41,7 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ struct __attribute__ ((packed)) _GuidPartitionTableHeader_t { uint64_t Signature; -@@ -248,6 +252,7 @@ typedef struct _GPTPartitionData { +@@ -249,6 +253,7 @@ typedef struct _GPTPartitionData { int hp_service; int hidden; int msftres; @@ -49,7 +49,7 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ } GPTPartitionData; static PedDiskType gpt_disk_type; -@@ -753,7 +758,8 @@ _parse_part_entry (PedDisk* disk, GuidPa +@@ -759,7 +764,8 @@ _parse_part_entry (PedDisk* disk, GuidPa gpt_part_data->lvm = gpt_part_data->raid = gpt_part_data->boot = gpt_part_data->hp_service @@ -59,7 +59,7 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ if (pte->Attributes.RequiredToFunction & 0x1) gpt_part_data->hidden = 1; -@@ -768,6 +774,8 @@ _parse_part_entry (PedDisk* disk, GuidPa +@@ -774,6 +780,8 @@ _parse_part_entry (PedDisk* disk, GuidPa gpt_part_data->hp_service = 1; else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID)) gpt_part_data->msftres = 1; @@ -68,7 +68,7 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ return part; } -@@ -1133,6 +1141,7 @@ gpt_partition_new (const PedDisk* disk, +@@ -1202,6 +1210,7 @@ gpt_partition_new (const PedDisk* disk, gpt_part_data->hp_service = 0; gpt_part_data->hidden = 0; gpt_part_data->msftres = 0; @@ -76,18 +76,38 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ uuid_generate ((unsigned char*) &gpt_part_data->uuid); swap_uuid_and_efi_guid((unsigned char*)(&gpt_part_data->uuid)); strcpy (gpt_part_data->name, ""); -@@ -1232,6 +1241,10 @@ gpt_partition_set_system (PedPartition* - return 1; - } - } +@@ -1285,15 +1294,26 @@ gpt_partition_set_system (PedPartition* + gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID; + return 1; + } + if (gpt_part_data->atvrecv) { + gpt_part_data->type = PARTITION_APPLE_TV_RECOVERY_GUID; + return 1; + } - - gpt_part_data->type = PARTITION_BASIC_DATA_GUID; - return 1; -@@ -1307,7 +1320,8 @@ gpt_partition_set_flag(PedPartition *par + + if (fs_type) { +- if (strncmp (fs_type->name, "fat", 3) == 0 +- || strcmp (fs_type->name, "ntfs") == 0) { ++ if (!strncmp (fs_type->name, "fat", 3) == 0 ++ || !strcmp (fs_type->name, "ntfs") == 0) { + gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID; + return 1; + } +- if (strncmp (fs_type->name, "hfs", 3) == 0) { +- gpt_part_data->type = PARTITION_APPLE_HFS_GUID; ++ if (!strncmp (fs_type->name, "hfs", 3) == 0) { ++ if (!guid_cmp (gpt_part_data->type, ++ PARTITION_APPLE_TV_RECOVERY_GUID) ++ || gpt_part_data->atvrecv) { ++ gpt_part_data->type = ++ PARTITION_APPLE_TV_RECOVERY_GUID; ++ } else { ++ gpt_part_data->type = PARTITION_APPLE_HFS_GUID; ++ } + return 1; + } + if (strstr (fs_type->name, "swap")) { +@@ -1376,7 +1396,8 @@ gpt_partition_set_flag(PedPartition *par gpt_part_data->raid = gpt_part_data->lvm = gpt_part_data->hp_service @@ -97,7 +117,7 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_RAID: gpt_part_data->raid = state; -@@ -1315,7 +1329,8 @@ gpt_partition_set_flag(PedPartition *par +@@ -1384,7 +1405,8 @@ gpt_partition_set_flag(PedPartition *par gpt_part_data->boot = gpt_part_data->lvm = gpt_part_data->hp_service @@ -107,7 +127,7 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_LVM: gpt_part_data->lvm = state; -@@ -1323,7 +1338,8 @@ gpt_partition_set_flag(PedPartition *par +@@ -1392,7 +1414,8 @@ gpt_partition_set_flag(PedPartition *par gpt_part_data->boot = gpt_part_data->raid = gpt_part_data->hp_service @@ -117,7 +137,7 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_HPSERVICE: gpt_part_data->hp_service = state; -@@ -1331,7 +1347,8 @@ gpt_partition_set_flag(PedPartition *par +@@ -1400,7 +1423,8 @@ gpt_partition_set_flag(PedPartition *par gpt_part_data->boot = gpt_part_data->raid = gpt_part_data->lvm @@ -127,7 +147,7 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_MSFT_RESERVED: gpt_part_data->msftres = state; -@@ -1339,7 +1356,17 @@ gpt_partition_set_flag(PedPartition *par +@@ -1408,7 +1432,18 @@ gpt_partition_set_flag(PedPartition *par gpt_part_data->boot = gpt_part_data->raid = gpt_part_data->lvm @@ -143,10 +163,11 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ + = gpt_part_data->lvm + = gpt_part_data->hp_service + = gpt_part_data->msftres = 0; ++ return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_HIDDEN: gpt_part_data->hidden = state; -@@ -1371,6 +1398,8 @@ gpt_partition_get_flag(const PedPartitio +@@ -1440,6 +1475,8 @@ gpt_partition_get_flag(const PedPartitio return gpt_part_data->hp_service; case PED_PARTITION_MSFT_RESERVED: return gpt_part_data->msftres; @@ -155,11 +176,11 @@ diff -rup parted-1.8.8/libparted/labels/gpt.c parted-1.8.8_atv/libparted/labels/ case PED_PARTITION_HIDDEN: return gpt_part_data->hidden; case PED_PARTITION_SWAP: -@@ -1392,6 +1421,7 @@ gpt_partition_is_flag_available(const Pe +@@ -1461,6 +1498,7 @@ gpt_partition_is_flag_available(const Pe case PED_PARTITION_BOOT: case PED_PARTITION_HPSERVICE: case PED_PARTITION_MSFT_RESERVED: -+ case PED_PARTITION_APPLE_TV_RECOVERY: ++ case PED_PARTITION_APPLE_TV_RECOVERY: case PED_PARTITION_HIDDEN: return 1; case PED_PARTITION_SWAP: diff --git a/parted.spec b/parted.spec index 555380f..d27c829 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 1.8.8 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3+ Group: Applications/System URL: http://www.gnu.org/software/parted @@ -121,6 +121,10 @@ fi %{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc %changelog +* Thu Jun 05 2008 Peter Jones - 1.8.8-8 +- Fix some of the atvrecv code (and the msftres code) so that the flags + actually stick. + * Thu Jun 05 2008 Peter Jones - 1.8.8-7 - Added "atvrecv" flag patch from atv-bootloader project.