diff --git a/Fix-help-text-for-disk_-set-toggle.patch b/Fix-help-text-for-disk_-set-toggle.patch deleted file mode 100644 index 5109e05..0000000 --- a/Fix-help-text-for-disk_-set-toggle.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 3e005b4644d2a97da85c251f93d32d93e94bcccf Mon Sep 17 00:00:00 2001 -From: Phillip Susi -Date: Mon, 24 Feb 2014 11:29:43 -0500 -Subject: [PATCH] Fix help text for disk_{set,toggle} - -Fix the help text to show *disk* flags instead of partition flags. ---- - parted/parted.c | 23 +++++++++++++++++++++-- - 1 file changed, 21 insertions(+), 2 deletions(-) - -Index: parted-3.1/parted/parted.c -=================================================================== ---- parted-3.1.orig/parted/parted.c -+++ parted-3.1/parted/parted.c -@@ -144,6 +144,7 @@ static const char* number_msg = N_( - - static const char* label_type_msg_start = N_("LABEL-TYPE is one of: "); - static const char* flag_msg_start = N_("FLAG is one of: "); -+static const char* disk_flag_msg_start = N_("FLAG is one of: "); - static const char* unit_msg_start = N_("UNIT is one of: "); - static const char* min_or_opt_msg = N_("desired alignment: minimum or optimal"); - static const char* part_type_msg = N_("PART-TYPE is one of: primary, logical, " -@@ -170,6 +171,7 @@ static const char* copyright_msg = N_( - - static char* label_type_msg; - static char* flag_msg; -+static char* disk_flag_msg; - static char* unit_msg; - - static char* mkpart_fs_type_msg; -@@ -1845,6 +1847,7 @@ _init_messages () - PedFileSystemAlias* fs_alias; - PedDiskType* disk_type; - PedPartitionFlag part_flag; -+ PedDiskFlag disk_flag; - PedUnit unit; - - /* flags */ -@@ -1863,6 +1866,22 @@ _init_messages () - - flag_msg = str_list_convert (list); - str_list_destroy (list); -+/* disk flags */ -+ first = 1; -+ list = str_list_create (_(disk_flag_msg_start), NULL); -+ for (disk_flag = ped_disk_flag_next (0); disk_flag; -+ disk_flag = ped_disk_flag_next (disk_flag)) { -+ if (first) -+ first = 0; -+ else -+ str_list_append (list, ", "); -+ str_list_append (list, -+ _(ped_disk_flag_get_name (disk_flag))); -+ } -+ str_list_append (list, "\n"); -+ -+ disk_flag_msg = str_list_convert (list); -+ str_list_destroy (list); - - /* units */ - first = 1; -@@ -2055,7 +2074,7 @@ command_register (commands, command_crea - str_list_create ( - _("disk_set FLAG STATE change the FLAG on selected device"), - NULL), -- str_list_create (flag_msg, _(state_msg), NULL), 1)); -+ str_list_create (disk_flag_msg, _(state_msg), NULL), 1)); - - command_register (commands, command_create ( - str_list_create_unique ("disk_toggle", _("disk_toggle"), NULL), -@@ -2064,7 +2083,7 @@ command_register (commands, command_crea - _("disk_toggle [FLAG] toggle the state of FLAG on " - "selected device"), - NULL), -- str_list_create (flag_msg, NULL), 1)); -+ str_list_create (disk_flag_msg, NULL), 1)); - - command_register (commands, command_create ( - str_list_create_unique ("set", _("set"), NULL), diff --git a/do-not-create-dm-nodes.patch b/do-not-create-dm-nodes.patch deleted file mode 100644 index 490d17e..0000000 --- a/do-not-create-dm-nodes.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- - libparted/arch/linux.c | 45 ++++++++++++++++++++++++++++----------------- - 1 file changed, 28 insertions(+), 17 deletions(-) - -Index: parted-3.1/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 - #include -+#include - #include - #include - #include -@@ -2858,29 +2859,39 @@ err: - static int - _dm_reread_part_table (PedDisk* disk) - { -- int largest_partnum = ped_disk_get_last_partition_num (disk); -- if (largest_partnum <= 0) -- return 1; -- -- int rc = 1; -- int last = PED_MIN (largest_partnum, 16); -- int i; -+ int dev_minor; -+ int dev_major; -+ struct stat dev_stat; -+ char name_buf[40]; -+ FILE* f; - - sync(); -- if (!_dm_remove_parts(disk->dev)) -- rc = 0; - -- for (i = 1; i <= last; i++) { -- PedPartition* part; -+ /* Issue uevent for the device */ -+ if (!_device_stat (disk->dev, &dev_stat)) -+ return 0; - -- part = ped_disk_get_partition (disk, i); -- if (!part) -- continue; -+ dev_major = major (dev_stat.st_rdev); -+ dev_minor = minor (dev_stat.st_rdev); - -- if (!_dm_add_partition (disk, part)) -- rc = 0; -+ snprintf (name_buf, sizeof (name_buf), -+ "/sys/dev/block/%d:%d/uevent", dev_major, dev_minor); -+ -+ if ((f = fopen (name_buf, "w")) == NULL) -+ return 0; -+ -+ if (fputs ("change", f) == EOF) -+ return 0; -+ -+ fclose(f); -+ -+ /* Wait for udev to finish */ -+ if (system ("/sbin/udevadm settle --timeout=20") != 0) { -+ /* udevadm settle failed - let's sleep for a while */ -+ sleep (2); - } -- return rc; -+ -+ return 1; - } - #endif - diff --git a/dummy-bootcode-only-for-x86.patch b/dummy-bootcode-only-for-x86.patch index e4baf9c..e98df3a 100644 --- a/dummy-bootcode-only-for-x86.patch +++ b/dummy-bootcode-only-for-x86.patch @@ -2,11 +2,11 @@ libparted/labels/dos.c | 7 +++++++ 1 file changed, 7 insertions(+) -Index: parted-3.1/libparted/labels/dos.c +Index: parted-3.2/libparted/labels/dos.c =================================================================== ---- parted-3.1.orig/libparted/labels/dos.c -+++ parted-3.1/libparted/labels/dos.c -@@ -1260,6 +1260,12 @@ msdos_write (const PedDisk* disk) +--- parted-3.2.orig/libparted/labels/dos.c ++++ parted-3.2/libparted/labels/dos.c +@@ -1285,6 +1285,12 @@ msdos_write (const PedDisk* disk) return 0; DosRawTable *table = (DosRawTable *) s0; @@ -19,7 +19,7 @@ Index: parted-3.1/libparted/labels/dos.c /* either no bootrecord at all, or AIX IPL signature ... */ if ( (!table->boot_code[0]) || ( table->boot_code[0] == (char) 0xc9 && -@@ -1270,6 +1276,7 @@ msdos_write (const PedDisk* disk) +@@ -1295,6 +1301,7 @@ msdos_write (const PedDisk* disk) memset (table->boot_code, 0, 512); memcpy (table->boot_code, MBR_BOOT_CODE, sizeof (MBR_BOOT_CODE)); } diff --git a/fatresize-0.1.tar.bz2 b/fatresize-0.1.tar.bz2 index 095dfea..7e27847 100644 --- a/fatresize-0.1.tar.bz2 +++ b/fatresize-0.1.tar.bz2 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:719ac17da71795e060316c4a1fbac7f863976aa15c138da56519c98f3b192182 -size 1535 +oid sha256:d38e580c61216f059528c18612d6d80d9e4eb4fea01d3f670877c45aef78150b +size 1542 diff --git a/fix-dm-partition-name.patch b/fix-dm-partition-name.patch deleted file mode 100644 index 13321ea..0000000 --- a/fix-dm-partition-name.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- - libparted/arch/linux.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: parted-3.1/libparted/arch/linux.c -=================================================================== ---- 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 - || isdigit (dev->path[path_len - 1]) -- ? "p" : ""); -+ ? "_part" : ""); - result = zasprintf ("%s%s%d", dev->path, p, num); - } - diff --git a/fix-error-informing-the-kernel.patch b/fix-error-informing-the-kernel.patch deleted file mode 100644 index 23f2ba4..0000000 --- a/fix-error-informing-the-kernel.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- - libparted/arch/linux.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: parted-3.1/libparted/arch/linux.c -=================================================================== ---- 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) -- linux_part.length = part->geom.length == 1 ? 512 : 1024; -+ linux_part.length = PED_SECTOR_SIZE_DEFAULT; - else - linux_part.length = part->geom.length * disk->dev->sector_size; - linux_part.pno = part->num; diff --git a/hfs_fix.dif b/hfs_fix.dif index 85bae86..86c217c 100644 --- a/hfs_fix.dif +++ b/hfs_fix.dif @@ -2,11 +2,11 @@ libparted/labels/mac.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -Index: parted-3.1/libparted/labels/mac.c +Index: parted-3.2/libparted/labels/mac.c =================================================================== ---- 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 +--- parted-3.2.orig/libparted/labels/mac.c ++++ parted-3.2/libparted/labels/mac.c +@@ -467,7 +467,7 @@ _rawpart_is_void (MacRawPartition* raw_p return _rawpart_cmp_type (raw_part, "Apple_Void"); } @@ -15,7 +15,7 @@ Index: parted-3.1/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" -@@ -533,6 +533,13 @@ _rawpart_analyse (MacRawPartition* raw_p +@@ -530,6 +530,13 @@ _rawpart_analyse (MacRawPartition* raw_p if (!part) goto error; diff --git a/lib-fs-resize-prevent-crash-resizing-FAT16.patch b/lib-fs-resize-prevent-crash-resizing-FAT16.patch new file mode 100644 index 0000000..9ccf4d8 --- /dev/null +++ b/lib-fs-resize-prevent-crash-resizing-FAT16.patch @@ -0,0 +1,66 @@ +From 1e9e770f4bc7f3d80e09ecd1df58575fad064163 Mon Sep 17 00:00:00 2001 +From: Mike Fleetwood +Date: Sun, 28 Sep 2014 16:15:48 +0100 +Subject: [PATCH] lib-fs-resize: Prevent crash resizing FAT16 file systems + +Resizing FAT16 file system crashes in libparted/fs/r/fat/resize.c +create_resize_context() because it was dereferencing NULL pointer +fs_info->info_sector to copy the info_sector. + +Only FAT32 file systems have info_sector populated by fat_open() -> +fat_info_sector_read(). FAT12 and FAT16 file systems don't have an +info_sector so pointer fs_info->info_sector remains assigned NULL from +fat_alloc(). When resizing a FAT file system create_resize_context() +was always dereferencing fs_info->info_sector to memory copy the +info_sector, hence it crashed for FAT12 and FAT16. + +Make create_resize_context() only copy the info_sector for FAT32 file +systems. + +Reported by Christian Hesse in +https://bugzilla.gnome.org/show_bug.cgi?id=735669 +--- + NEWS | 4 ++++ + libparted/fs/r/fat/resize.c | 12 +++++++++--- + 2 files changed, 13 insertions(+), 3 deletions(-) + +Index: parted-3.2/NEWS +=================================================================== +--- parted-3.2.orig/NEWS ++++ parted-3.2/NEWS +@@ -160,6 +160,10 @@ GNU parted NEWS + System partitions) or "msftres" (which sets the "Microsoft Reserved" type + code). + ++** Bug Fixes ++ ++ libparted-fs-resize: Prevent crash resizing FAT16 file systems. ++ + + * Noteworthy changes in release 3.1 (2012-03-02) [stable] + +Index: parted-3.2/libparted/fs/r/fat/resize.c +=================================================================== +--- parted-3.2.orig/libparted/fs/r/fat/resize.c ++++ parted-3.2/libparted/fs/r/fat/resize.c +@@ -668,11 +668,17 @@ create_resize_context (PedFileSystem* fs + + /* preserve boot code, etc. */ + new_fs_info->boot_sector = ped_malloc (new_geom->dev->sector_size); +- new_fs_info->info_sector = ped_malloc (new_geom->dev->sector_size); + memcpy (new_fs_info->boot_sector, fs_info->boot_sector, + new_geom->dev->sector_size); +- memcpy (new_fs_info->info_sector, fs_info->info_sector, +- new_geom->dev->sector_size); ++ new_fs_info->info_sector = NULL; ++ if (fs_info->fat_type == FAT_TYPE_FAT32) ++ { ++ PED_ASSERT (fs_info->info_sector != NULL); ++ new_fs_info->info_sector = ++ ped_malloc (new_geom->dev->sector_size); ++ memcpy (new_fs_info->info_sector, fs_info->info_sector, ++ new_geom->dev->sector_size); ++ } + + new_fs_info->logical_sector_size = fs_info->logical_sector_size; + new_fs_info->sector_count = new_geom->length; diff --git a/libparted-Avoid-dasd-as-default-disk-type-while-probe.patch b/libparted-Avoid-dasd-as-default-disk-type-while-probe.patch deleted file mode 100644 index 5e9405c..0000000 --- a/libparted-Avoid-dasd-as-default-disk-type-while-probe.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 0673dabee6f5b19317b0d85e399e9f876a2c2ea7 Mon Sep 17 00:00:00 2001 -From: Nageswara R Sastry -Date: Wed, 21 Aug 2013 16:37:17 -0700 -Subject: [PATCH] libparted: Avoid dasd as default disk type while probe - -This patch avoids setting 'dasd' as a default disk type for -'disk image file' at the time of probe. - -Signed-off-by: Nageswara R Sastry ---- - include/parted/fdasd.in.h | 1 + - libparted/labels/fdasd.c | 6 +++++- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h -index 3692596..6f6a7e0 100644 ---- a/include/parted/fdasd.in.h -+++ b/include/parted/fdasd.in.h -@@ -261,6 +261,7 @@ typedef struct fdasd_anchor { - struct fdasd_hd_geometry geo; - unsigned int label_block; - unsigned int FBA_layout; -+ bool is_file; - } fdasd_anchor_t; - - enum offset {lower, upper}; -diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c -index b58b2be..7de5f34 100644 ---- a/libparted/labels/fdasd.c -+++ b/libparted/labels/fdasd.c -@@ -301,6 +301,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) - } - anc->hw_cylinders = 0; - anc->formatted_cylinders = 0; -+ anc->is_file = 0; - } - - /* -@@ -890,7 +891,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd) - /* Some times LDL formatted disks does not - contain any volume label */ - return 1; -- } else { -+ } else if (! anc->is_file) { - /* didn't find VOL1 volume label */ - anc->formatted_cylinders = anc->hw_cylinders; - anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads -@@ -974,6 +975,7 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) - dasd_info.FBA_layout = 0; - anc->hw_cylinders = ((st.st_size / blksize) / anc->geo.sectors) / - anc->geo.heads; -+ anc->is_file = 1; - } else { - if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) - fdasd_error(anc, unable_to_ioctl, -@@ -995,6 +997,8 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) - anc->hw_cylinders = characteristics->long_no_cyl; - else - anc->hw_cylinders = characteristics->no_cyl; -+ -+ anc->is_file = 0; - } - - anc->dev_type = dasd_info.dev_type; --- -1.8.4.5 - diff --git a/libparted-add-support-for-EAV-DASD-partitions.patch b/libparted-add-support-for-EAV-DASD-partitions.patch deleted file mode 100644 index 12fa8dc..0000000 --- a/libparted-add-support-for-EAV-DASD-partitions.patch +++ /dev/null @@ -1,1071 +0,0 @@ -From cbec53fdb9c8b244b497e42b0b215a8276803a88 Mon Sep 17 00:00:00 2001 -From: Nageswara R Sastry -Date: Wed, 21 Aug 2013 16:27:13 -0700 -Subject: [PATCH] libparted: add support for EAV DASD partitions - -Extended Address Volume (EAV) DASDs are ECKD DASDs with more than -65520 cylinders. This patch adds support for recognizing and -modifying partitions on EAV DASDs to Parted. The changes are -based on the EAV support added to version 1.8.1 [1] of the -s390-tools package. - -[1] http://www.ibm.com/developerworks/linux/linux390/s390-tools-1.8.1.html - -Signed-off-by: Nageswara R Sastry -Signed-off-by: Peter Oberparleiter ---- - include/parted/fdasd.in.h | 89 +++++++++++++++--- - include/parted/vtoc.in.h | 59 ++++++++++-- - libparted/labels/dasd.c | 1 + - libparted/labels/fdasd.c | 226 ++++++++++++++++++++++++++++++++-------------- - libparted/labels/vtoc.c | 173 ++++++++++++++++++++++++++++++----- - 5 files changed, 436 insertions(+), 112 deletions(-) - -diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h -index a755246..b4e7dd1 100644 ---- a/include/parted/fdasd.in.h -+++ b/include/parted/fdasd.in.h -@@ -74,6 +74,80 @@ typedef struct dasd_information_t { - char configuration_data[256]; /* from read_configuration_data */ - } dasd_information_t; - -+struct dasd_eckd_characteristics { -+ unsigned short cu_type; -+ struct { -+ unsigned char support:2; -+ unsigned char async:1; -+ unsigned char reserved:1; -+ unsigned char cache_info:1; -+ unsigned char model:3; -+ } __attribute__ ((packed)) cu_model; -+ unsigned short dev_type; -+ unsigned char dev_model; -+ struct { -+ unsigned char mult_burst:1; -+ unsigned char RT_in_LR:1; -+ unsigned char reserved1:1; -+ unsigned char RD_IN_LR:1; -+ unsigned char reserved2:4; -+ unsigned char reserved3:8; -+ unsigned char defect_wr:1; -+ unsigned char XRC_supported:1; -+ unsigned char reserved4:1; -+ unsigned char striping:1; -+ unsigned char reserved5:4; -+ unsigned char cfw:1; -+ unsigned char reserved6:2; -+ unsigned char cache:1; -+ unsigned char dual_copy:1; -+ unsigned char dfw:1; -+ unsigned char reset_alleg:1; -+ unsigned char sense_down:1; -+ } __attribute__ ((packed)) facilities; -+ unsigned char dev_class; -+ unsigned char unit_type; -+ unsigned short no_cyl; -+ unsigned short trk_per_cyl; -+ unsigned char sec_per_trk; -+ unsigned char byte_per_track[3]; -+ unsigned short home_bytes; -+ unsigned char formula; -+ union { -+ struct { -+ unsigned char f1; -+ unsigned short f2; -+ unsigned short f3; -+ } __attribute__ ((packed)) f_0x01; -+ struct { -+ unsigned char f1; -+ unsigned char f2; -+ unsigned char f3; -+ unsigned char f4; -+ unsigned char f5; -+ } __attribute__ ((packed)) f_0x02; -+ } __attribute__ ((packed)) factors; -+ unsigned short first_alt_trk; -+ unsigned short no_alt_trk; -+ unsigned short first_dia_trk; -+ unsigned short no_dia_trk; -+ unsigned short first_sup_trk; -+ unsigned short no_sup_trk; -+ unsigned char MDR_ID; -+ unsigned char OBR_ID; -+ unsigned char director; -+ unsigned char rd_trk_set; -+ unsigned short max_rec_zero; -+ unsigned char reserved1; -+ unsigned char RWANY_in_LR; -+ unsigned char factor6; -+ unsigned char factor7; -+ unsigned char factor8; -+ unsigned char reserved2[3]; -+ unsigned char reserved3[6]; -+ unsigned int long_no_cyl; -+} __attribute__ ((packed)); -+ - /* - * struct format_data_t - * represents all data necessary to format a dasd -@@ -116,18 +190,6 @@ typedef struct format_data_t { - #define BLKRRPART _IO(0x12,95) - /* get block device sector size */ - #define BLKSSZGET _IO(0x12,104) -- --/***************************************************************************** -- * SECTION: Definition from hdreq.h * -- *****************************************************************************/ -- --struct fdasd_hd_geometry { -- unsigned char heads; -- unsigned char sectors; -- unsigned short cylinders; -- unsigned long start; --}; -- - /* get device geometry */ - #define HDIO_GETGEO 0x0301 - -@@ -189,10 +251,13 @@ typedef struct fdasd_anchor { - format4_label_t *f4; - format5_label_t *f5; - format7_label_t *f7; -+ format9_label_t *f9; /* template for all f9 labels */ - partition_info_t *first; - partition_info_t *last; - volume_label_t *vlabel; - config_data_t confdata[USABLE_PARTITIONS]; -+ u_int32_t hw_cylinders; -+ u_int32_t formatted_cylinders; - struct fdasd_hd_geometry geo; - unsigned int label_block; - unsigned int FBA_layout; -diff --git a/include/parted/vtoc.in.h b/include/parted/vtoc.in.h -index d79ce39..499c2d3 100644 ---- a/include/parted/vtoc.in.h -+++ b/include/parted/vtoc.in.h -@@ -42,6 +42,18 @@ - - #define VOLSER_LENGTH 6 - #define BIG_DISK_SIZE 0x10000 -+#define LV_COMPAT_CYL 0xFFFE -+ -+/***************************************************************************** -+ * SECTION: Definition from hdreq.h * -+ *****************************************************************************/ -+ -+struct fdasd_hd_geometry { -+ unsigned char heads; -+ unsigned char sectors; -+ unsigned short cylinders; -+ unsigned long start; -+}; - - - typedef struct ttr ttr_t; -@@ -59,6 +71,7 @@ typedef struct ds5ext ds5ext_t; - typedef struct format5_label format5_label_t; - typedef struct ds7ext ds7ext_t; - typedef struct format7_label format7_label_t; -+typedef struct format9_label format9_label_t; - - struct __attribute__ ((packed)) ttr { - u_int16_t tt; -@@ -169,6 +182,10 @@ struct __attribute__ ((packed)) dev_const { - u_int8_t DS4DEVDB; /* number of directory blocks per track */ - }; - -+/* -+ * format 1 and format 8 label have the same layout so we use the following -+ * structure for both. -+ */ - struct __attribute__ ((packed)) format1_label { - char DS1DSNAM[44]; /* data set name */ - u_int8_t DS1FMTID; /* format identifier */ -@@ -229,7 +246,11 @@ struct __attribute__ ((packed)) format4_label { - char res2[10]; /* reserved */ - u_int8_t DS4EFLVL; /* extended free-space management level */ - cchhb_t DS4EFPTR; /* pointer to extended free-space info */ -- char res3[9]; /* reserved */ -+ char res3; /* reserved */ -+ u_int32_t DS4DCYL; /* number of logical cyls */ -+ char res4[2]; /* reserved */ -+ u_int8_t DS4DEVF2; /* device flags */ -+ char res5; /* reserved */ - }; - - struct __attribute__ ((packed)) ds5ext { -@@ -261,12 +282,28 @@ struct __attribute__ ((packed)) format7_label { - cchhb_t DS7PTRDS; /* pointer to next FMT7 DSCB */ - }; - -+struct __attribute__ ((packed)) format9_label { -+ u_int8_t DS9KEYID; /* key code for format 9 labels (0x09) */ -+ u_int8_t DS9SUBTY; /* subtype (0x01) */ -+ u_int8_t DS9NUMF9; /* number of F9 datasets */ -+ u_int8_t res1[41]; /* reserved */ -+ u_int8_t DS9FMTID; /* format identifier */ -+ u_int8_t res2[95]; /* reserved */ -+}; -+ - char *vtoc_ebcdic_enc (char const *source, char *target, int l); - char *vtoc_ebcdic_dec (char const *source, char *target, int l); - void vtoc_set_extent (extent_t *ext, u_int8_t typeind, u_int8_t seqno, - cchh_t *lower, cchh_t *upper); --void vtoc_set_cchh (cchh_t *addr, u_int16_t cc, u_int16_t hh); --void vtoc_set_cchhb (cchhb_t *addr, u_int16_t cc, u_int16_t hh, u_int8_t b); -+void vtoc_set_cchh (cchh_t *addr, u_int32_t cc, u_int16_t hh); -+u_int32_t vtoc_get_cyl_from_cchh(cchh_t *addr); -+u_int16_t vtoc_get_head_from_cchh(cchh_t *addr); -+void vtoc_set_cchhb (cchhb_t *addr, u_int32_t cc, u_int16_t hh, u_int8_t b); -+u_int32_t vtoc_get_cyl_from_cchhb(cchhb_t *addr); -+u_int16_t vtoc_get_head_from_cchhb(cchhb_t *addr); -+u_int64_t cchhb2blk(cchhb_t *p, struct fdasd_hd_geometry *geo); -+u_int64_t cchh2blk (cchh_t *p, struct fdasd_hd_geometry *geo); -+u_int32_t cchh2trk (cchh_t *p, struct fdasd_hd_geometry *geo); - void vtoc_set_date (labeldate_t *d, u_int8_t year, u_int16_t day); - - void vtoc_volume_label_init (volume_label_t *vlabel); -@@ -295,14 +332,16 @@ void vtoc_write_label (int fd, unsigned long position, - format1_label_t const *f1, - format4_label_t const *f4, - format5_label_t const *f5, -- format7_label_t const *f7); -+ format7_label_t const *f7, -+ format9_label_t const *f9); - - void vtoc_init_format1_label (char *volid, unsigned int blksize, - extent_t *part_extent, format1_label_t *f1); - - void vtoc_init_format4_label (format4_label_t *f4lbl, - unsigned int usable_partitions, -- unsigned int cylinders, -+ unsigned int compat_cylinders, -+ unsigned int real_cylinders, - unsigned int tracks, - unsigned int blocks, - unsigned int blksize, -@@ -329,8 +368,16 @@ void vtoc_update_format7_label_add (format7_label_t *f7, int verbose, - void vtoc_update_format7_label_del (format7_label_t *f7, int verbose, - u_int32_t a, u_int32_t b); - -+void vtoc_init_format8_label (char *volid, unsigned int blksize, -+ extent_t *part_extent, format1_label_t *f1); -+ -+void vtoc_update_format8_label (cchhb_t *associated_f9, format1_label_t *f8); -+ -+void vtoc_init_format9_label (format9_label_t *f9); -+ - void vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5, - format7_label_t *f7, char ch, int verbose, -- u_int32_t start, u_int32_t stop, int cyl, int trk); -+ u_int32_t start, u_int32_t stop, u_int32_t cyl, -+ u_int32_t trk); - - #endif /* VTOC_H */ -diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c -index b4e80b1..081b3c5 100644 ---- a/libparted/labels/dasd.c -+++ b/libparted/labels/dasd.c -@@ -631,6 +631,7 @@ dasd_write (const PedDisk* disk) - /* initialize the anchor */ - fdasd_initialize_anchor(&anchor); - fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd); -+ fdasd_check_volume(&anchor, arch_specific->fd); - memcpy(anchor.vlabel, &disk_specific->vlabel, sizeof(volume_label_t)); - anchor.vlabel_changed++; - -diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c -index f92065f..2735b2a 100644 ---- a/libparted/labels/fdasd.c -+++ b/libparted/labels/fdasd.c -@@ -59,6 +59,48 @@ setpos (fdasd_anchor_t *anc, int dsn, int pos) - anc->partno[dsn] = pos; - } - -+static u_int32_t -+get_usable_cylinders (fdasd_anchor_t *anc) -+{ -+ u_int32_t cyl; -+ -+ /* large volume */ -+ if (anc->f4->DS4DEVCT.DS4DSCYL == LV_COMPAT_CYL && -+ anc->f4->DS4DCYL > anc->f4->DS4DEVCT.DS4DSCYL) -+ return anc->f4->DS4DCYL; -+ /* normal volume */ -+ if (anc->f4->DS4DEVCT.DS4DEVFG & ALTERNATE_CYLINDERS_USED) -+ cyl = anc->f4->DS4DEVCT.DS4DSCYL - -+ (u_int16_t) anc->f4->DS4DEVAC; -+ else -+ cyl = anc->f4->DS4DEVCT.DS4DSCYL; -+ return cyl; -+} -+ -+static void -+get_addr_of_highest_f1_f8_label (fdasd_anchor_t *anc, cchhb_t *addr) -+{ -+ -+ u_int8_t record; -+ /* We have to count the follwing labels: -+ * one format 4 -+ * one format 5 -+ * format 7 only if we have moren then BIG_DISK_SIZE tracks -+ * one for each format 1 or format 8 label == one for each partition -+ * one for each format 9 label before the last format 8 -+ * We assume that all partitions use format 8 labels when -+ * anc->formatted_cylinders > LV_COMPAT_CYL -+ * Note: Record zero is special, so block 0 on our disk is record 1! -+ */ -+ -+ record = anc->used_partitions + 2; -+ if (anc->big_disk) -+ record++; -+ if (anc->formatted_cylinders > LV_COMPAT_CYL) -+ record += anc->used_partitions - 1; -+ vtoc_set_cchhb(addr, VTOC_START_CC, VTOC_START_HH, record); -+} -+ - void - fdasd_cleanup (fdasd_anchor_t *anchor) - { -@@ -72,6 +114,7 @@ fdasd_cleanup (fdasd_anchor_t *anchor) - free(anchor->f4); - free(anchor->f5); - free(anchor->f7); -+ free(anchor->f9); - free(anchor->vlabel); - - p = anchor->first; -@@ -82,6 +125,7 @@ fdasd_cleanup (fdasd_anchor_t *anchor) - if (p == NULL) - return; - q = p->next; -+ free(p->f1); - free(p); - p = q; - } -@@ -154,17 +198,6 @@ fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char const *str) - } - - /* -- * converts cyl-cyl-head-head-blk to blk -- */ --static unsigned long --cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo) --{ -- PDEBUG -- return (unsigned long) (p->cc * geo->heads * geo->sectors -- + p->hh * geo->sectors + p->b); --} -- --/* - * initializes the anchor structure and allocates some - * memory for the labels - */ -@@ -216,9 +249,16 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) - if (anc->f7 == NULL) - fdasd_error(anc, malloc_failed, "FMT7 DSCB."); - -+ /* template for all format 9 labels */ -+ anc->f9 = malloc(sizeof(format9_label_t)); -+ if (anc->f9 == NULL) -+ fdasd_error(anc, malloc_failed, "FMT9 DSCB."); -+ - bzero(anc->f4, sizeof(format4_label_t)); - bzero(anc->f5, sizeof(format5_label_t)); - bzero(anc->f7, sizeof(format7_label_t)); -+ bzero(anc->f9, sizeof(format9_label_t)); -+ vtoc_init_format9_label(anc->f9); - - v = malloc(sizeof(volume_label_t)); - if (v == NULL) -@@ -259,6 +299,8 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) - - q = p; - } -+ anc->hw_cylinders = 0; -+ anc->formatted_cylinders = 0; - } - - /* -@@ -269,44 +311,46 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd) - { - PDEBUG - partition_info_t *p; -- unsigned long b; -+ unsigned long b, maxblk; - char dsno[6], s1[7], s2[45], *c1, *c2, *ch; - int i = 0, k = 0; -+ cchhb_t f9addr; -+ format1_label_t emptyf1; - - b = (cchhb2blk (&anc->vlabel->vtoc, &anc->geo) - 1) * anc->blksize; - if (b <= 0) - fdasd_error (anc, vlabel_corrupted, ""); -+ maxblk = b + anc->blksize * 9; /* f4+f5+f7+3*f8+3*f9 */ - - /* write FMT4 DSCB */ -- vtoc_write_label (fd, b, NULL, anc->f4, NULL, NULL); -+ vtoc_write_label (fd, b, NULL, anc->f4, NULL, NULL, NULL); -+ b += anc->blksize; - - /* write FMT5 DSCB */ -+ vtoc_write_label (fd, b, NULL, NULL, anc->f5, NULL, NULL); - b += anc->blksize; -- vtoc_write_label (fd, b, NULL, NULL, anc->f5, NULL); - - /* write FMT7 DSCB */ - if (anc->big_disk) { -+ vtoc_write_label (fd, b, NULL, NULL, NULL, anc->f7, NULL); - b += anc->blksize; -- vtoc_write_label (fd, b, NULL, NULL, NULL, anc->f7); - } - -- /* loop over all FMT1 DSCBs */ -- p = anc->first; -- for (i = 0; i < USABLE_PARTITIONS; i++) { -- b += anc->blksize; -+ /* loop over all partitions (format 1 or format 8 DCB) */ -+ for (p = anc->first; p != NULL; p = p->next) { - - if (p->used != 0x01) { -- vtoc_write_label (fd, b, p->f1, NULL, NULL, NULL); - continue; - } - -+ i++; - strncpy (p->f1->DS1DSSN, anc->vlabel->volid, 6); - - ch = p->f1->DS1DSNAM; - vtoc_ebcdic_dec (ch, ch, 44); - c1 = ch + 7; - -- if (getdsn (anc, i) > -1) { -+ if (getdsn (anc, i-1) > -1) { - /* re-use the existing data set name */ - c2 = strchr (c1, '.'); - if (c2 != NULL) -@@ -325,11 +369,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd) - while (getpos (anc, k) > -1) - k++; - -- setpos (anc, k, i); -- -- strncpy (s2, ch, 44); -- s2[44] = 0; -- vtoc_ebcdic_dec (s2, s2, 44); -+ setpos (anc, k, i-1); - - strncpy (ch, "LINUX.V " " ", 44); - -@@ -366,8 +406,32 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd) - - vtoc_ebcdic_enc (ch, ch, 44); - -- vtoc_write_label (fd, b, p->f1, NULL, NULL, NULL); -- p = p->next; -+ if (p->f1->DS1FMTID == 0xf8 ) { -+ /* Now as we know where which label will be written, we -+ * can add the address of the format 9 label to the -+ * format 8 label. The f9 record will be written to the -+ * block after the current blk. Remember: records are of -+ * by one, so we have to add 2 and not just one. -+ */ -+ vtoc_set_cchhb(&f9addr, VTOC_START_CC, VTOC_START_HH, -+ ((b / anc->blksize) % anc->geo.sectors) + 2); -+ vtoc_update_format8_label(&f9addr, p->f1); -+ vtoc_write_label(fd, b, p->f1, NULL, NULL, NULL, NULL); -+ b += anc->blksize; -+ vtoc_write_label(fd, b, NULL, NULL, NULL, NULL, -+ anc->f9); -+ b += anc->blksize; -+ } else { -+ vtoc_write_label(fd, b, p->f1, NULL, NULL, NULL, NULL); -+ b += anc->blksize; -+ } -+ } -+ -+ /* write empty labels to the rest of the blocks */ -+ bzero(&emptyf1, sizeof(emptyf1)); -+ while (b < maxblk) { -+ vtoc_write_label(fd, b, &emptyf1, NULL, NULL, NULL, NULL); -+ b += anc->blksize; - } - } - -@@ -394,20 +458,25 @@ int - fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) - { - PDEBUG -- partition_info_t *p = anc->first; -+ partition_info_t *p; - char dsno[6], s1[7], s2[45], *c1, *c2, *ch; - int i = 0, k = 0; - -- /* loop over all FMT1 DSCBs */ -- p = anc->first; -- for (i = 0; i < USABLE_PARTITIONS; i++) { -+ /* loop over all partitions (format 1 or format 8 DCB) */ -+ for (p = anc->first; p != NULL; p = p->next) { -+ -+ if (p->used != 0x01) { -+ continue; -+ } -+ -+ i++; - strncpy (p->f1->DS1DSSN, anc->vlabel->volid, 6); - - ch = p->f1->DS1DSNAM; - vtoc_ebcdic_dec (ch, ch, 44); - c1 = ch + 7; - -- if (getdsn (anc, i) > -1) { -+ if (getdsn (anc, i-1) > -1) { - /* re-use the existing data set name */ - c2 = strchr (c1, '.'); - if (c2 != NULL) -@@ -426,11 +495,7 @@ fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) - while (getpos (anc, k) > -1) - k++; - -- setpos (anc, k, i); -- -- strncpy (s2, ch, 44); -- s2[44] = 0; -- vtoc_ebcdic_dec (s2, s2, 44); -+ setpos (anc, k, i-1); - - strncpy (ch, "LINUX.V " " ", 44); - -@@ -466,7 +531,6 @@ fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) - } - - vtoc_ebcdic_enc (ch, ch, 44); -- p = p->next; - } - - return 1; -@@ -482,6 +546,7 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) - vtoc_init_format4_label(anc->f4, - USABLE_PARTITIONS, - anc->geo.cylinders, -+ anc->formatted_cylinders, - anc->geo.heads, - anc->geo.sectors, - anc->blksize, -@@ -492,8 +557,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) - vtoc_set_freespace(anc->f4, anc->f5, anc->f7, - '+', anc->verbose, - FIRST_USABLE_TRK, -- anc->geo.cylinders * anc->geo.heads - 1, -- anc->geo.cylinders, anc->geo.heads); -+ anc->formatted_cylinders * anc->geo.heads - 1, -+ anc->formatted_cylinders, anc->geo.heads); - - for (i = 0; i < USABLE_PARTITIONS; i++) { - bzero(p->f1, sizeof(format1_label_t)); -@@ -507,7 +572,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) - } - - anc->used_partitions = 0; -- anc->fspace_trk = anc->geo.cylinders * anc->geo.heads - FIRST_USABLE_TRK; -+ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads - -+ FIRST_USABLE_TRK; - - for (i=0; ifirst; -- unsigned int h = anc->geo.heads; -- unsigned long max = anc->geo.cylinders * h - 1; -+ unsigned long max = anc->formatted_cylinders * anc->geo.heads - 1; - int i; - char *ch; - - anc->used_partitions = anc->geo.sectors - 2 - anc->f4->DS4DSREC; - - for (i = 1; i <= USABLE_PARTITIONS; i++) { -- if (p->f1->DS1FMTID != 0xf1) { -+ if (p->f1->DS1FMTID != 0xf1 && -+ p->f1->DS1FMTID != 0xf8) { - if (i == 1) - /* there is no partition at all */ - anc->fspace_trk = max - FIRST_USABLE_TRK + 1; -@@ -546,8 +612,8 @@ fdasd_update_partition_info (fdasd_anchor_t *anc) - - /* this is a valid format 1 label */ - p->used = 0x01; -- p->start_trk = p->f1->DS1EXT1.llimit.cc * h + p->f1->DS1EXT1.llimit.hh; -- p->end_trk = p->f1->DS1EXT1.ulimit.cc * h + p->f1->DS1EXT1.ulimit.hh; -+ p->start_trk = cchh2trk(&p->f1->DS1EXT1.llimit, &anc->geo); -+ p->end_trk = cchh2trk(&p->f1->DS1EXT1.ulimit, &anc->geo); - p->len_trk = p->end_trk - p->start_trk + 1; - - if (i == 1) { -@@ -618,14 +684,22 @@ fdasd_process_valid_vtoc (fdasd_anchor_t * anc, unsigned long b, int fd) - format1_label_t q; - char s[5], *ch; - -+ if (anc->f4->DS4DEVCT.DS4DSCYL == LV_COMPAT_CYL && -+ anc->f4->DS4DCYL > anc->f4->DS4DEVCT.DS4DSCYL) -+ anc->formatted_cylinders = anc->f4->DS4DCYL; -+ else -+ anc->formatted_cylinders = anc->f4->DS4DEVCT.DS4DSCYL; -+ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads - -+ FIRST_USABLE_TRK; - b += anc->blksize; - -- for (i = 1; i <= anc->geo.sectors; i++) { -+ for (i = 1; i < anc->geo.sectors; i++) { - bzero (&q, f1size); - vtoc_read_label (fd, b, &q, NULL, NULL, NULL); - - switch (q.DS1FMTID) { - case 0xf1: -+ case 0xf8: - if (p == NULL) - break; - memcpy (p->f1, &q, f1size); -@@ -669,6 +743,12 @@ fdasd_process_valid_vtoc (fdasd_anchor_t * anc, unsigned long b, int fd) - memcpy (anc->f7, &q, f1size); - f7_counter++; - break; -+ case 0xf9: -+ /* each format 8 lable has an associated -+ * format 9 lable, but they are of no further -+ * use to us. -+ */ -+ break; - } - - b += anc->blksize; -@@ -718,7 +798,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd) - { - PDEBUG - volume_label_t *v = anc->vlabel; -- unsigned long b = -1; -+ long long b = -1; - char str[LINE_LENGTH]; - - memset(v, 0, sizeof(volume_label_t)); -@@ -784,6 +864,7 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) - PDEBUG - int blksize = 0; - dasd_information_t dasd_info; -+ struct dasd_eckd_characteristics *characteristics; - - /* We can't get geometry from a regular file, - so simulate something usable, for the sake of testing. */ -@@ -803,6 +884,8 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) - dasd_info.devno = 513; - dasd_info.label_block = 2; - dasd_info.FBA_layout = 0; -+ anc->hw_cylinders = ((st.st_size / blksize) / anc->geo.sectors) / -+ anc->geo.heads; - } else { - if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) - fdasd_error(anc, unable_to_ioctl, -@@ -816,13 +899,20 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) - if (ioctl(f, BIODASDINFO, &dasd_info) != 0) - fdasd_error(anc, unable_to_ioctl, - _("Could not retrieve disk information.")); -+ -+ characteristics = (struct dasd_eckd_characteristics *) -+ &dasd_info.characteristics; -+ if (characteristics->no_cyl == LV_COMPAT_CYL && -+ characteristics->long_no_cyl) -+ anc->hw_cylinders = characteristics->long_no_cyl; -+ else -+ anc->hw_cylinders = characteristics->no_cyl; - } - - anc->dev_type = dasd_info.dev_type; - anc->blksize = blksize; - anc->label_pos = dasd_info.label_block * blksize; - anc->devno = dasd_info.devno; -- anc->fspace_trk = anc->geo.cylinders * anc->geo.heads - FIRST_USABLE_TRK; - anc->label_block = dasd_info.label_block; - anc->FBA_layout = dasd_info.FBA_layout; - } -@@ -850,20 +940,17 @@ fdasd_get_partition_data (fdasd_anchor_t *anc, extent_t *part_extent, - unsigned int *stop_ptr) - { - PDEBUG -- unsigned int limit, cc, hh; -+ unsigned int limit; -+ u_int32_t cc, c; -+ u_int16_t hh, h; - cchh_t llimit, ulimit; - partition_info_t *q; - u_int8_t b1, b2; -- u_int16_t c, h; - unsigned int start = *start_ptr, stop = *stop_ptr; - int i; - char *ch; - -- if (anc->f4->DS4DEVCT.DS4DEVFG & ALTERNATE_CYLINDERS_USED) -- c = anc->f4->DS4DEVCT.DS4DSCYL - (u_int16_t) anc->f4->DS4DEVAC; -- else -- c = anc->f4->DS4DEVCT.DS4DSCYL; -- -+ c = get_usable_cylinders(anc); - h = anc->f4->DS4DEVCT.DS4DSTRK; - limit = (h * c - 1); - -@@ -1019,7 +1106,6 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, - cchhb_t hf1; - partition_info_t *p; - extent_t ext; -- int i; - - PDEBUG; - -@@ -1032,8 +1118,14 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, - if (fdasd_get_partition_data(anc, &ext, p, &start, &stop) != 0) - return 0; - -- PDEBUG; -- vtoc_init_format1_label(anc->vlabel->volid, anc->blksize, &ext, p->f1); -+ if (anc->formatted_cylinders > LV_COMPAT_CYL) { -+ vtoc_init_format8_label(anc->vlabel->volid, anc->blksize, &ext, -+ p->f1); -+ } else { -+ PDEBUG; -+ vtoc_init_format1_label(anc->vlabel->volid, anc->blksize, &ext, -+ p->f1); -+ } - - PDEBUG; - fdasd_enqueue_new_partition(anc); -@@ -1041,23 +1133,17 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, - PDEBUG; - anc->used_partitions += 1; - -- i = anc->used_partitions + 2; -- if (anc->big_disk) -- i++; -- PDEBUG; -- -- vtoc_set_cchhb(&hf1, VTOC_START_CC, VTOC_START_HH, i); -- -+ get_addr_of_highest_f1_f8_label(anc, &hf1); - vtoc_update_format4_label(anc->f4, &hf1, anc->f4->DS4DSREC - 1); - - PDEBUG; - -- start = ext.llimit.cc * anc->geo.heads + ext.llimit.hh; -- stop = ext.ulimit.cc * anc->geo.heads + ext.ulimit.hh; -+ start = cchh2trk(&ext.llimit, &anc->geo); -+ stop = cchh2trk(&ext.ulimit, &anc->geo); - - PDEBUG; - vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '-', anc->verbose, -- start, stop, anc->geo.cylinders, anc->geo.heads); -+ start, stop, anc->formatted_cylinders, anc->geo.heads); - - anc->vtoc_changed++; - -diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c -index cf2990e..fdfa94f 100644 ---- a/libparted/labels/vtoc.c -+++ b/libparted/labels/vtoc.c -@@ -218,11 +218,32 @@ vtoc_set_extent (extent_t *ext, u_int8_t typeind, u_int8_t seqno, - } - - void --vtoc_set_cchh (cchh_t *addr, u_int16_t cc, u_int16_t hh) -+vtoc_set_cchh (cchh_t *addr, u_int32_t cc, u_int16_t hh) - { - PDEBUG -- addr->cc = cc; -- addr->hh = hh; -+ addr->cc = (u_int16_t) cc; -+ addr->hh = cc >> 16; -+ addr->hh <<= 4; -+ addr->hh |= hh; -+} -+ -+u_int32_t -+vtoc_get_cyl_from_cchh (cchh_t *addr) -+{ -+ u_int32_t cyl; -+ -+ /*decode cylinder for large volumes */ -+ cyl = addr->hh & 0xFFF0; -+ cyl <<= 12; -+ cyl |= addr->cc; -+ return cyl; -+} -+ -+u_int16_t -+vtoc_get_head_from_cchh (cchh_t *addr) -+{ -+ /* decode heads for large volumes */ -+ return addr->hh & 0x000F; - } - - static void -@@ -234,12 +255,63 @@ vtoc_set_ttr (ttr_t *addr, u_int16_t tt, u_int8_t r) - } - - void --vtoc_set_cchhb (cchhb_t *addr, u_int16_t cc, u_int16_t hh, u_int8_t b) -+vtoc_set_cchhb (cchhb_t *addr, u_int32_t cc, u_int16_t hh, u_int8_t b) - { - PDEBUG -- addr->cc = cc; -- addr->hh = hh; -- addr->b = b; -+ addr->cc = (u_int16_t) cc; -+ addr->hh = cc >> 16; -+ addr->hh <<= 4; -+ addr->hh |= hh; -+ addr->b = b; -+} -+ -+u_int32_t -+vtoc_get_cyl_from_cchhb(cchhb_t *addr) -+{ -+ u_int32_t cyl; -+ -+ /* decode cylinder for large volumes */ -+ cyl = addr->hh & 0xFFF0; -+ cyl <<= 12; -+ cyl |= addr->cc; -+ return cyl; -+} -+ -+u_int16_t -+vtoc_get_head_from_cchhb(cchhb_t *addr) -+{ -+ /* decode heads for large volumes */ -+ return addr->hh & 0x000F; -+} -+ -+/* -+ * some functions to convert cyl-cyl-head-head addresses to -+ * block or track numbers -+ * Note: Record zero is special, so first block on a track is -+ * in record 1! -+ */ -+u_int64_t -+cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo) -+{ -+ return (u_int64_t) vtoc_get_cyl_from_cchhb(p) * -+ geo->heads * geo->sectors + -+ vtoc_get_head_from_cchhb(p) * geo->sectors + -+ p->b; -+} -+ -+u_int64_t -+cchh2blk (cchh_t *p, struct fdasd_hd_geometry *geo) -+{ -+ return (u_int64_t) vtoc_get_cyl_from_cchh(p) * -+ geo->heads * geo->sectors + -+ vtoc_get_head_from_cchh(p) * geo->sectors; -+} -+ -+u_int32_t -+cchh2trk (cchh_t *p, struct fdasd_hd_geometry *geo) -+{ -+ return vtoc_get_cyl_from_cchh(p) * geo->heads + -+ vtoc_get_head_from_cchh(p); - } - - void -@@ -506,7 +578,8 @@ vtoc_write_label (int f, unsigned long position, - format1_label_t const *f1, - format4_label_t const *f4, - format5_label_t const *f5, -- format7_label_t const *f7) -+ format7_label_t const *f7, -+ format9_label_t const *f9) - { - PDEBUG - int t; -@@ -542,6 +615,17 @@ vtoc_write_label (int f, unsigned long position, - vtoc_error(unable_to_write, "vtoc_write_label", - _("Could not write VTOC FMT7 DSCB.")); - } -+ -+ if (f9 != NULL) -+ { -+ t = sizeof(format9_label_t); -+ if (write(f, f9, t) != t) -+ { -+ close(f); -+ vtoc_error(unable_to_write, "vtoc_write_label", -+ _("Could not write VTOC FMT9 DSCB.")); -+ } -+ } - } - - /* -@@ -549,7 +633,8 @@ vtoc_write_label (int f, unsigned long position, - */ - void - vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions, -- unsigned int cylinders, unsigned int tracks, -+ unsigned int compat_cylinders, -+ unsigned int real_cylinders, unsigned int tracks, - unsigned int blocks, unsigned int blksize, - u_int16_t dev_type) - { -@@ -574,7 +659,7 @@ vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions, - f4->DS4DEVAC = 0x00; - - /* -- begin f4->DS4DEVCT -- */ -- f4->DS4DEVCT.DS4DSCYL = cylinders; -+ f4->DS4DEVCT.DS4DSCYL = compat_cylinders; - f4->DS4DEVCT.DS4DSTRK = tracks; - - switch (dev_type) { -@@ -613,7 +698,11 @@ vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions, - bzero(f4->res2, sizeof(f4->res2)); - f4->DS4EFLVL = 0x00; - bzero(&f4->DS4EFPTR, sizeof(f4->DS4EFPTR)); -- bzero(f4->res3, sizeof(f4->res3)); -+ bzero(&f4->res3, sizeof(f4->res3)); -+ f4->DS4DCYL = real_cylinders; -+ bzero(f4->res4, sizeof(f4->res4)); -+ f4->DS4DEVF2 = 0x40; /* allow format 8 and 9 labels */ -+ bzero(&f4->res5, sizeof(f4->res5)); - } - - /* -@@ -647,11 +736,12 @@ vtoc_init_format7_label (format7_label_t *f7) - } - - /* -- * initializes a format1 label -+ * helper function that initializes a most parts of a -+ * format1 or format 8 label, all but the field DS1FMTID - */ - void --vtoc_init_format1_label (char *volid, unsigned int blksize, -- extent_t *part_extent, format1_label_t *f1) -+vtoc_init_format_1_8_label (char *volid, unsigned int blksize, -+ extent_t *part_extent, format1_label_t *f1) - { - PDEBUG - struct tm * creatime; -@@ -666,7 +756,6 @@ vtoc_init_format1_label (char *volid, unsigned int blksize, - sprintf(str, "PART .NEW "); - vtoc_ebcdic_enc(str, str, 44); - strncpy(f1->DS1DSNAM, str, 44); -- f1->DS1FMTID = 0xf1; - strncpy(f1->DS1DSSN, " ", 6); - f1->DS1VOLSQ = 0x0001; - -@@ -704,6 +793,37 @@ vtoc_init_format1_label (char *volid, unsigned int blksize, - vtoc_set_cchhb(&f1->DS1PTRDS, 0x0000, 0x0000, 0x00); - } - -+void -+vtoc_init_format1_label (char *volid, unsigned int blksize, -+ extent_t *part_extent, format1_label_t *f1) -+{ -+ vtoc_init_format_1_8_label(volid, blksize, part_extent, f1); -+ f1->DS1FMTID = 0xf1; -+} -+ -+void -+vtoc_init_format8_label (char *volid, unsigned int blksize, -+ extent_t *part_extent, format1_label_t *f8) -+{ -+ vtoc_init_format_1_8_label(volid, blksize, part_extent, f8); -+ f8->DS1FMTID = 0xf8; -+} -+ -+void -+vtoc_update_format8_label (cchhb_t *associated_f9, format1_label_t *f8) -+{ -+ memcpy(&f8->DS1PTRDS, associated_f9, sizeof(*associated_f9)); -+} -+ -+void -+vtoc_init_format9_label (format9_label_t *f9) -+{ -+ f9->DS9KEYID = 0x09; -+ f9->DS9SUBTY = 0x01; -+ f9->DS9NUMF9 = 1; -+ f9->DS9FMTID = 0xf9; -+} -+ - /* - * do some updates to the VTOC format4 label - */ -@@ -1060,7 +1180,7 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose, - if ((ext->a + ext->b) == 0x00000000) - continue; - -- if ((ext->b + 1) == tmp->a) { -+ if (ext->b == tmp->a) { - /* this extent precedes the new one */ - ext->b = tmp->b; - bzero(tmp, sizeof(ds7ext_t)); -@@ -1074,7 +1194,7 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose, - continue; - } - -- if (ext->a == (tmp->b + 1)) { -+ if (ext->a == tmp->b) { - /* this extent succeeds the new one */ - ext->a = tmp->a; - bzero(tmp, sizeof(ds7ext_t)); -@@ -1119,7 +1239,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, - - if ((a == ext->a) && (b < ext->b)) { - /* left-bounded in free space gap */ -- ext->a = b + 1; -+ ext->a = b; - - if (verbose) - puts ("FMT7 add extent: left-bounded"); -@@ -1130,7 +1250,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, - - if ((a > ext->a) && (b == ext->b)) { - /* right-bounded in free space gap */ -- ext->b = a - 1; -+ ext->b = a; - - if (verbose) - puts ("FMT7 add extent: right-bounded"); -@@ -1141,8 +1261,8 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, - - if ((a > ext->a) && (b < ext->b)) { - /* partition devides free space into 2 pieces */ -- vtoc_update_format7_label_add(f7, verbose, b+1, ext->b); -- ext->b = a - 1; -+ vtoc_update_format7_label_add(f7, verbose, b, ext->b); -+ ext->b = a; - - if (verbose) - puts ("FMT7 add extent: 2 pieces"); -@@ -1172,14 +1292,19 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, - void - vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5, - format7_label_t *f7, char ch, int verbose, -- u_int32_t start, u_int32_t stop, int cyl, int trk) -+ u_int32_t start, u_int32_t stop, u_int32_t cyl, -+ u_int32_t trk) - { - PDEBUG - if ((cyl * trk) > BIG_DISK_SIZE) { - if (ch == '+') -- vtoc_update_format7_label_add(f7, verbose, start, stop); -+ vtoc_update_format7_label_add(f7, verbose, start, -+ /* ds7ext RTA + 1 */ -+ stop + 1); - else if (ch == '-') -- vtoc_update_format7_label_del(f7, verbose, start, stop); -+ vtoc_update_format7_label_del(f7, verbose, start, -+ /* ds7ext RTA + 1 */ -+ stop + 1); - else - puts ("BUG: syntax error in vtoc_set_freespace call"); - --- -1.8.4.5 - diff --git a/libparted-add-support-for-implicit-FBA-DASD-partition.patch b/libparted-add-support-for-implicit-FBA-DASD-partition.patch deleted file mode 100644 index 91cd8ea..0000000 --- a/libparted-add-support-for-implicit-FBA-DASD-partition.patch +++ /dev/null @@ -1,193 +0,0 @@ -From f70ff1fc474764c3a71318ddb4e0d26afc52ac47 Mon Sep 17 00:00:00 2001 -From: Nageswara R Sastry -Date: Wed, 21 Aug 2013 16:09:56 -0700 -Subject: [PATCH] libparted: add support for implicit FBA DASD partitions - -Fixed Block Access (FBA) DASDs are mainframe-specific disk devices -which are layed out as a sequence of 512-byte sectors. In contrast -to ECKD DASDs, these disks do not require formatting and resemble -the LBA layout of non-mainframe disks. Despite this resemblance, -the Linux kernel applies special handling during partition detection -for FBA DASDs, resulting in a single, immutable partition being -reported. - -While actual FBA DASD hardware is no longer available, the z/VM -hypervisor can simulate FBA DASD disks, backed by either ECKD or -SCSI devices. - -This patch adds support for recognizing FBA DASD partitions -to parted. - -Signed-off-by: Nageswara R Sastry -Signed-off-by: Peter Oberparleiter ---- - include/parted/fdasd.in.h | 2 + - libparted/labels/dasd.c | 63 +++++++++++++++++++++++++++++++++++++++------- - libparted/labels/fdasd.c | 5 +++ - 3 files changed, 61 insertions(+), 9 deletions(-) - -Index: parted-3.1/include/parted/fdasd.in.h -=================================================================== ---- parted-3.1.orig/include/parted/fdasd.in.h -+++ parted-3.1/include/parted/fdasd.in.h -@@ -194,6 +194,8 @@ typedef struct fdasd_anchor { - volume_label_t *vlabel; - config_data_t confdata[USABLE_PARTITIONS]; - struct fdasd_hd_geometry geo; -+ unsigned int label_block; -+ unsigned int FBA_layout; - } fdasd_anchor_t; - - enum offset {lower, upper}; -Index: parted-3.1/libparted/labels/dasd.c -=================================================================== ---- parted-3.1.orig/libparted/labels/dasd.c -+++ parted-3.1/libparted/labels/dasd.c -@@ -71,6 +71,7 @@ typedef struct { - - typedef struct { - unsigned int format_type; -+ unsigned int label_block; - volume_label_t vlabel; - } DasdDiskSpecific; - -@@ -151,6 +152,7 @@ dasd_alloc (const PedDevice* dev) - - /* CDL format, newer */ - disk_specific->format_type = 2; -+ disk_specific->label_block = 2; - - /* Setup volume label (for fresh disks) */ - snprintf(volser, sizeof(volser), "0X%04X", arch_specific->devno); -@@ -226,7 +228,9 @@ dasd_probe (const PedDevice *dev) - - fdasd_check_api_version(&anchor, arch_specific->fd); - -- if (fdasd_check_volume(&anchor, arch_specific->fd)) -+ /* Labels are required on CDL formatted DASDs. */ -+ if (fdasd_check_volume(&anchor, arch_specific->fd) && -+ anchor.FBA_layout == 0) - goto error_cleanup; - - fdasd_cleanup(&anchor); -@@ -273,17 +277,53 @@ dasd_read (PedDisk* disk) - fdasd_initialize_anchor(&anchor); - - fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd); -+ disk_specific->label_block = anchor.label_block; -+ -+ if ((anchor.geo.cylinders * anchor.geo.heads) > BIG_DISK_SIZE) -+ anchor.big_disk++; - - /* check dasd for labels and vtoc */ -- if (fdasd_check_volume(&anchor, arch_specific->fd)) -- goto error_close_dev; -+ if (fdasd_check_volume(&anchor, arch_specific->fd)) { -+ DasdPartitionData* dasd_data; -+ -+ /* Kernel partitioning code will report 'implicit' partitions -+ * for non-CDL format DASDs even when there is no -+ * label/VTOC. */ -+ if (anchor.FBA_layout == 0) -+ goto error_close_dev; -+ -+ disk_specific->format_type = 1; -+ -+ /* Register implicit partition */ -+ ped_disk_delete_all (disk); -+ -+ start = (PedSector) arch_specific->real_sector_size / -+ (PedSector) disk->dev->sector_size * -+ (PedSector) (anchor.label_block + 1); -+ end = disk->dev->length - 1; -+ part = ped_partition_new (disk, PED_PARTITION_NORMAL, NULL, -+ start, end); -+ if (!part) -+ goto error_close_dev; -+ -+ part->num = 1; -+ part->fs_type = ped_file_system_probe (&part->geom); -+ dasd_data = part->disk_specific; -+ dasd_data->raid = 0; -+ dasd_data->lvm = 0; -+ dasd_data->type = 0; -+ -+ if (!ped_disk_add_partition (disk, part, NULL)) -+ goto error_close_dev; -+ -+ fdasd_cleanup(&anchor); -+ -+ return 1; -+ } - - /* Save volume label (read by fdasd_check_volume) for writing */ - memcpy(&disk_specific->vlabel, anchor.vlabel, sizeof(volume_label_t)); - -- if ((anchor.geo.cylinders * anchor.geo.heads) > BIG_DISK_SIZE) -- anchor.big_disk++; -- - ped_disk_delete_all (disk); - - bool is_ldl = strncmp(anchor.vlabel->volkey, -@@ -348,7 +388,7 @@ dasd_read (PedDisk* disk) - / (long long) disk->dev->sector_size - * (long long) (cms_ptr->block_count - 1) - 1; - -- part = ped_partition_new (disk, PED_PARTITION_PROTECTED, NULL, start, end); -+ part = ped_partition_new (disk, PED_PARTITION_NORMAL, NULL, start, end); - if (!part) - goto error_close_dev; - -@@ -926,7 +966,12 @@ dasd_alloc_metadata (PedDisk* disk) - the start of the first partition */ - if (disk_specific->format_type == 1) { - part = ped_disk_get_partition(disk, 1); -- vtoc_end = part->geom.start - 1; -+ if (part) -+ vtoc_end = part->geom.start - 1; -+ else -+ vtoc_end = (PedSector) arch_specific->real_sector_size / -+ (PedSector) disk->dev->sector_size * -+ (PedSector) disk_specific->label_block; - } - else { - if (disk->dev->type == PED_DEVICE_FILE) -@@ -946,7 +991,7 @@ dasd_alloc_metadata (PedDisk* disk) - goto error; - } - -- if (disk_specific->format_type == 1) { -+ if (disk_specific->format_type == 1 && part) { - /* - For LDL or CMS there may be trailing metadata as well. - For example: the last block of a CMS reserved file, -Index: parted-3.1/libparted/labels/fdasd.c -=================================================================== ---- parted-3.1.orig/libparted/labels/fdasd.c -+++ parted-3.1/libparted/labels/fdasd.c -@@ -721,6 +721,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, - unsigned long b = -1; - char str[LINE_LENGTH]; - -+ memset(v, 0, sizeof(volume_label_t)); - vtoc_read_volume_label (fd, anc->label_pos, v); - - if (strncmp(v->vollbl, vtoc_ebcdic_enc ("VOL1", str, 4), 4) == 0) { -@@ -800,6 +801,8 @@ fdasd_get_geometry (const PedDevice *dev - dasd_info.dev_type = 13200; - dasd_info.label_block = 2; - dasd_info.devno = 513; -+ dasd_info.label_block = 2; -+ dasd_info.FBA_layout = 0; - } else { - if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) - fdasd_error(anc, unable_to_ioctl, -@@ -820,6 +823,8 @@ fdasd_get_geometry (const PedDevice *dev - anc->label_pos = dasd_info.label_block * blksize; - anc->devno = dasd_info.devno; - anc->fspace_trk = anc->geo.cylinders * anc->geo.heads - FIRST_USABLE_TRK; -+ anc->label_block = dasd_info.label_block; -+ anc->FBA_layout = dasd_info.FBA_layout; - } - - /* diff --git a/libparted-avoid-libdevice-mapper-warnings.patch b/libparted-avoid-libdevice-mapper-warnings.patch new file mode 100644 index 0000000..9152b89 --- /dev/null +++ b/libparted-avoid-libdevice-mapper-warnings.patch @@ -0,0 +1,21 @@ +--- + libparted/arch/linux.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +Index: parted-3.2/libparted/arch/linux.c +=================================================================== +--- parted-3.2.orig/libparted/arch/linux.c ++++ parted-3.2/libparted/arch/linux.c +@@ -2728,6 +2728,12 @@ _dm_remove_partition(PedDisk* disk, int + goto err; + } + close (fd); ++ /* After we closed the fd, udev starts sniffing it, rendering the device busy for a moment ++ * This is not fatal since we're going to retry anyway, but produces bogus warnings ++ * from libdevice-mapper. ++ * Avoid this by giving udev a moment to release the device ++ */ ++ usleep(100000); + struct dm_task *task = dm_task_create(DM_DEVICE_REMOVE); + if (!task) + goto err; diff --git a/libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch b/libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch deleted file mode 100644 index e04b773..0000000 --- a/libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch +++ /dev/null @@ -1,22 +0,0 @@ -From c261a9b340e2982a49e055ea6332fd0f49f3d531 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Wed, 11 Sep 2013 12:24:51 -0700 -Subject: [PATCH] libparted: copy pmbr_boot when duplicating GPT disk - -* libparted/labels/gpt.c (gpt_duplicate): copy pmbr_boot flag ---- - libparted/labels/gpt.c | 1 + - 1 file changed, 1 insertion(+) - -Index: parted-3.1/libparted/labels/gpt.c -=================================================================== ---- parted-3.1.orig/libparted/labels/gpt.c -+++ parted-3.1/libparted/labels/gpt.c -@@ -660,6 +660,7 @@ gpt_duplicate (const PedDisk *disk) - old_disk_data->data_area.length); - new_disk_data->entry_count = old_disk_data->entry_count; - new_disk_data->uuid = old_disk_data->uuid; -+ new_disk_data->pmbr_boot = old_disk_data->pmbr_boot; - return new_disk; - } - diff --git a/libparted-dasd-do-not-use-first-tracks.patch b/libparted-dasd-do-not-use-first-tracks.patch index 9ab13ad..fb9ab4c 100644 --- a/libparted-dasd-do-not-use-first-tracks.patch +++ b/libparted-dasd-do-not-use-first-tracks.patch @@ -2,11 +2,11 @@ libparted/labels/dasd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -Index: parted-3.1/libparted/labels/dasd.c +Index: parted-3.2/libparted/labels/dasd.c =================================================================== ---- parted-3.1.orig/libparted/labels/dasd.c -+++ parted-3.1/libparted/labels/dasd.c -@@ -803,7 +803,8 @@ _primary_constraint (PedDisk* disk) +--- parted-3.2.orig/libparted/labels/dasd.c ++++ parted-3.2/libparted/labels/dasd.c +@@ -844,7 +844,8 @@ _primary_constraint (PedDisk* disk) if (!ped_alignment_init (&end_align, -1, disk->dev->hw_geom.sectors * sector_size)) return NULL; diff --git a/libparted-device-mapper-uses-512b-sectors.patch b/libparted-device-mapper-uses-512b-sectors.patch new file mode 100644 index 0000000..30e5bef --- /dev/null +++ b/libparted-device-mapper-uses-512b-sectors.patch @@ -0,0 +1,90 @@ +From f98f791e19669b900345dad7d96ea4df974e4596 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 4 Feb 2015 16:46:07 -0800 +Subject: [PATCH] libparted: device mapper uses 512b sectors + +device mapper doesn't use the device's sector size when creating a +table. It always uses 512b units. This causes partitions to be created +8x smaller than expected on devices with 4906b sectors. +--- + NEWS | 4 ++++ + libparted/arch/linux.c | 21 +++++++++++++++++---- + 2 files changed, 21 insertions(+), 4 deletions(-) + +Index: parted-3.2/NEWS +=================================================================== +--- parted-3.2.orig/NEWS ++++ parted-3.2/NEWS +@@ -162,6 +162,10 @@ GNU parted NEWS + + ** Bug Fixes + ++ Use 512b sector size when communicating with device-mapper. Fixes ++ problems with partitions being created too small on dm devices ++ with sector sizes > 5121b ++ + Don't crash in the disk_set command when a disk label is not found + + libparted-fs-resize: Prevent crash resizing FAT16 file systems. +Index: parted-3.2/libparted/arch/linux.c +=================================================================== +--- parted-3.2.orig/libparted/arch/linux.c ++++ parted-3.2/libparted/arch/linux.c +@@ -2768,6 +2768,12 @@ _dm_get_partition_start_and_length(PedPa + if (sscanf (params, "%d:%d %Ld", &major, &minor, start) != 3) + goto err; + rc = 1; ++ ++ /* device-mapper uses 512b units, make sure we return length and start in terms of the device's ++ * sector size. ++ */ ++ *start /= (part->disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT); ++ *length /= (part->disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT); + err: + free (path); + dm_task_destroy(task); +@@ -2815,8 +2821,10 @@ _dm_add_partition (PedDisk* disk, const + /* Caution: dm_task_destroy frees dev_name. */ + dm_task_destroy (task); + task = NULL; ++ /* device-mapper uses 512b units, not the device's sector size */ + if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major, +- arch_specific->minor, part->geom.start))) ++ arch_specific->minor, ++ part->geom.start * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT)))) + goto err; + + task = dm_task_create (DM_DEVICE_CREATE); +@@ -2826,7 +2834,8 @@ _dm_add_partition (PedDisk* disk, const + dm_task_set_name (task, vol_name); + if (vol_uuid) + dm_task_set_uuid (task, vol_uuid); +- dm_task_add_target (task, 0, part->geom.length, ++ /* device-mapper uses 512b units, not the device's sector size */ ++ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT), + "linear", params); + if (!dm_task_set_cookie (task, &cookie, 0)) + goto err; +@@ -2883,8 +2892,11 @@ _dm_resize_partition (PedDisk* disk, con + /* Caution: dm_task_destroy frees dev_name. */ + dm_task_destroy (task); + task = NULL; ++ ++ /* device-mapper uses 512b units, not the device's sector size */ + if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major, +- arch_specific->minor, part->geom.start))) ++ arch_specific->minor, ++ part->geom.start * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT)))) + goto err; + + task = dm_task_create (DM_DEVICE_RELOAD); +@@ -2892,7 +2904,8 @@ _dm_resize_partition (PedDisk* disk, con + goto err; + + dm_task_set_name (task, vol_name); +- dm_task_add_target (task, 0, part->geom.length, ++ /* device-mapper uses 512b units, not the device's sector size */ ++ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT), + "linear", params); + if (!dm_task_set_cookie (task, &cookie, 0)) + goto err; diff --git a/libparted-fix-mmcblk-partition-name.patch b/libparted-fix-mmcblk-partition-name.patch deleted file mode 100644 index e0a11aa..0000000 --- a/libparted-fix-mmcblk-partition-name.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- - libparted/arch/linux.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -Index: parted-3.1/libparted/arch/linux.c -=================================================================== ---- 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; -- if (dev->type == PED_DEVICE_CPQARRAY) -+ if (dev->type == PED_DEVICE_CPQARRAY || -+ dev->type == PED_DEVICE_SDMMC) - p = "p"; - else - p = (dev->type == PED_DEVICE_DAC960 diff --git a/libparted-initialize-dasd-part-type.patch b/libparted-initialize-dasd-part-type.patch deleted file mode 100644 index 210ee20..0000000 --- a/libparted-initialize-dasd-part-type.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- - libparted/labels/dasd.c | 2 ++ - 1 file changed, 2 insertions(+) - -Index: parted-3.1/libparted/labels/dasd.c -=================================================================== ---- parted-3.1.orig/libparted/labels/dasd.c -+++ parted-3.1/libparted/labels/dasd.c -@@ -659,6 +659,8 @@ dasd_partition_new (const PedDisk* disk, - goto error; - - part->disk_specific = ped_malloc (sizeof (DasdPartitionData)); -+ if (part->disk_specific) -+ memset(part->disk_specific, 0, sizeof(DasdPartitionData)); - return part; - - error: diff --git a/libparted-make-sure-not-to-treat-percentages-and-cyls-as-exact.patch b/libparted-make-sure-not-to-treat-percentages-and-cyls-as-exact.patch index 406393d..023ba11 100644 --- a/libparted-make-sure-not-to-treat-percentages-and-cyls-as-exact.patch +++ b/libparted-make-sure-not-to-treat-percentages-and-cyls-as-exact.patch @@ -14,15 +14,15 @@ Also avoid this logic when the unit is specified as cylinders. libparted/unit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -Index: parted-3.1/libparted/unit.c +Index: parted-3.2/libparted/unit.c =================================================================== ---- parted-3.1.orig/libparted/unit.c -+++ parted-3.1/libparted/unit.c +--- parted-3.2.orig/libparted/unit.c ++++ parted-3.2/libparted/unit.c @@ -551,7 +551,9 @@ ped_unit_parse_custom (const char* str, do not use 4MiB as the range. Rather, presume that they are specifying precisely the starting or ending number, and treat "4MiB" just as we would treat "4194304B". */ -- if (is_power_of_2 (unit_size)) +- if (is_power_of_2 (unit_size) && unit != PED_UNIT_PERCENT) + if (is_power_of_2 (unit_size) && + unit != PED_UNIT_PERCENT && + unit != PED_UNIT_CYLINDER) diff --git a/libparted-mklabel-to-support-EAV-DASD.patch b/libparted-mklabel-to-support-EAV-DASD.patch deleted file mode 100644 index 9668d19..0000000 --- a/libparted-mklabel-to-support-EAV-DASD.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 95649fc7d025a68074c8a00581bd24d2bd7751bc Mon Sep 17 00:00:00 2001 -From: Nageswara R Sastry -Date: Wed, 21 Aug 2013 16:36:08 -0700 -Subject: [PATCH] libparted: mklabel to support EAV DASD - -Extended Address Volume (EAV) DASDs are ECKD DASDs with more than -65520 cylinders. This patch adds support for mklabel to properly -handle unformatted EAV DASDs. - -Signed-off-by: Nageswara R Sastry ---- - include/parted/fdasd.in.h | 1 - - libparted/labels/fdasd.c | 92 +++++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 90 insertions(+), 3 deletions(-) - -diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h -index b4e7dd1..3692596 100644 ---- a/include/parted/fdasd.in.h -+++ b/include/parted/fdasd.in.h -@@ -288,7 +288,6 @@ void fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int fd); - void fdasd_check_api_version (fdasd_anchor_t *anc, int fd); - int fdasd_check_volume (fdasd_anchor_t *anc, int fd); - int fdasd_write_labels (fdasd_anchor_t *anc, int fd); --int fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc); - void fdasd_recreate_vtoc(fdasd_anchor_t *anc); - partition_info_t * fdasd_add_partition (fdasd_anchor_t *anc, - unsigned int start, unsigned int stop); -diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c -index 2735b2a..b58b2be 100644 ---- a/libparted/labels/fdasd.c -+++ b/libparted/labels/fdasd.c -@@ -581,6 +581,22 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) - anc->vtoc_changed++; - } - -+ /* -+ * initialize the VOL1 volume label -+ */ -+static void -+fdasd_init_volume_label(fdasd_anchor_t *anc, int fd) -+{ -+ volume_label_t *vlabel = anc->vlabel; -+ -+ vtoc_volume_label_init(vlabel); -+ vtoc_volume_label_set_key(vlabel, "VOL1"); -+ vtoc_volume_label_set_label(vlabel, "VOL1"); -+ -+ vtoc_set_cchhb(&vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01); -+} -+ -+ - /* - * sets some important partition data - * (like used, start_trk, end_trk, len_trk) -@@ -769,6 +785,52 @@ fdasd_process_valid_vtoc (fdasd_anchor_t * anc, unsigned long b, int fd) - fdasd_update_partition_info (anc); - } - -+static void -+fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc) -+{ -+ PDEBUG -+ anc->formatted_cylinders = anc->hw_cylinders; -+ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads -+ - FIRST_USABLE_TRK; -+ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, -+ anc->geo.cylinders, anc->formatted_cylinders, -+ anc->geo.heads, anc->geo.sectors, -+ anc->blksize, anc->dev_type); -+ -+ vtoc_init_format5_label(anc->f5); -+ vtoc_init_format7_label(anc->f7); -+ -+ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose, -+ FIRST_USABLE_TRK, -+ anc->formatted_cylinders * anc->geo.heads - 1, -+ anc->formatted_cylinders, anc->geo.heads); -+ -+ vtoc_set_cchhb(&anc->vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01); -+} -+ -+/* -+ * we have a invalid FMT4 DSCB and therefore we will re-create the VTOC -+ */ -+static void -+fdasd_process_invalid_vtoc(fdasd_anchor_t *anc) -+{ -+ anc->formatted_cylinders = anc->hw_cylinders; -+ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads -+ - FIRST_USABLE_TRK; -+ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, -+ anc->geo.cylinders, anc->formatted_cylinders, -+ anc->geo.heads, anc->geo.sectors, -+ anc->blksize, anc->dev_type); -+ -+ vtoc_init_format5_label(anc->f5); -+ vtoc_init_format7_label(anc->f7); -+ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose, -+ FIRST_USABLE_TRK, -+ anc->formatted_cylinders * anc->geo.heads - 1, -+ anc->formatted_cylinders, anc->geo.heads); -+} -+ -+ - static int - fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd) - { -@@ -781,6 +843,8 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd) - if (anc->f4->DS4IDFMT == 0xf4) { - fdasd_process_valid_vtoc (anc, b, fd); - return 0; -+ } else { -+ fdasd_process_invalid_vtoc(anc); - } - if (strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("LNX1",str,4),4) == 0 || - strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("CMS1",str,4),4) == 0) -@@ -817,13 +881,37 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd) - else - return 0; - } else { -- return 1; -+ fdasd_invalid_vtoc_pointer(anc); - } - } else if (strncmp (v->volkey, vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0 || - strncmp (v->volkey, vtoc_ebcdic_enc ("CMS1", str, 4), 4) == 0) { - return 0; -- } -+ } else if (anc->FBA_layout == 1) { -+ /* Some times LDL formatted disks does not -+ contain any volume label */ -+ return 1; -+ } else { -+ /* didn't find VOL1 volume label */ -+ anc->formatted_cylinders = anc->hw_cylinders; -+ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads -+ - FIRST_USABLE_TRK; -+ -+ fdasd_init_volume_label(anc, fd); - -+ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, -+ anc->geo.cylinders, anc->formatted_cylinders, -+ anc->geo.heads, anc->geo.sectors, -+ anc->blksize, anc->dev_type); -+ -+ vtoc_init_format5_label(anc->f5); -+ vtoc_init_format7_label(anc->f7); -+ -+ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', -+ anc->verbose, FIRST_USABLE_TRK, -+ anc->formatted_cylinders * anc->geo.heads - 1, -+ anc->formatted_cylinders, anc->geo.heads); -+ return 0; -+ } - return 1; - } - --- -1.8.4.5 - diff --git a/libparted-mklabel-to-support-EDEV-DASD.patch b/libparted-mklabel-to-support-EDEV-DASD.patch deleted file mode 100644 index 1451aca..0000000 --- a/libparted-mklabel-to-support-EDEV-DASD.patch +++ /dev/null @@ -1,56 +0,0 @@ -From bdb439f660344404f27084c48fe7b9429436b9e9 Mon Sep 17 00:00:00 2001 -From: Nageswara R Sastry -Date: Wed, 21 Aug 2013 16:37:17 -0700 -Subject: [PATCH] libparted: mklabel to support EDEV DASD - -Fixed Block Access (FBA) DASDs are mainframe-specific disk devices -which are layed out as a sequence of 512-byte sectors. This patch adds -support for mklabel to properly handle FBA devices. - -Signed-off-by: Nageswara R Sastry ---- - libparted/labels/fdasd.c | 28 +++++++++++++++------------- - 1 file changed, 15 insertions(+), 13 deletions(-) - -diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c -index 7de5f34..1f87937 100644 ---- a/libparted/labels/fdasd.c -+++ b/libparted/labels/fdasd.c -@@ -870,19 +870,21 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd) - vtoc_read_volume_label (fd, anc->label_pos, v); - - if (strncmp(v->vollbl, vtoc_ebcdic_enc ("VOL1", str, 4), 4) == 0) { -- /* found VOL1 volume label */ -- b = (cchhb2blk (&v->vtoc, &anc->geo) - 1) * anc->blksize; -- -- if (b > 0) { -- int rc; -- rc = fdasd_valid_vtoc_pointer (anc, b, fd); -- -- if (rc < 0) -- return 1; -- else -- return 0; -- } else { -- fdasd_invalid_vtoc_pointer(anc); -+ if (anc->FBA_layout != 1 ) { -+ /* found VOL1 volume label */ -+ b = (cchhb2blk (&v->vtoc, &anc->geo) - 1) * anc->blksize; -+ -+ if (b > 0) { -+ int rc; -+ rc = fdasd_valid_vtoc_pointer (anc, b, fd); -+ -+ if (rc < 0) -+ return 1; -+ else -+ return 0; -+ } else { -+ fdasd_invalid_vtoc_pointer(anc); -+ } - } - } else if (strncmp (v->volkey, vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0 || - strncmp (v->volkey, vtoc_ebcdic_enc ("CMS1", str, 4), 4) == 0) { --- -1.8.4.5 - diff --git a/libparted-partition-naming.patch b/libparted-partition-naming.patch new file mode 100644 index 0000000..819dc26 --- /dev/null +++ b/libparted-partition-naming.patch @@ -0,0 +1,38 @@ +--- + libparted/arch/linux.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +Index: parted-3.2/libparted/arch/linux.c +=================================================================== +--- parted-3.2.orig/libparted/arch/linux.c ++++ parted-3.2/libparted/arch/linux.c +@@ -2342,11 +2342,17 @@ _device_get_part_path (PedDevice const * + result = zasprintf ("%.*s/part%d", + (int) (path_len - 5), devpath, num); + } else { +- char const *p = (dev->type == PED_DEVICE_DAC960 +- || dev->type == PED_DEVICE_CPQARRAY ++ const char *p; ++ if (dev->type == PED_DEVICE_CPQARRAY || ++ dev->type == PED_DEVICE_SDMMC) ++ p = "p"; ++ else if (dev->type == PED_DEVICE_DM) ++ p = "-part"; ++ else ++ p = (dev->type == PED_DEVICE_DAC960 + || dev->type == PED_DEVICE_ATARAID + || isdigit (devpath[path_len - 1]) +- ? "p" : ""); ++ ? "_part" : ""); + result = zasprintf ("%s%s%d", devpath, p, num); + } + if (dev->type == PED_DEVICE_DM) +@@ -2797,7 +2803,7 @@ _dm_add_partition (PedDisk* disk, const + size_t name_len = strlen (dev_name); + vol_name = zasprintf ("%s%s%d", + dev_name, +- isdigit (dev_name[name_len - 1]) ? "p" : "", ++ isdigit (dev_name[name_len - 1]) ? "-part" : "", + part->num); + if (vol_name == NULL) + goto err; diff --git a/libparted-ppc-prepboot-in-syncmbr.patch b/libparted-ppc-prepboot-in-syncmbr.patch index a0c5583..8dbad9b 100644 --- a/libparted-ppc-prepboot-in-syncmbr.patch +++ b/libparted-ppc-prepboot-in-syncmbr.patch @@ -2,11 +2,11 @@ libparted/labels/gpt.c | 3 +++ 1 file changed, 3 insertions(+) -Index: parted-3.1/libparted/labels/gpt.c +Index: parted-3.2/libparted/labels/gpt.c =================================================================== ---- parted-3.1.orig/libparted/labels/gpt.c -+++ parted-3.1/libparted/labels/gpt.c -@@ -1183,6 +1183,9 @@ _part_to_ostype (PedPartition* part) +--- parted-3.2.orig/libparted/labels/gpt.c ++++ parted-3.2/libparted/labels/gpt.c +@@ -1216,6 +1216,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; } diff --git a/libparted-use-BLKRRPART-for-DASD.patch.patch b/libparted-use-BLKRRPART-for-DASD.patch.patch index 142cd04..4cad8a5 100644 --- a/libparted-use-BLKRRPART-for-DASD.patch.patch +++ b/libparted-use-BLKRRPART-for-DASD.patch.patch @@ -12,12 +12,12 @@ and some fixups on top libparted/arch/linux.c | 50 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) -Index: parted-3.1/libparted/arch/linux.c +Index: parted-3.2/libparted/arch/linux.c =================================================================== ---- parted-3.1.orig/libparted/arch/linux.c -+++ parted-3.1/libparted/arch/linux.c -@@ -2898,6 +2898,34 @@ _dm_reread_part_table (PedDisk* disk) - #endif +--- parted-3.2.orig/libparted/arch/linux.c ++++ parted-3.2/libparted/arch/linux.c +@@ -3097,6 +3097,34 @@ _disk_sync_part_table (PedDisk* disk) + } static int +_kernel_reread_part_table (PedDevice* dev) @@ -51,9 +51,9 @@ Index: parted-3.1/libparted/arch/linux.c _have_blkpg () { static int have_blkpg = -1; -@@ -2919,15 +2947,19 @@ linux_disk_commit (PedDisk* disk) - return _dm_reread_part_table (disk); - #endif +@@ -3114,15 +3142,19 @@ static int + linux_disk_commit (PedDisk* disk) + { if (disk->dev->type != PED_DEVICE_FILE) { - - /* We now require BLKPG support. If this assertion fails, diff --git a/more-reliable-informing-the-kernel.patch b/more-reliable-informing-the-kernel.patch index 868ecf0..3d08fbf 100644 --- a/more-reliable-informing-the-kernel.patch +++ b/more-reliable-informing-the-kernel.patch @@ -7,42 +7,36 @@ # 1. increase the max sleep time if partition is busy from 1 to 2 seconds # 2. do not inform the kernel when only partition flags change - kernel # does not care about the flags -# 3. call 'udevadm settle' before doing BLKPG_DEL_PARTITION ioctl() --- - libparted/arch/linux.c | 4 +++- + libparted/arch/linux.c | 2 +- parted/parted.c | 28 +++++++++++++++++++++++++++- - 2 files changed, 30 insertions(+), 2 deletions(-) + 2 files changed, 28 insertions(+), 2 deletions(-) -Index: parted-3.1/libparted/arch/linux.c +Index: parted-3.2/libparted/arch/linux.c =================================================================== ---- 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; - -+ system("/sbin/udevadm settle --timeout=20"); -+ - /* Attempt to remove each and every partition, retrying for - up to max_sleep_seconds upon any failure due to EBUSY. */ - unsigned int sleep_microseconds = 10000; -- unsigned int max_sleep_seconds = 1; -+ unsigned int max_sleep_seconds = 2; - unsigned int n_sleep = (max_sleep_seconds - * 1000000 / sleep_microseconds); - int i; -Index: parted-3.1/parted/parted.c +--- parted-3.2.orig/libparted/arch/linux.c ++++ parted-3.2/libparted/arch/linux.c +@@ -3011,7 +3011,7 @@ _disk_sync_part_table (PedDisk* disk) + /* Attempt to remove the partition, retrying for + up to max_sleep_seconds upon any failure due to EBUSY. */ + unsigned int sleep_microseconds = 10000; +- unsigned int max_sleep_seconds = 1; ++ unsigned int max_sleep_seconds = 2; + unsigned int n_sleep = (max_sleep_seconds + * 1000000 / sleep_microseconds); + do { +Index: parted-3.2/parted/parted.c =================================================================== ---- parted-3.1.orig/parted/parted.c -+++ parted-3.1/parted/parted.c -@@ -258,6 +258,32 @@ _disk_warn_loss (PedDisk* disk) +--- parted-3.2.orig/parted/parted.c ++++ parted-3.2/parted/parted.c +@@ -266,6 +266,32 @@ _disk_warn_loss (PedDisk* disk) disk->dev->path) == PED_EXCEPTION_YES; } +/* -+ * Copied from ped_disk_commit() but removed the ped_disk_commit_to_os. We use -+ * this function in do_set - BLKPG* ioctls() does not care about the partition -+ * flags anyway. ++ * Copied from ped_disk_commit(), but with removed the call to ++ * ped_disk_commit_to_os(). This is used in do_set() - BLKPG* ioctls() do not ++ * care about the partition flags anyway. + */ +static int +ped_disk_commit_just_to_disk (PedDisk* disk) @@ -68,12 +62,12 @@ Index: parted-3.1/parted/parted.c /* This function changes "sector" to "new_sector" if the new value lies * within the required range. */ -@@ -1643,7 +1669,7 @@ do_set (PedDevice** dev) +@@ -1735,7 +1761,7 @@ do_set (PedDevice** dev, PedDisk **diskp if (!ped_partition_set_flag (part, flag, state)) - goto error_destroy_disk; -- if (!ped_disk_commit (disk)) -+ if (!ped_disk_commit_just_to_disk (disk)) - goto error_destroy_disk; - ped_disk_destroy (disk); + goto error; +- if (!ped_disk_commit (*diskp)) ++ if (!ped_disk_commit_just_to_disk (*diskp)) + goto error; + if ((*dev)->type != PED_DEVICE_FILE) diff --git a/parted-2.4-ncursesw6.patch b/parted-2.4-ncursesw6.patch index 0a3e1ea..5a2ade4 100644 --- a/parted-2.4-ncursesw6.patch +++ b/parted-2.4-ncursesw6.patch @@ -2,11 +2,11 @@ configure.ac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -Index: parted-3.1/configure.ac +Index: parted-3.2/configure.ac =================================================================== ---- parted-3.1.orig/configure.ac -+++ parted-3.1/configure.ac -@@ -164,7 +164,8 @@ AM_CPPFLAGS="$AM_CPPFLAGS -D_REENTRANT" +--- parted-3.2.orig/configure.ac ++++ parted-3.2/configure.ac +@@ -165,7 +165,8 @@ AM_CPPFLAGS="$AM_CPPFLAGS -D_REENTRANT" dnl Check for programs. AC_ISC_POSIX @@ -16,7 +16,7 @@ Index: parted-3.1/configure.ac AC_PROG_GCC_TRADITIONAL AM_PROG_CC_C_O -@@ -371,7 +372,7 @@ dnl Check for termcap +@@ -377,7 +378,7 @@ dnl Check for termcap if test "$with_readline" = yes; then OLD_LIBS="$LIBS" LIBS="" diff --git a/parted-3.1.tar.xz b/parted-3.1.tar.xz deleted file mode 100644 index 33f576a..0000000 --- a/parted-3.1.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -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 deleted file mode 100644 index 544eaa5..0000000 --- a/parted-3.1.tar.xz.sig +++ /dev/null @@ -1,17 +0,0 @@ ------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-3.2.tar.xz b/parted-3.2.tar.xz new file mode 100644 index 0000000..4a98ed0 --- /dev/null +++ b/parted-3.2.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:858b589c22297cacdf437f3baff6f04b333087521ab274f7ab677cb8c6bb78e4 +size 1655244 diff --git a/parted-3.2.tar.xz.sig b/parted-3.2.tar.xz.sig new file mode 100644 index 0000000..a073ec8 --- /dev/null +++ b/parted-3.2.tar.xz.sig @@ -0,0 +1,11 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1 + +iQEcBAABCgAGBQJT1xMSAAoJEI5FoCIzSKrwifgH/3RPcmdiLuBG1CFhSwvFMDE4 +0+cOupMjmPvLXjjj1wVD1svj5MF5R/Hejd2GzOfZZ1OOZD/1asgBCteh3RLXvj00 +gE8vTv9MsYeO6C3IiNNy8KwAi1XMDD/75WyOxgStTZuDaspczyRxtYgHUk/vHRdf +btpkf2fuzSX4EskU5U4QetJgjmVUee0bGafC1CGLdxKTwxY2At4uf9TX+Y4us8Ym +EEqdQyeF8OV/wcGJq8aRkbZbHPVtI1id4IS8X7RxTmJtRHp13/WcYo/vkQUm1BUt +RFFeCCE65PxY33jYSYIJCSrfr1LLvzM2LCfEXNduLXUiKwz54/72j5HBkjeKYps= +=vEMW +-----END PGP SIGNATURE----- diff --git a/parted-Add-Intel-Rapid-Start-Technology-partition.patch b/parted-Add-Intel-Rapid-Start-Technology-partition.patch deleted file mode 100644 index 65996e3..0000000 --- a/parted-Add-Intel-Rapid-Start-Technology-partition.patch +++ /dev/null @@ -1,318 +0,0 @@ -From e6a23531e0cb40c2cc75f1e8fbb86ab872cb6f1b Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Mon, 26 Aug 2013 16:27:00 -0700 -Subject: [PATCH 65/69] libparted: Add Intel Rapid Start Technology partition - flag. - -This adds support for the irst partition type flag. Sets the type to -0x84 on MS-DOS and D3BFE2DE-3DAF-11DF-BA-40-E3A556D89593 on GPT. - ---- - doc/C/parted.8 | 2 +- - include/parted/disk.in.h | 5 +++-- - libparted/disk.c | 2 ++ - libparted/labels/dos.c | 21 +++++++++++++++++++++ - libparted/labels/gpt.c | 37 +++++++++++++++++++++++++++++++++++++ - 5 files changed, 64 insertions(+), 3 deletions(-) - -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", --"legacy_boot" and "palo". -+"legacy_boot", "irst" and "palo". - \fIstate\fP should be either "on" or "off". - .TP - .B unit \fIunit\fP -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 -@@ -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 -@@ -2474,6 +2474,8 @@ ped_partition_flag_get_name (PedPartitio - return N_("diag"); - case PED_PARTITION_LEGACY_BOOT: - return N_("legacy_boot"); -+ case PED_PARTITION_IRST: -+ return N_("irst"); - - default: - ped_exception_throw ( -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 - #define PARTITION_LINUX 0x83 -+#define PARTITION_IRST 0x84 - #define PARTITION_LINUX_EXT 0x85 - #define PARTITION_LINUX_LVM 0x8e - #define PARTITION_HFS 0xaf -@@ -159,6 +160,7 @@ typedef struct { - int palo; - int prep; - int diag; -+ int irst; - OrigState* orig; /* used for CHS stuff */ - } DosPartitionData; - -@@ -924,6 +926,7 @@ raw_part_parse (const PedDisk* disk, con - dos_data->lba = raw_part_is_lba (raw_part); - dos_data->palo = raw_part->type == PARTITION_PALO; - dos_data->prep = raw_part->type == PARTITION_PREP; -+ dos_data->irst = raw_part->type == PARTITION_IRST; - dos_data->orig = ped_malloc (sizeof (OrigState)); - if (!dos_data->orig) { - ped_partition_destroy (part); -@@ -1339,6 +1342,7 @@ msdos_partition_new (const PedDisk* disk - dos_data->lba = 0; - dos_data->palo = 0; - dos_data->prep = 0; -+ dos_data->irst = 0; - } else { - part->disk_specific = NULL; - } -@@ -1374,6 +1378,7 @@ msdos_partition_duplicate (const PedPart - new_dos_data->lba = old_dos_data->lba; - new_dos_data->palo = old_dos_data->palo; - new_dos_data->prep = old_dos_data->prep; -+ new_dos_data->irst = old_dos_data->irst; - - if (old_dos_data->orig) { - new_dos_data->orig = ped_malloc (sizeof (OrigState)); -@@ -1422,6 +1427,7 @@ msdos_partition_set_system (PedPartition - dos_data->lvm = 0; - dos_data->palo = 0; - dos_data->prep = 0; -+ dos_data->irst = 0; - if (dos_data->lba) - dos_data->system = PARTITION_EXT_LBA; - else -@@ -1454,6 +1460,10 @@ msdos_partition_set_system (PedPartition - dos_data->system = PARTITION_PREP; - return 1; - } -+ if (dos_data->irst) { -+ dos_data->system = PARTITION_IRST; -+ return 1; -+ } - - if (!fs_type) - dos_data->system = PARTITION_LINUX; -@@ -1490,6 +1500,7 @@ clear_flags (DosPartitionData *dos_data) - dos_data->lvm = 0; - dos_data->palo = 0; - dos_data->prep = 0; -+ dos_data->irst = 0; - dos_data->raid = 0; - } - -@@ -1572,6 +1583,12 @@ msdos_partition_set_flag (PedPartition* - dos_data->prep = state; - return ped_partition_set_system (part, part->fs_type); - -+ case PED_PARTITION_IRST: -+ if (state) -+ clear_flags (dos_data); -+ dos_data->irst = state; -+ return ped_partition_set_system (part, part->fs_type); -+ - default: - return 0; - } -@@ -1617,6 +1634,9 @@ msdos_partition_get_flag (const PedParti - case PED_PARTITION_PREP: - return dos_data->prep; - -+ case PED_PARTITION_IRST: -+ return dos_data->irst; -+ - default: - return 0; - } -@@ -1640,6 +1660,7 @@ msdos_partition_is_flag_available (const - case PED_PARTITION_TYPE: - case PED_PARTITION_PALO: - case PED_PARTITION_PREP: -+ case PED_PARTITION_IRST: - case PED_PARTITION_DIAG: - return 1; - -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_IRST_GUID \ -+ ((efi_guid_t) { PED_CPU_TO_LE32 (0xD3BFE2DE), PED_CPU_TO_LE16 (0x3DAF), \ -+ PED_CPU_TO_LE16 (0x11DF), 0xba, 0x40, \ -+ { 0xE3, 0xA5, 0x56, 0xD8, 0x95, 0x93 }}) - - struct __attribute__ ((packed)) _GuidPartitionTableHeader_t - { -@@ -283,6 +287,7 @@ typedef struct _GPTPartitionData - int atvrecv; - int msftrecv; - int legacy_boot; -+ int irst; - } GPTPartitionData; - - static PedDiskType gpt_disk_type; -@@ -885,6 +890,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->irst - = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; - - if (pte->Attributes.RequiredToFunction & 0x1) -@@ -908,6 +914,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_IRST_GUID)) -+ gpt_part_data->irst = 1; - - return part; - } -@@ -1531,6 +1539,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->irst = 0; - 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); -@@ -1634,6 +1643,11 @@ gpt_partition_set_system (PedPartition * - gpt_part_data->type = PARTITION_APPLE_TV_RECOVERY_GUID; - return 1; - } -+ if (gpt_part_data->irst) -+ { -+ gpt_part_data->type = PARTITION_IRST_GUID; -+ return 1; -+ } - - if (fs_type) - { -@@ -1774,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->irst - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_BIOS_GRUB: -@@ -1785,6 +1800,7 @@ gpt_partition_set_flag (PedPartition *pa - = gpt_part_data->hp_service - = gpt_part_data->msftres - = gpt_part_data->msftrecv -+ = gpt_part_data->irst - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_RAID: -@@ -1796,6 +1812,7 @@ gpt_partition_set_flag (PedPartition *pa - = gpt_part_data->hp_service - = gpt_part_data->msftres - = gpt_part_data->msftrecv -+ = gpt_part_data->irst - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_LVM: -@@ -1807,6 +1824,7 @@ gpt_partition_set_flag (PedPartition *pa - = gpt_part_data->hp_service - = gpt_part_data->msftres - = gpt_part_data->msftrecv -+ = gpt_part_data->irst - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_HPSERVICE: -@@ -1818,6 +1836,7 @@ gpt_partition_set_flag (PedPartition *pa - = gpt_part_data->bios_grub - = gpt_part_data->msftres - = gpt_part_data->msftrecv -+ = gpt_part_data->irst - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_MSFT_RESERVED: -@@ -1829,6 +1848,7 @@ gpt_partition_set_flag (PedPartition *pa - = gpt_part_data->bios_grub - = gpt_part_data->hp_service - = gpt_part_data->msftrecv -+ = gpt_part_data->irst - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_DIAG: -@@ -1840,6 +1860,7 @@ gpt_partition_set_flag (PedPartition *pa - = gpt_part_data->bios_grub - = gpt_part_data->hp_service - = gpt_part_data->msftres -+ = gpt_part_data->irst - = gpt_part_data->atvrecv = 0; - return gpt_partition_set_system (part, part->fs_type); - case PED_PARTITION_APPLE_TV_RECOVERY: -@@ -1851,8 +1872,21 @@ gpt_partition_set_flag (PedPartition *pa - = gpt_part_data->bios_grub - = gpt_part_data->hp_service - = gpt_part_data->msftres -+ = gpt_part_data->irst - = gpt_part_data->msftrecv = 0; - return gpt_partition_set_system (part, part->fs_type); -+ case PED_PARTITION_IRST: -+ gpt_part_data->irst = 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_HIDDEN: - gpt_part_data->hidden = state; - return 1; -@@ -1897,6 +1931,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_IRST: -+ return gpt_part_data->irst; - case PED_PARTITION_SWAP: - case PED_PARTITION_LBA: - case PED_PARTITION_ROOT: -@@ -1922,6 +1958,7 @@ gpt_partition_is_flag_available (const P - case PED_PARTITION_APPLE_TV_RECOVERY: - case PED_PARTITION_HIDDEN: - case PED_PARTITION_LEGACY_BOOT: -+ case PED_PARTITION_IRST: - return 1; - case PED_PARTITION_SWAP: - case PED_PARTITION_ROOT: diff --git a/parted-GPT-add-support-for-PReP-GUID.patch b/parted-GPT-add-support-for-PReP-GUID.patch deleted file mode 100644 index 648608f..0000000 --- a/parted-GPT-add-support-for-PReP-GUID.patch +++ /dev/null @@ -1,211 +0,0 @@ -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, \ -@@ -287,6 +291,7 @@ typedef struct _GPTPartitionData - int atvrecv; - int msftrecv; - int legacy_boot; -+ int prep; - int irst; - } GPTPartitionData; - -@@ -890,6 +895,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; - -@@ -914,6 +920,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; - -@@ -1539,6 +1547,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)); -@@ -1613,6 +1622,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; -@@ -1788,6 +1802,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); -@@ -1800,6 +1815,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); -@@ -1812,6 +1828,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); -@@ -1824,6 +1841,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); -@@ -1836,6 +1854,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); -@@ -1848,6 +1867,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); -@@ -1860,6 +1880,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); -@@ -1872,9 +1893,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) -@@ -1885,6 +1919,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: -@@ -1931,6 +1966,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: -@@ -1959,6 +1996,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 deleted file mode 100644 index 0fd7c12..0000000 --- a/parted-btrfs-support.patch +++ /dev/null @@ -1,167 +0,0 @@ -commit 85e5fcd1bb0fe91d8908e8a638e9827979b6feff -Author: Luca Bruno -Date: Thu Feb 12 15:15:30 2009 +0100 - - Initial btrfs support, only recognize it for now - - Add initial btrfs support to libparted; just discovering - the declared magic entry at the right place to recognize - filesystem type, for the moment. - - Signed-off-by: Luca Bruno - ---- - libparted/fs/Makefile.am | 1 - libparted/fs/btrfs/btrfs.c | 96 ++ - libparted/libparted.c | 4 - 4 files changed, 1933 insertions(+) - -Index: parted-3.1/libparted/fs/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-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. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . -+*/ -+ -+#include -+ -+#include -+#include -+ -+#if ENABLE_NLS -+# include -+# define _(String) dgettext (PACKAGE, String) -+#else -+# define _(String) (String) -+#endif /* ENABLE_NLS */ -+ -+#include -+ -+#define BTRFS_BLOCK_SIZES ((int[2]){1024, 0}) -+#define BTRFS_SUPER_INFO_SIZE 4096 -+#define BTRFS_SUPER_INFO_OFFSET (64 * 1024) -+ -+//Should be definitive, as of v0.18 -+#define BTRFS_SIGNATURE 0x4D5F53665248425F -+ -+static PedGeometry* -+btrfs_probe (PedGeometry* geom) -+{ -+ char buf[BTRFS_SUPER_INFO_SIZE]; -+ -+ uint64_t magic; -+ -+ if (!ped_geometry_read (geom, buf, -+ (BTRFS_SUPER_INFO_OFFSET / 512), -+ (BTRFS_SUPER_INFO_SIZE / 512))) -+ return 0; -+ -+ memcpy(&magic, buf + 64, sizeof(uint64_t)); -+ -+ if (magic == PED_CPU_TO_LE64(BTRFS_SIGNATURE)) -+ return ped_geometry_new (geom->dev, geom->start, geom->length); -+ else -+ return NULL; -+} -+ -+#ifndef DISCOVER_ONLY -+static int -+btrfs_clobber (PedGeometry* geom) -+{ -+ char buf[BTRFS_SUPER_INFO_SIZE]; -+ -+ memset (buf, 0, BTRFS_SUPER_INFO_SIZE); -+ return ped_geometry_write (geom, buf, -+ (BTRFS_SUPER_INFO_OFFSET / 512), -+ (BTRFS_SUPER_INFO_SIZE / 512)); -+} -+#endif /* !DISCOVER_ONLY */ -+ -+static PedFileSystemOps btrfs_ops = { -+ probe: btrfs_probe, -+}; -+ -+static PedFileSystemType btrfs_type = { -+ next: NULL, -+ ops: &btrfs_ops, -+ name: "btrfs", -+ block_sizes: BTRFS_BLOCK_SIZES -+}; -+ -+void -+ped_file_system_btrfs_init () -+{ -+ ped_file_system_type_register (&btrfs_type); -+} -+ -+void -+ped_file_system_btrfs_done () -+{ -+ ped_file_system_type_unregister (&btrfs_type); -+} -+ -+ -Index: parted-3.1/libparted/libparted.c -=================================================================== ---- 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); -+extern void ped_file_system_btrfs_init (void); - - static void - 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 (); - } - - 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); -+extern void ped_file_system_btrfs_done (void); - extern void ped_file_system_amiga_done (void); - - static void -@@ -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 (); - } - diff --git a/parted-do-not-warn-when-shrinking-in-script-mode.patch b/parted-do-not-warn-when-shrinking-in-script-mode.patch new file mode 100644 index 0000000..71f8cd7 --- /dev/null +++ b/parted-do-not-warn-when-shrinking-in-script-mode.patch @@ -0,0 +1,17 @@ +--- + parted/parted.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Index: parted-3.2/parted/parted.c +=================================================================== +--- parted-3.2.orig/parted/parted.c ++++ parted-3.2/parted/parted.c +@@ -1601,7 +1601,7 @@ do_resizepart (PedDevice** dev, PedDisk* + start, end)) + goto error_destroy_constraint; + /* warn when shrinking partition - might lose data */ +- if (part->geom.end < oldend) ++ if ((part->geom.end < oldend) && !opt_script_mode) + if (ped_exception_throw ( + PED_EXCEPTION_WARNING, + PED_EXCEPTION_YES_NO, diff --git a/parted-dont-crash-in-disk_set-when-disk-label-not-found.patch b/parted-dont-crash-in-disk_set-when-disk-label-not-found.patch new file mode 100644 index 0000000..5f4fe6c --- /dev/null +++ b/parted-dont-crash-in-disk_set-when-disk-label-not-found.patch @@ -0,0 +1,39 @@ +From 624a8b14af7d358782ecc12627c84da72c28aeff Mon Sep 17 00:00:00 2001 +From: Phillip Susi +Date: Tue, 13 Jan 2015 11:05:48 -0500 +Subject: [PATCH] parted: don't crash in disk_set when disk label not found + +Due to a typeo in commit 7eac058 "parted: don't reload partition +table on every command", the disk_set command would crash if +a disk label was not found. +--- + NEWS | 2 ++ + parted/parted.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +Index: parted-3.2/NEWS +=================================================================== +--- parted-3.2.orig/NEWS ++++ parted-3.2/NEWS +@@ -162,6 +162,8 @@ GNU parted NEWS + + ** Bug Fixes + ++ Don't crash in the disk_set command when a disk label is not found ++ + libparted-fs-resize: Prevent crash resizing FAT16 file systems. + + +Index: parted-3.2/parted/parted.c +=================================================================== +--- parted-3.2.orig/parted/parted.c ++++ parted-3.2/parted/parted.c +@@ -1708,7 +1708,7 @@ do_disk_set (PedDevice** dev, PedDisk** + + if (!*diskp) + *diskp = ped_disk_new (*dev); +- if (!diskp) ++ if (!*diskp) + goto error; + + if (!command_line_get_disk_flag (_("Flag to Invert?"), *diskp, &flag)) diff --git a/parted-fix-cciss-partition-naming.patch b/parted-fix-cciss-partition-naming.patch deleted file mode 100644 index d0f91ea..0000000 --- a/parted-fix-cciss-partition-naming.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- - libparted/arch/linux.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -Index: parted-3.1/libparted/arch/linux.c -=================================================================== ---- 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 { -- char const *p = (dev->type == PED_DEVICE_DAC960 -- || dev->type == PED_DEVICE_CPQARRAY -+ const char *p; -+ if (dev->type == PED_DEVICE_CPQARRAY) -+ p = "p"; -+ else -+ p = (dev->type == PED_DEVICE_DAC960 - || dev->type == PED_DEVICE_ATARAID - || isdigit (dev->path[path_len - 1]) - ? "_part" : ""); diff --git a/parted-gpt-mbr-sync.patch b/parted-gpt-mbr-sync.patch index b08bdad..7bf83c5 100644 --- a/parted-gpt-mbr-sync.patch +++ b/parted-gpt-mbr-sync.patch @@ -2,11 +2,11 @@ libparted/labels/gpt.c | 240 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 236 insertions(+), 4 deletions(-) -Index: parted-3.1/libparted/labels/gpt.c +Index: parted-3.2/libparted/labels/gpt.c =================================================================== ---- parted-3.1.orig/libparted/labels/gpt.c -+++ parted-3.1/libparted/labels/gpt.c -@@ -286,6 +286,7 @@ typedef struct _GPTPartitionData +--- parted-3.2.orig/libparted/labels/gpt.c ++++ parted-3.2/libparted/labels/gpt.c +@@ -305,6 +305,7 @@ typedef struct _GPTPartitionData } GPTPartitionData; static PedDiskType gpt_disk_type; @@ -14,7 +14,7 @@ Index: parted-3.1/libparted/labels/gpt.c static inline uint32_t pth_get_size (const PedDevice *dev) -@@ -454,8 +455,50 @@ _pmbr_is_valid (const LegacyMBR_t *mbr) +@@ -473,8 +474,50 @@ _pmbr_is_valid (const LegacyMBR_t *mbr) return 0; } @@ -64,10 +64,10 @@ Index: parted-3.1/libparted/labels/gpt.c -gpt_probe (const PedDevice *dev) +_gpt_probe_generic(const PedDevice *dev) { - GuidPartitionTableHeader_t *gpt = NULL; int gpt_sig_found = 0; + @@ -508,6 +551,19 @@ gpt_probe (const PedDevice *dev) - return ok; + return gpt_sig_found; } +static int @@ -86,7 +86,7 @@ Index: parted-3.1/libparted/labels/gpt.c static PedDisk * gpt_alloc (const PedDevice *dev) { -@@ -546,6 +602,36 @@ error: +@@ -553,6 +609,36 @@ error: } static PedDisk * @@ -123,7 +123,7 @@ Index: parted-3.1/libparted/labels/gpt.c gpt_duplicate (const PedDisk *disk) { PedDisk *new_disk; -@@ -930,7 +1016,7 @@ gpt_read (PedDisk *disk) +@@ -963,7 +1049,7 @@ gpt_read (PedDisk *disk) /* motivation: let the user decide about the pmbr... during ped_disk_probe(), they probably didn't get a choice... */ @@ -132,7 +132,7 @@ Index: parted-3.1/libparted/labels/gpt.c goto error; GuidPartitionTableHeader_t *gpt = NULL; -@@ -1087,11 +1173,59 @@ error: +@@ -1120,11 +1206,59 @@ error: return 0; } @@ -193,7 +193,7 @@ Index: parted-3.1/libparted/labels/gpt.c /* 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). -@@ -1105,6 +1239,8 @@ _write_pmbr (PedDevice *dev, bool pmbr_b +@@ -1138,6 +1272,8 @@ _write_pmbr (PedDevice *dev, bool pmbr_b memset (pmbr->PartitionRecord, 0, sizeof pmbr->PartitionRecord); pmbr->Signature = PED_CPU_TO_LE16 (MSDOS_MBR_SIGNATURE); @@ -202,7 +202,7 @@ Index: parted-3.1/libparted/labels/gpt.c pmbr->PartitionRecord[0].OSType = EFI_PMBR_OSTYPE_EFI; pmbr->PartitionRecord[0].StartSector = 1; pmbr->PartitionRecord[0].EndHead = 0xFE; -@@ -1117,6 +1253,60 @@ _write_pmbr (PedDevice *dev, bool pmbr_b +@@ -1150,6 +1286,60 @@ _write_pmbr (PedDevice *dev, bool pmbr_b pmbr->PartitionRecord[0].SizeInLBA = PED_CPU_TO_LE32 (dev->length - 1UL); if (pmbr_boot) pmbr->PartitionRecord[0].BootIndicator = 0x80; @@ -263,7 +263,7 @@ Index: parted-3.1/libparted/labels/gpt.c int write_ok = ped_device_write (dev, pmbr, GPT_PMBR_LBA, GPT_PMBR_SECTORS); -@@ -1237,7 +1427,7 @@ gpt_write (const PedDisk *disk) +@@ -1269,7 +1459,7 @@ gpt_write (const PedDisk *disk) ptes_crc = efi_crc32 (ptes, ptes_bytes); /* Write protective MBR */ @@ -272,7 +272,7 @@ Index: parted-3.1/libparted/labels/gpt.c goto error_free_ptes; /* Write PTH and PTEs */ -@@ -1857,6 +2047,38 @@ static PedDiskOps gpt_disk_ops = +@@ -2034,6 +2224,38 @@ static PedDiskOps gpt_disk_ops = PT_op_function_initializers (gpt) }; @@ -311,7 +311,7 @@ Index: parted-3.1/libparted/labels/gpt.c static PedDiskType gpt_disk_type = { next: NULL, -@@ -1865,16 +2087,26 @@ static PedDiskType gpt_disk_type = +@@ -2042,16 +2264,26 @@ static PedDiskType gpt_disk_type = features: PED_DISK_TYPE_PARTITION_NAME }; diff --git a/parted-mac.patch b/parted-mac.patch index f1b820a..de06b6c 100644 --- a/parted-mac.patch +++ b/parted-mac.patch @@ -3,13 +3,13 @@ libparted/disk.c | 33 +++++++++++++++++++++++++++++++++ libparted/labels/mac.c | 34 +++++++++++++++++++++++++++++++++- parted/parted.c | 12 ++++++++++++ - 5 files changed, 92 insertions(+), 5 deletions(-) + 4 files changed, 85 insertions(+), 3 deletions(-) -Index: parted-3.1/include/parted/disk.in.h +Index: parted-3.2/include/parted/disk.in.h =================================================================== ---- parted-3.1.orig/include/parted/disk.in.h -+++ parted-3.1/include/parted/disk.in.h -@@ -80,10 +80,11 @@ enum _PedPartitionFlag { +--- parted-3.2.orig/include/parted/disk.in.h ++++ parted-3.2/include/parted/disk.in.h +@@ -83,10 +83,11 @@ enum _PedPartitionFlag { enum _PedDiskTypeFeature { PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ @@ -23,16 +23,16 @@ Index: parted-3.1/include/parted/disk.in.h struct _PedDisk; struct _PedPartition; -@@ -243,6 +244,8 @@ struct _PedDiskOps { +@@ -246,6 +247,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); ++ 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); -@@ -334,7 +337,9 @@ extern int ped_partition_is_flag_availab +@@ -337,7 +340,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); @@ -42,11 +42,11 @@ Index: parted-3.1/include/parted/disk.in.h 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 +Index: parted-3.2/libparted/disk.c =================================================================== ---- parted-3.1.orig/libparted/disk.c -+++ parted-3.1/libparted/disk.c -@@ -1180,6 +1180,39 @@ _disk_pop_update_mode (PedDisk* disk) +--- parted-3.2.orig/libparted/disk.c ++++ parted-3.2/libparted/disk.c +@@ -1184,6 +1184,39 @@ _disk_pop_update_mode (PedDisk* disk) * @{ */ @@ -86,12 +86,12 @@ Index: parted-3.1/libparted/disk.c PedPartition* _ped_partition_alloc (const PedDisk* disk, PedPartitionType type, const PedFileSystemType* fs_type, -Index: parted-3.1/libparted/labels/mac.c +Index: parted-3.2/libparted/labels/mac.c =================================================================== ---- 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); +--- parted-3.2.orig/libparted/labels/mac.c ++++ parted-3.2/libparted/labels/mac.c +@@ -1393,6 +1393,36 @@ mac_get_partition_alignment(const PedDis + return ped_alignment_new(0, 1); } +/* we do not really want to call this ... yet */ @@ -127,7 +127,7 @@ Index: parted-3.1/libparted/labels/mac.c static PedConstraint* _primary_constraint (PedDisk* disk) { -@@ -1598,6 +1628,8 @@ static PedDiskOps mac_disk_ops = { +@@ -1593,6 +1623,8 @@ static PedDiskOps mac_disk_ops = { partition_set_name: mac_partition_set_name, partition_get_name: mac_partition_get_name, @@ -136,7 +136,7 @@ Index: parted-3.1/libparted/labels/mac.c get_partition_alignment: mac_get_partition_alignment, -@@ -1608,7 +1640,7 @@ static PedDiskType mac_disk_type = { +@@ -1603,7 +1635,7 @@ static PedDiskType mac_disk_type = { next: NULL, name: "mac", ops: &mac_disk_ops, @@ -145,11 +145,11 @@ Index: parted-3.1/libparted/labels/mac.c }; void -Index: parted-3.1/parted/parted.c +Index: parted-3.2/parted/parted.c =================================================================== ---- parted-3.1.orig/parted/parted.c -+++ parted-3.1/parted/parted.c -@@ -889,6 +889,7 @@ static char* +--- parted-3.2.orig/parted/parted.c ++++ parted-3.2/parted/parted.c +@@ -888,6 +888,7 @@ static char* partition_print_flags (PedPartition const *part) { int xtype; @@ -157,7 +157,7 @@ Index: parted-3.1/parted/parted.c char *res = xstrdup (""); if (!part) return res; -@@ -921,6 +922,17 @@ partition_print_flags (PedPartition cons +@@ -920,6 +921,17 @@ partition_print_flags (PedPartition cons } } diff --git a/parted-resize-alias-to-resizepart.patch b/parted-resize-alias-to-resizepart.patch new file mode 100644 index 0000000..e3f9632 --- /dev/null +++ b/parted-resize-alias-to-resizepart.patch @@ -0,0 +1,23 @@ +--- + parted/parted.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +Index: parted-3.2/parted/parted.c +=================================================================== +--- parted-3.2.orig/parted/parted.c ++++ parted-3.2/parted/parted.c +@@ -2055,9 +2055,11 @@ NULL), + + command_register (commands, command_create ( + str_list_create_unique ("resize", _("resize"), NULL), +- do_resize, +- NULL, +- str_list_create (_(N_("The resize command was removed in parted 3.0\n")), NULL), 1)); ++ do_resizepart, ++ str_list_create ( ++_("resizepart NUMBER END resize partition NUMBER"), ++NULL), ++ str_list_create (_(number_msg), _(end_msg), NULL), 1)); + + command_register (commands, command_create ( + str_list_create_unique ("resizepart", _("resizepart"), NULL), diff --git a/parted-resize-command.patch b/parted-resize-command.patch deleted file mode 100644 index 03a785e..0000000 --- a/parted-resize-command.patch +++ /dev/null @@ -1,122 +0,0 @@ ---- - 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 (!opt_script_mode && (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) - { -@@ -1948,6 +2026,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 1c25bd9..368f828 100644 --- a/parted-type.patch +++ b/parted-type.patch @@ -2,33 +2,33 @@ include/parted/disk.in.h | 5 ++- libparted/disk.c | 2 + libparted/labels/dos.c | 8 ++++++ - parted/parted.c | 59 +++++++++++++++++++++++++++++++---------------- + parted/parted.c | 61 ++++++++++++++++++++++++++++++----------------- parted/ui.c | 3 ++ - 6 files changed, 58 insertions(+), 24 deletions(-) + 5 files changed, 56 insertions(+), 23 deletions(-) -Index: parted-3.1/include/parted/disk.in.h +Index: parted-3.2/include/parted/disk.in.h =================================================================== ---- parted-3.1.orig/include/parted/disk.in.h -+++ parted-3.1/include/parted/disk.in.h -@@ -72,10 +72,11 @@ enum _PedPartitionFlag { - PED_PARTITION_BIOS_GRUB=12, - PED_PARTITION_APPLE_TV_RECOVERY=13, - PED_PARTITION_DIAG=14, -- PED_PARTITION_LEGACY_BOOT=15 -+ PED_PARTITION_LEGACY_BOOT=15, -+ PED_PARTITION_TYPE=16 +--- parted-3.2.orig/include/parted/disk.in.h ++++ parted-3.2/include/parted/disk.in.h +@@ -75,10 +75,11 @@ enum _PedPartitionFlag { + PED_PARTITION_LEGACY_BOOT=15, + PED_PARTITION_MSFT_DATA=16, + PED_PARTITION_IRST=17, +- PED_PARTITION_ESP=18 ++ PED_PARTITION_ESP=18, ++ PED_PARTITION_TYPE=19 }; #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT --#define PED_PARTITION_LAST_FLAG PED_PARTITION_LEGACY_BOOT +-#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP +#define PED_PARTITION_LAST_FLAG PED_PARTITION_TYPE enum _PedDiskTypeFeature { PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ -Index: parted-3.1/libparted/disk.c +Index: parted-3.2/libparted/disk.c =================================================================== ---- parted-3.1.orig/libparted/disk.c -+++ parted-3.1/libparted/disk.c -@@ -2427,6 +2427,8 @@ ped_partition_flag_get_name (PedPartitio +--- parted-3.2.orig/libparted/disk.c ++++ parted-3.2/libparted/disk.c +@@ -2388,6 +2388,8 @@ ped_partition_flag_get_name (PedPartitio return N_("lba"); case PED_PARTITION_HPSERVICE: return N_("hp-service"); @@ -37,11 +37,11 @@ Index: parted-3.1/libparted/disk.c case PED_PARTITION_PALO: return N_("palo"); case PED_PARTITION_PREP: -Index: parted-3.1/libparted/labels/dos.c +Index: parted-3.2/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* +--- parted-3.2.orig/libparted/labels/dos.c ++++ parted-3.2/libparted/labels/dos.c +@@ -1550,6 +1550,10 @@ msdos_partition_set_flag (PedPartition* disk = part->disk; switch (flag) { @@ -52,7 +52,7 @@ Index: parted-3.1/libparted/labels/dos.c case PED_PARTITION_HIDDEN: if (part->type == PED_PARTITION_EXTENDED) { ped_exception_throw ( -@@ -1604,6 +1608,9 @@ msdos_partition_get_flag (const PedParti +@@ -1657,6 +1661,9 @@ msdos_partition_get_flag (const PedParti case PED_PARTITION_LBA: return dos_data->lba; @@ -62,19 +62,19 @@ Index: parted-3.1/libparted/labels/dos.c case PED_PARTITION_PALO: return dos_data->palo; -@@ -1630,6 +1637,7 @@ msdos_partition_is_flag_available (const +@@ -1689,6 +1696,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 + case PED_PARTITION_IRST: +Index: parted-3.2/parted/parted.c =================================================================== ---- parted-3.1.orig/parted/parted.c -+++ parted-3.1/parted/parted.c -@@ -888,28 +888,40 @@ error: +--- parted-3.2.orig/parted/parted.c ++++ parted-3.2/parted/parted.c +@@ -887,28 +887,40 @@ error: static char* partition_print_flags (PedPartition const *part) { @@ -134,32 +134,33 @@ Index: parted-3.1/parted/parted.c } static int -@@ -1660,12 +1672,19 @@ do_set (PedDevice** dev) - goto error_destroy_disk; +@@ -1726,12 +1738,19 @@ do_set (PedDevice** dev, PedDisk **diskp + goto error; 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 - state = (ped_partition_get_flag (part, flag) == 0 ? 1 : 0); + goto error; +- state = (ped_partition_get_flag (part, flag) == 0 ? 1 : 0); ++ 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) { + if (!is_toggle_mode && flag != PED_PARTITION_TYPE ) { if (!command_line_get_state (_("New state?"), &state)) - goto error_destroy_disk; + goto error; } -+ 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; ++ } if (!ped_partition_set_flag (part, flag, state)) - goto error_destroy_disk; -Index: parted-3.1/parted/ui.c + goto error; +Index: parted-3.2/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 +--- parted-3.2.orig/parted/ui.c ++++ parted-3.2/parted/ui.c +@@ -913,6 +913,9 @@ command_line_get_integer (const char* pr NULL, 1); if (!input) return 0; diff --git a/parted-wipeaix.patch b/parted-wipeaix.patch index 518ae85..1b83796 100644 --- a/parted-wipeaix.patch +++ b/parted-wipeaix.patch @@ -2,11 +2,11 @@ libparted/labels/dos.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -Index: parted-3.1/libparted/labels/dos.c +Index: parted-3.2/libparted/labels/dos.c =================================================================== ---- parted-3.1.orig/libparted/labels/dos.c -+++ parted-3.1/libparted/labels/dos.c -@@ -1260,7 +1260,13 @@ msdos_write (const PedDisk* disk) +--- parted-3.2.orig/libparted/labels/dos.c ++++ parted-3.2/libparted/labels/dos.c +@@ -1285,7 +1285,13 @@ msdos_write (const PedDisk* disk) return 0; DosRawTable *table = (DosRawTable *) s0; diff --git a/parted-workaround-windows7-gpt-implementation.patch b/parted-workaround-windows7-gpt-implementation.patch index 689adf8..1eaddb5 100644 --- a/parted-workaround-windows7-gpt-implementation.patch +++ b/parted-workaround-windows7-gpt-implementation.patch @@ -3,11 +3,11 @@ bnc#781688 libparted/labels/gpt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -Index: parted-3.1/libparted/labels/gpt.c +Index: parted-3.2/libparted/labels/gpt.c =================================================================== ---- parted-3.1.orig/libparted/labels/gpt.c -+++ parted-3.1/libparted/labels/gpt.c -@@ -489,7 +489,7 @@ _has_hybrid_pmbr (const PedDevice *dev) +--- parted-3.2.orig/libparted/labels/gpt.c ++++ parted-3.2/libparted/labels/gpt.c +@@ -508,7 +508,7 @@ _has_hybrid_pmbr (const PedDevice *dev) if ((mbr.PartitionRecord[0].OSType == EFI_PMBR_OSTYPE_EFI) && (mbr.PartitionRecord[0].StartingLBA == PED_CPU_TO_LE32(1)) && diff --git a/parted.changes b/parted.changes index eeb4511..9e0693f 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,74 @@ +------------------------------------------------------------------- +Tue May 5 13:39:24 UTC 2015 - puzel@suse.com + +- Do not warn about shrinking a partition if script mode is used + (bnc#929189) + - add: parted-do-not-warn-when-shrinking-in-script-mode.patch + +------------------------------------------------------------------- +Wed Feb 11 15:01:56 UTC 2015 - puzel@suse.com + +- Update to parted-3.2; Notable changes: + - Added new partition type flag, esp, to set the type to 0xEF on + MS-DOS. Also aliased to boot on GPT to set the UEFI ESP GUID. + - You can now choose to ignore errors about partitions that + overlap, or are longer than the disk. This allows you to use + parted to repair the problem. + - When attempting to manipulate a mounted partition, parted now + issues a warning that you can choose to ignore, instead of an + error. + - When creating a loop label, it automatically comes with a + partition using the whole disk. + - parted -l no longer lists device-mapper devices other than + dmraid whole disks. + - Added new Linux-specific partition GUID type code + (0FC63DAF-8483-4772-8E79-3D69D8477DE4) for Linux filesystem + data on GPT disks. This type code is now assigned as the + default partition type code for new partitions holding Linux + filesystems. + - Added new "msftdata" flag to identify partitions holding NTFS + or FAT filesystems on GPT disks. This flag corresponds to a + GPT type code of EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 + ("Microsoft Basic Data"). Since Linux filesystem partitions + formerly used this type code, this flag may optionally be set + on Linux partitions to make the partition table type codes + match former configurations in case the new Linux filesystem + type code causes problems with some utility. Note that this + flag cannot be removed from NTFS or FAT partitions within + parted except by setting a competing flag, such as "boot" + (which sets the type code used by EFI System partitions) or + "msftres" (which sets the "Microsoft Reserved" type code). + - Many bugfixes (see /usr/share/doc/packages/parted/NEWS) +- merge parted-fix-cciss-partition-naming.patch, + libparted-fix-mmcblk-partition-name.patch, + fix-dm-partition-name.patch + into libparted-partition-naming.patch +- Add parted-resize-alias-to-resizepart.patch +- Add libparted-avoid-libdevice-mapper-warnings.patch +- drop patches (in upstream): + - fix-error-informing-the-kernel.patch + - Fix-help-text-for-disk_-set-toggle.patch + - libparted-Avoid-dasd-as-default-disk-type-while-probe.patch + - libparted-add-support-for-EAV-DASD-partitions.patch + - libparted-add-support-for-implicit-FBA-DASD-partition.patch + - libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch + - libparted-initialize-dasd-part-type.patch + - libparted-mklabel-to-support-EAV-DASD.patch + - libparted-mklabel-to-support-EDEV-DASD.patch + - parted-Add-Intel-Rapid-Start-Technology-partition.patch + - parted-GPT-add-support-for-PReP-GUID.patch + - parted-btrfs-support.patch + - parted-resize-command.patch +- drop do-not-create-dm-nodes.patch: Not needed anymore since + parted DM handling has been reworked. +- modified more-reliable-informing-the-kernel.patch: No longer + call 'udevadm settle' as it was causing issues. +- add patches from upstream (post-3.2): + - lib-fs-resize-prevent-crash-resizing-FAT16.patch + - libparted-device-mapper-uses-512b-sectors.patch + - parted-dont-crash-in-disk_set-when-disk-label-not-found.patch +- refresh patches + ------------------------------------------------------------------- Fri Nov 14 09:18:50 UTC 2014 - dimstar@opensuse.org diff --git a/parted.spec b/parted.spec index abe1c86..7208a8c 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ # # spec file for package parted # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX 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,7 +17,7 @@ Name: parted -Version: 3.1 +Version: 3.2 Release: 0 Summary: GNU partitioner License: GPL-3.0+ @@ -34,39 +34,27 @@ 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 +Patch12: libparted-partition-naming.patch #PATCH-FEATURE-SUSE more-reliable-informing-the-kernel.patch bnc#657360 petr.uzel@suse.cz -Patch17: more-reliable-informing-the-kernel.patch -Patch19: parted-gpt-mbr-sync.patch -Patch20: libparted-ppc-prepboot-in-syncmbr.patch -Patch21: parted-workaround-windows7-gpt-implementation.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: parted-btrfs-support.patch -Patch27: parted-GPT-add-support-for-PReP-GUID.patch -Patch28: parted-resize-command.patch -Patch29: libparted-dasd-do-not-use-first-tracks.patch -Patch30: libparted-initialize-dasd-part-type.patch -Patch31: libparted-use-BLKRRPART-for-DASD.patch.patch -Patch32: libparted-copy-pmbr_boot-when-duplicating-GPT-disk.patch -Patch33: Fix-help-text-for-disk_-set-toggle.patch -Patch34: libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch -Patch35: libparted-add-support-for-implicit-FBA-DASD-partition.patch -Patch36: libparted-add-support-for-EAV-DASD-partitions.patch -Patch37: libparted-mklabel-to-support-EAV-DASD.patch -Patch38: libparted-Avoid-dasd-as-default-disk-type-while-probe.patch -Patch39: libparted-mklabel-to-support-EDEV-DASD.patch -Patch40: libparted-make-BLKRRPART-more-robust.patch -Patch41: libparted-make-sure-not-to-treat-percentages-and-cyls-as-exact.patch -Patch42: libparted-dasd-implicit-partition-disk-flag.patch +Patch13: more-reliable-informing-the-kernel.patch +Patch14: parted-gpt-mbr-sync.patch +Patch15: libparted-ppc-prepboot-in-syncmbr.patch +Patch16: parted-workaround-windows7-gpt-implementation.patch +Patch17: dummy-bootcode-only-for-x86.patch +Patch18: parted-type.patch +Patch19: parted-mac.patch +Patch20: libparted-dasd-do-not-use-first-tracks.patch +Patch21: libparted-use-BLKRRPART-for-DASD.patch.patch +Patch22: libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch +Patch23: libparted-make-BLKRRPART-more-robust.patch +Patch24: libparted-make-sure-not-to-treat-percentages-and-cyls-as-exact.patch +Patch25: libparted-dasd-implicit-partition-disk-flag.patch +Patch26: lib-fs-resize-prevent-crash-resizing-FAT16.patch +Patch27: parted-dont-crash-in-disk_set-when-disk-label-not-found.patch +Patch28: libparted-device-mapper-uses-512b-sectors.patch +Patch29: parted-resize-alias-to-resizepart.patch +Patch30: libparted-avoid-libdevice-mapper-warnings.patch +Patch31: parted-do-not-warn-when-shrinking-in-script-mode.patch Patch100: parted-fatresize-autoconf.patch Requires: /sbin/udevadm BuildRequires: check-devel @@ -128,6 +116,7 @@ to develop applications that require these. %patch15 -p1 %patch16 -p1 %patch17 -p1 +%patch18 -p1 %patch19 -p1 %patch20 -p1 %patch21 -p1 @@ -141,17 +130,6 @@ to develop applications that require these. %patch29 -p1 %patch30 -p1 %patch31 -p1 -%patch32 -p1 -%patch33 -p1 -%patch34 -p1 -%patch35 -p1 -%patch36 -p1 -%patch37 -p1 -%patch38 -p1 -%patch39 -p1 -%patch40 -p1 -%patch41 -p1 -%patch42 -p1 %patch100 -p1 %build