Accepting request 305458 from Base:System

- 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

- 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

OBS-URL: https://build.opensuse.org/request/show/305458
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/parted?expand=0&rev=106
This commit is contained in:
Dominique Leuenberger 2015-05-06 09:18:22 +00:00 committed by Git OBS Bridge
commit 2d3487dd10
44 changed files with 560 additions and 2857 deletions

View File

@ -1,79 +0,0 @@
From 3e005b4644d2a97da85c251f93d32d93e94bcccf Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
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),

View File

@ -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 <stdio.h>
#include <syscall.h>
#include <unistd.h>
+#include <stdlib.h>
#include <stdbool.h>
#include <dirent.h>
#include <sys/ioctl.h>
@@ -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

View File

@ -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));
}

BIN
fatresize-0.1.tar.bz2 (Stored with Git LFS)

Binary file not shown.

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -0,0 +1,66 @@
From 1e9e770f4bc7f3d80e09ecd1df58575fad064163 Mon Sep 17 00:00:00 2001
From: Mike Fleetwood <mike.fleetwood@googlemail.com>
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;

View File

@ -1,67 +0,0 @@
From 0673dabee6f5b19317b0d85e399e9f876a2c2ea7 Mon Sep 17 00:00:00 2001
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
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 <rnsastry@linux.vnet.ibm.com>
---
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

File diff suppressed because it is too large Load Diff

View File

@ -1,193 +0,0 @@
From f70ff1fc474764c3a71318ddb4e0d26afc52ac47 Mon Sep 17 00:00:00 2001
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
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 <rnsastry@linux.vnet.ibm.com>
Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
---
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;
}
/*

View File

@ -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;

View File

@ -1,22 +0,0 @@
From c261a9b340e2982a49e055ea6332fd0f49f3d531 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
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;
}

View File

@ -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;

View File

@ -0,0 +1,90 @@
From f98f791e19669b900345dad7d96ea4df974e4596 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
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;

View File

@ -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

View File

@ -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:

View File

@ -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)

View File

@ -1,159 +0,0 @@
From 95649fc7d025a68074c8a00581bd24d2bd7751bc Mon Sep 17 00:00:00 2001
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
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 <rnsastry@linux.vnet.ibm.com>
---
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

View File

@ -1,56 +0,0 @@
From bdb439f660344404f27084c48fe7b9429436b9e9 Mon Sep 17 00:00:00 2001
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
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 <rnsastry@linux.vnet.ibm.com>
---
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

View File

@ -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;

View File

@ -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;
}

View File

@ -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,

View File

@ -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)

View File

@ -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=""

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5e9cc1f91eaf016e5033d85b9b893fd6d3ffaca532a48de1082df9b94225ca15
size 1524344

View File

@ -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-----

3
parted-3.2.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:858b589c22297cacdf437f3baff6f04b333087521ab274f7ab677cb8c6bb78e4
size 1655244

11
parted-3.2.tar.xz.sig Normal file
View File

@ -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-----

View File

@ -1,318 +0,0 @@
From e6a23531e0cb40c2cc75f1e8fbb86ab872cb6f1b Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
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:

View File

@ -1,211 +0,0 @@
From d151cc20af79c89383ffacc89c1f646f831fc3e6 Mon Sep 17 00:00:00 2001
From: Daniel Battaiola Kreling <dbkreling@br.ibm.com>
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:

View File

@ -1,167 +0,0 @@
commit 85e5fcd1bb0fe91d8908e8a638e9827979b6feff
Author: Luca Bruno <lucab@debian.org>
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 <lucab@debian.org>
---
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 <http://www.gnu.org/licenses/>.
+*/
+
+#include <config.h>
+
+#include <parted/parted.h>
+#include <parted/endian.h>
+
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(String) dgettext (PACKAGE, String)
+#else
+# define _(String) (String)
+#endif /* ENABLE_NLS */
+
+#include <unistd.h>
+
+#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 ();
}

View File

@ -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,

View File

@ -0,0 +1,39 @@
From 624a8b14af7d358782ecc12627c84da72c28aeff Mon Sep 17 00:00:00 2001
From: Phillip Susi <psusi@ubuntu.com>
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))

View File

@ -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" : "");

View File

@ -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
};

View File

@ -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
}
}

View File

@ -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),

View File

@ -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 (

View File

@ -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;

View File

@ -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;

View File

@ -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)) &&

View File

@ -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

View File

@ -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