Package: parted;
Reported by: "Brian C. Lane" <bcl <at> redhat.com>
Date: Wed, 11 Sep 2013 20:18:03 UTC
Severity: normal
Tags: patch
Done: Phillip Susi <psusi <at> ubuntu.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15356 in the body.
You can then email your comments to 15356 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:18:04 GMT) Full text and rfc822 format available."Brian C. Lane" <bcl <at> redhat.com>
:bug-parted <at> gnu.org
.
(Wed, 11 Sep 2013 20:18:04 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: [PATCH 00/19] Fedora parted patches Date: Wed, 11 Sep 2013 12:24:50 -0700
From: "Brian C. Lane" <bcl <at> redhat.com> Here is the stack of patches that I'm currently carrying for the master branch of parted in Fedora. I think patches 1-12 have been posted before, but I recently rebased things onto parted master. The patches adding new flags (13-16) are all new. Patch 4 is my take on handling the uuid of dm devices. Patch 18 is similar to Phillip's, except that I didn't see any reason to sync all the partition devices since all of our access is via offsets into the parent device so I left the kernel 2.6 check in place. Brian C. Lane (14): libparted: copy pmbr_boot when duplicating GPT disk tests: test creating 20 device-mapper partitions (#803108) libparted: use dm_udev_wait (#698121) libparted: preserve the uuid on dm partitions (#832145) tests: Make sure dm UUIDs are not erased libparted: don't canonicalize /dev/md/ paths (#872361) tests: rewrite t6001 to use /dev/mapper libparted: Add Intel Rapid Start Technology partition flag. libparted: Add UEFI System Partition flag. libparted: Add hfs_esp partition flag to GPT. libparted: Recognize btrfs filesystem tests: Add btrfs and xfs to the fs probe test libparted: Flush parent device on open (#962611) tests: Restrict gpt-header-munge to little-endian systems Nageswara R Sastry (5): libparted: add support for implicit FBA DASD partitions libparted: add support for EAV DASD partitions libparted: mklabel to support EAV DASD libparted: Avoid dasd as default disk type while probe libparted: mklabel to support EDEV DASD NEWS | 18 ++ doc/C/parted.8 | 2 +- doc/parted.texi | 13 + include/parted/disk.in.h | 7 +- include/parted/fdasd.in.h | 93 +++++- include/parted/vtoc.in.h | 59 +++- libparted/arch/linux.c | 74 +++-- libparted/device.c | 7 +- libparted/disk.c | 6 + libparted/fs/Makefile.am | 1 + libparted/fs/btrfs/btrfs.c | 78 +++++ libparted/labels/dasd.c | 64 +++- libparted/labels/dos.c | 42 +++ libparted/labels/fdasd.c | 353 +++++++++++++++++------ libparted/labels/gpt.c | 84 ++++++ libparted/labels/vtoc.c | 173 +++++++++-- libparted/libparted.c | 4 + tests/Makefile.am | 2 + tests/t0210-gpt-resized-partition-entry-array.sh | 5 + tests/t0211-gpt-rewrite-header.sh | 5 + tests/t1700-probe-fs.sh | 2 +- tests/t6001-psep.sh | 42 ++- tests/t6004-dm-many-partitions.sh | 60 ++++ tests/t6005-dm-uuid.sh | 58 ++++ 24 files changed, 1061 insertions(+), 191 deletions(-) create mode 100644 libparted/fs/btrfs/btrfs.c create mode 100755 tests/t6004-dm-many-partitions.sh create mode 100755 tests/t6005-dm-uuid.sh -- 1.8.3.1
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:19:01 GMT) Full text and rfc822 format available.Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: [PATCH 08/19] libparted: mklabel to support EAV DASD Date: Wed, 11 Sep 2013 12:24:58 -0700
From: Nageswara R Sastry <rnsastry <at> linux.vnet.ibm.com> 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 <at> 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.3.1
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:19:02 GMT) Full text and rfc822 format available.Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: [PATCH 03/19] libparted: use dm_udev_wait (#698121) Date: Wed, 11 Sep 2013 12:24:53 -0700
From: "Brian C. Lane" <bcl <at> redhat.com> This is based on Peter Rajnoha's patch to use dm_udev_wait to synchronize with udev. This requires libdevmapper v1.02.39 and higher. mailing list thread: https://lists.gnu.org/archive/html/bug-parted/2010-09/msg00007.html * libparted/arch/linux.c (_dm_task_run_wait): New function (_is_dm_major): Add cookie and change call to _dm_task_run_wait (_is_dmraid_device): Same (_dm_is_part): Same (dm_canonical_path): Same (_dm_remove_partition): Same (_dm_get_partition_start_and_length): Same (_dm_add_partition): Same (linux_new): Enable udev sync support --- libparted/arch/linux.c | 52 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c index 2bb8774..1c5faa5 100644 --- a/libparted/arch/linux.c +++ b/libparted/arch/linux.c @@ -438,6 +438,17 @@ _is_virtblk_major (int major) #ifdef ENABLE_DEVICE_MAPPER static int +_dm_task_run_wait (struct dm_task *task, uint32_t cookie) +{ + int rc = 0; + + rc = dm_task_run (task); + dm_udev_wait (cookie); + + return rc; +} + +static int _is_dm_major (int major) { return _major_type_in_devices (major, "device-mapper"); @@ -466,7 +477,7 @@ _dm_maptype (PedDevice *dev) dm_task_no_open_count(dmt); - if (!dm_task_run(dmt)) + if (!dm_task_run (dmt)) goto bad; dm_get_next_target(dmt, NULL, &start, &length, &target_type, ¶ms); @@ -519,7 +530,7 @@ _dm_is_part (const char *path) return 0; dm_task_set_name(task, path); - if (!dm_task_run(task)) + if (!dm_task_run (task)) goto err; struct dm_info *info = alloca (sizeof *info); @@ -1398,6 +1409,10 @@ linux_new (const char* path) dev->dirty = 0; dev->boot_dirty = 0; +#ifdef ENABLE_DEVICE_MAPPER + dm_udev_set_sync_support(1); +#endif + if (!_device_probe_type (dev)) goto error_free_arch_specific; @@ -2316,7 +2331,7 @@ dm_canonical_path (PedDevice const *dev) if (!dm_task_set_major_minor (task, arch_specific->major, arch_specific->minor, 0)) goto err; - if (!dm_task_run(task)) + if (!dm_task_run (task)) goto err; char *dev_name = zasprintf ("/dev/mapper/%s", dm_task_get_name (task)); if (dev_name == NULL) @@ -2637,31 +2652,29 @@ _device_get_partition_range(PedDevice const* dev) static int _dm_remove_partition(PedDisk* disk, int partno) { - int rc; + int rc = 0; + uint32_t cookie = 0; char *part_name = _device_get_part_path (disk->dev, partno); int fd = open (part_name, O_RDONLY | O_EXCL); if (fd == -1) { if (errno == ENOENT) errno = ENXIO; /* nothing to remove, device already doesn't exist */ - free (part_name); - return 0; + goto err; } close (fd); struct dm_task *task = dm_task_create(DM_DEVICE_REMOVE); - if (!task) { - free (part_name); - return 0; - } + if (!task) + goto err; dm_task_set_name (task, part_name); - rc = dm_task_run(task); + if (!dm_task_set_cookie (task, &cookie, 0)) + goto err; + rc = _dm_task_run_wait (task, cookie); dm_task_update_nodes(); dm_task_destroy(task); +err: free (part_name); - if (!rc) - return 0; - - return 1; + return rc; } static bool @@ -2677,7 +2690,7 @@ _dm_get_partition_start_and_length(PedPartition const *part, char *path = _device_get_part_path (part->disk->dev, part->num); PED_ASSERT(path); dm_task_set_name(task, path); - if (!dm_task_run(task)) + if (!dm_task_run (task)) goto err; int major, minor; @@ -2700,6 +2713,7 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part) LinuxSpecific* arch_specific = LINUX_SPECIFIC (disk->dev); char *params = NULL; char *vol_name = NULL; + uint32_t cookie = 0; /* Get map name from devicemapper */ struct dm_task *task = dm_task_create (DM_DEVICE_INFO); @@ -2710,7 +2724,7 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part) arch_specific->minor, 0)) goto err; - if (!dm_task_run(task)) + if (!dm_task_run (task)) goto err; const char *dev_name = dm_task_get_name (task); @@ -2736,7 +2750,9 @@ _dm_add_partition (PedDisk* disk, const PedPartition* part) dm_task_set_name (task, vol_name); dm_task_add_target (task, 0, part->geom.length, "linear", params); - if (dm_task_run (task)) { + if (!dm_task_set_cookie (task, &cookie, 0)) + goto err; + if (_dm_task_run_wait (task, cookie)) { dm_task_update_nodes (); dm_task_destroy (task); free (params); -- 1.8.3.1
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:20:02 GMT) Full text and rfc822 format available.Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: [PATCH 16/19] libparted: Recognize btrfs filesystem Date: Wed, 11 Sep 2013 12:25:06 -0700
From: "Brian C. Lane" <bcl <at> redhat.com> Add support for showing 'btrfs' in the 'file system' column. Also allows the used to enter btrfs as the fs type. It doesn't really do anything -- just sets the partition type to linux. * NEWS (Changes in behavior): Mention it. * doc/parted.texti: Document btrfs fs. * (libparted/fs/Makefile.am): Add btrfs.c * (libparted/fs/btrfs/btrfs.c): Probe for btrfs * (libparted/libparted.c): Register btrfs --- NEWS | 3 ++ doc/parted.texi | 1 + libparted/fs/Makefile.am | 1 + libparted/fs/btrfs/btrfs.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++ libparted/libparted.c | 4 +++ 5 files changed, 87 insertions(+) create mode 100644 libparted/fs/btrfs/btrfs.c diff --git a/NEWS b/NEWS index 026e897..df259d6 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,9 @@ GNU parted NEWS -*- outline -*- ** Changes in behavior + Added support for recognizing btrfs filesystem. This simply displays + btrfs in the 'file system' column of the parted output. + Added new GPT partition type flag, hfs_esp, that sets the GUID to 47CB5633-7E3E-408B-B7B8-2D915B7B21B1 so that you can distinguish between OSX's native HFS+ partition and one used Linux on UEFI. The diff --git a/doc/parted.texi b/doc/parted.texi index ee5b3f7..03522e7 100644 --- a/doc/parted.texi +++ b/doc/parted.texi @@ -575,6 +575,7 @@ partition table. @item NTFS @item reiserfs @item ufs +@item btrfs @end itemize For example, the following creates a logical partition that will contain diff --git a/libparted/fs/Makefile.am b/libparted/fs/Makefile.am index aac03cc..1949617 100644 --- a/libparted/fs/Makefile.am +++ b/libparted/fs/Makefile.am @@ -23,6 +23,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 \ diff --git a/libparted/fs/btrfs/btrfs.c b/libparted/fs/btrfs/btrfs.c new file mode 100644 index 0000000..e5abed6 --- /dev/null +++ b/libparted/fs/btrfs/btrfs.c @@ -0,0 +1,78 @@ +/* + libparted - a library for manipulating disk partitions + Copyright (C) 2013 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> + +/* Located 64k inside the partition (start of the first btrfs superblock) */ +#define BTRFS_MAGIC 0x4D5F53665248425FULL /* ascii _BHRfS_M, no null */ +#define BTRFS_CSUM_SIZE 32 +#define BTRFS_FSID_SIZE 16 + + +static PedGeometry* +btrfs_probe (PedGeometry* geom) +{ + union { + struct { + /* Just enough of the btrfs_super_block to get the magic */ + uint8_t csum[BTRFS_CSUM_SIZE]; + uint8_t fsid[BTRFS_FSID_SIZE]; + uint64_t bytenr; + uint64_t flags; + uint64_t magic; + } sb; + int8_t sector[8192]; + } buf; + PedSector offset = (64*1024)/geom->dev->sector_size; + + if (geom->length < offset+1) + return 0; + if (!ped_geometry_read (geom, &buf, offset, 1)) + return 0; + + if (PED_LE64_TO_CPU(buf.sb.magic) == BTRFS_MAGIC) { + return ped_geometry_new (geom->dev, geom->start, geom->length); + } + return NULL; +} + +static PedFileSystemOps btrfs_ops = { + probe: btrfs_probe, +}; + +static PedFileSystemType btrfs_type = { + next: NULL, + ops: &btrfs_ops, + name: "btrfs", + block_sizes: ((int[2]){512, 0}) +}; + +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); +} diff --git a/libparted/libparted.c b/libparted/libparted.c index 9923bfa..3afbf8e 100644 --- a/libparted/libparted.c +++ b/libparted/libparted.c @@ -109,6 +109,7 @@ extern void ped_file_system_hfs_init (void); 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 (); @@ -186,6 +188,7 @@ 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_amiga_done (void); +extern void ped_file_system_btrfs_done (void); static void done_file_system_types () @@ -201,6 +204,7 @@ done_file_system_types () ped_file_system_ufs_done (); ped_file_system_xfs_done (); ped_file_system_amiga_done (); + ped_file_system_btrfs_done (); } static void _done() __attribute__ ((destructor)); -- 1.8.3.1
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:20:03 GMT) Full text and rfc822 format available.Message #17 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: [PATCH 06/19] libparted: add support for implicit FBA DASD partitions Date: Wed, 11 Sep 2013 12:24:56 -0700
From: Nageswara R Sastry <rnsastry <at> linux.vnet.ibm.com> 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 <at> linux.vnet.ibm.com> Signed-off-by: Peter Oberparleiter <oberpar <at> 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(-) diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h index ac30134..a755246 100644 --- a/include/parted/fdasd.in.h +++ b/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}; diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c index a769866..b4e80b1 100644 --- a/libparted/labels/dasd.c +++ b/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; @@ -923,7 +963,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) @@ -943,7 +988,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, diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c index e235dd3..f92065f 100644 --- a/libparted/labels/fdasd.c +++ b/libparted/labels/fdasd.c @@ -721,6 +721,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd) 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, fdasd_anchor_t *anc, int f) 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, fdasd_anchor_t *anc, int f) 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; } /* -- 1.8.3.1
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:20:04 GMT) Full text and rfc822 format available.Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: [PATCH 14/19] libparted: Add UEFI System Partition flag. Date: Wed, 11 Sep 2013 12:25:04 -0700
From: "Brian C. Lane" <bcl <at> redhat.com> This adds support for the ESP partition type on MS-DOS. It also aliases it to the boot flag on GPT which sets the ESP GUID type. * NEWS (Changes in behavior): Mention it. * doc/C/parted.8: Document esp flag. * doc/parted.texti: Document esp flag. * include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_ESP flag * libparted/disk.c (ped_partition_flag_get_name): Add esp flag * libparted/labels/dos.c (DosPartitionData): Likewise (raw_part_parse): Likewise (msdos_partition_new): Likewise (msdos_partition_duplicate): Likewise (msdos_partition_set_system): Likewise (clear_flags): Likewise (msdos_partition_set_flag): Likewise (msdos_partition_get_flag): Likewise (msdos_partition_is_flag_available): Likewise * libparted/labels/gpt.c (gpt_partition_set_flag): Add PED_PARTITION_ESP (gpt_partition_get_flag): Likewise (gpt_partition_is_flag_available): Likewise --- NEWS | 3 +++ doc/C/parted.8 | 2 +- doc/parted.texi | 4 ++++ include/parted/disk.in.h | 5 +++-- libparted/disk.c | 2 ++ libparted/labels/dos.c | 21 +++++++++++++++++++++ libparted/labels/gpt.c | 3 +++ 7 files changed, 37 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index b53a9d0..541ea1c 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,9 @@ GNU parted NEWS -*- outline -*- ** Changes in behavior + 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. + Added new partition type flag, irst, for use with Intel Rapid Start Technology. On MS-DOS disk labels it sets the type to 0x84 and on GPT it sets the GUID to D3BFE2DE-3DAF-11DF-BA-40-E3A556D89593. diff --git a/doc/C/parted.8 b/doc/C/parted.8 index 2f8e9f5..f8e6a3d 100644 --- a/doc/C/parted.8 +++ b/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", "irst" and "palo". +"legacy_boot", "irst", "esp" and "palo". \fIstate\fP should be either "on" or "off". .TP .B unit \fIunit\fP diff --git a/doc/parted.texi b/doc/parted.texi index fd8ccb9..a5effd5 100644 --- a/doc/parted.texi +++ b/doc/parted.texi @@ -840,6 +840,10 @@ filesystems). (MS-DOS, GPT) - this flag identifies an Intel Rapid Start Technology partition. +@item esp +(MS-DOS, GPT) - this flag identifies a UEFI System Partition. On GPT +it is an alias for boot. + @item lba (MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and MS Windows ME based operating systems to use Linear (LBA) mode. diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h index 585383d..d144e21 100644 --- a/include/parted/disk.in.h +++ b/include/parted/disk.in.h @@ -74,10 +74,11 @@ enum _PedPartitionFlag { PED_PARTITION_DIAG=14, PED_PARTITION_LEGACY_BOOT=15, PED_PARTITION_MSFT_DATA=16, - PED_PARTITION_IRST=17 + PED_PARTITION_IRST=17, + PED_PARTITION_ESP=18 }; #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT -#define PED_PARTITION_LAST_FLAG PED_PARTITION_IRST +#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP enum _PedDiskTypeFeature { PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ diff --git a/libparted/disk.c b/libparted/disk.c index 4ca7255..c22b2a2 100644 --- a/libparted/disk.c +++ b/libparted/disk.c @@ -2443,6 +2443,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) return N_("legacy_boot"); case PED_PARTITION_IRST: return N_("irst"); + case PED_PARTITION_ESP: + return N_("esp"); default: ped_exception_throw ( diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c index f8591ff..fc7292a 100644 --- a/libparted/labels/dos.c +++ b/libparted/labels/dos.c @@ -92,6 +92,7 @@ static const char MBR_BOOT_CODE[] = { #define PARTITION_SUN_UFS 0xbf #define PARTITION_DELL_DIAG 0xde #define PARTITION_GPT 0xee +#define PARTITION_ESP 0xef #define PARTITION_PALO 0xf0 #define PARTITION_PREP 0x41 #define PARTITION_LINUX_RAID 0xfd @@ -161,6 +162,7 @@ typedef struct { int prep; int diag; int irst; + int esp; OrigState* orig; /* used for CHS stuff */ } DosPartitionData; @@ -927,6 +929,7 @@ raw_part_parse (const PedDisk* disk, const DosRawPartition* 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->esp = raw_part->type == PARTITION_ESP; dos_data->orig = ped_malloc (sizeof (OrigState)); if (!dos_data->orig) { ped_partition_destroy (part); @@ -1330,6 +1333,7 @@ msdos_partition_new (const PedDisk* disk, PedPartitionType part_type, dos_data->palo = 0; dos_data->prep = 0; dos_data->irst = 0; + dos_data->esp = 0; } else { part->disk_specific = NULL; } @@ -1366,6 +1370,7 @@ msdos_partition_duplicate (const PedPartition* part) new_dos_data->palo = old_dos_data->palo; new_dos_data->prep = old_dos_data->prep; new_dos_data->irst = old_dos_data->irst; + new_dos_data->esp = old_dos_data->esp; if (old_dos_data->orig) { new_dos_data->orig = ped_malloc (sizeof (OrigState)); @@ -1415,6 +1420,7 @@ msdos_partition_set_system (PedPartition* part, dos_data->palo = 0; dos_data->prep = 0; dos_data->irst = 0; + dos_data->esp = 0; if (dos_data->lba) dos_data->system = PARTITION_EXT_LBA; else @@ -1451,6 +1457,10 @@ msdos_partition_set_system (PedPartition* part, dos_data->system = PARTITION_IRST; return 1; } + if (dos_data->esp) { + dos_data->system = PARTITION_ESP; + return 1; + } if (!fs_type) dos_data->system = PARTITION_LINUX; @@ -1488,6 +1498,7 @@ clear_flags (DosPartitionData *dos_data) dos_data->palo = 0; dos_data->prep = 0; dos_data->irst = 0; + dos_data->esp = 0; dos_data->raid = 0; } @@ -1572,6 +1583,12 @@ msdos_partition_set_flag (PedPartition* part, dos_data->irst = state; return ped_partition_set_system (part, part->fs_type); + case PED_PARTITION_ESP: + if (state) + clear_flags (dos_data); + dos_data->esp = state; + return ped_partition_set_system (part, part->fs_type); + default: return 0; } @@ -1617,6 +1634,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) case PED_PARTITION_IRST: return dos_data->irst; + case PED_PARTITION_ESP: + return dos_data->esp; + default: return 0; } @@ -1640,6 +1660,7 @@ msdos_partition_is_flag_available (const PedPartition* part, case PED_PARTITION_PALO: case PED_PARTITION_PREP: case PED_PARTITION_IRST: + case PED_PARTITION_ESP: case PED_PARTITION_DIAG: return 1; diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 0b7d08b..64b92b4 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -1592,6 +1592,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) switch (flag) { + case PED_PARTITION_ESP: case PED_PARTITION_BOOT: gpt_part_data->boot = state; if (state) @@ -1754,6 +1755,7 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) return gpt_part_data->raid; case PED_PARTITION_LVM: return gpt_part_data->lvm; + case PED_PARTITION_ESP: case PED_PARTITION_BOOT: return gpt_part_data->boot; case PED_PARTITION_BIOS_GRUB: @@ -1801,6 +1803,7 @@ gpt_partition_is_flag_available (const PedPartition *part, case PED_PARTITION_HIDDEN: case PED_PARTITION_LEGACY_BOOT: case PED_PARTITION_IRST: + case PED_PARTITION_ESP: return 1; case PED_PARTITION_SWAP: case PED_PARTITION_ROOT: -- 1.8.3.1
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:21:01 GMT) Full text and rfc822 format available.Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: [PATCH 15/19] libparted: Add hfs_esp partition flag to GPT. Date: Wed, 11 Sep 2013 12:25:05 -0700
From: "Brian C. Lane" <bcl <at> redhat.com> Mac uses a HFS+ formatted partition for ESP. When dual booting with Linux we need a way to differentiate between the Mac partition and the one created by Linux which contains just enough stuff to fake OSX into displaying a nice logo and allowing it to be selected for boot. I generated a GUID (47CB5633-7E3E-408B-B7B8-2D915B7B21B1) and added a new flag to control it. * NEWS (Changes in behavior): Mention it. * doc/C/parted.8: Document hfs_esp flag. * doc/parted.texti: Document hfs_esp flag. * include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_HFS_ESP flag * libparted/disk.c (ped_partition_flag_get_name): Add hfs_esp flag * libparted/labels/gpt.c: Add PARTITION_HFS_ESP_GUID (GPTPartitionData): Add hfs_esp flag (_parse_part_entry): Likewise (gpt_partition_new): Likewise (gpt_partition_set_system): Set PARTITION_HFS_ESP_GUID (gpt_partition_set_flag): Add hfs_esp and PED_PARTITION_HFS_ESP (gpt_partition_get_flag): Likewise (gpt_partition_is_flag_available): Likewise --- NEWS | 8 ++++++++ doc/C/parted.8 | 2 +- doc/parted.texi | 4 ++++ include/parted/disk.in.h | 5 +++-- libparted/disk.c | 2 ++ libparted/labels/gpt.c | 41 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 59 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 541ea1c..026e897 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,14 @@ GNU parted NEWS -*- outline -*- ** Changes in behavior + Added new GPT partition type flag, hfs_esp, that sets the GUID to + 47CB5633-7E3E-408B-B7B8-2D915B7B21B1 so that you can distinguish + between OSX's native HFS+ partition and one used Linux on UEFI. The + way Mac handles UEFI is unique, it only uses the standard ESP for + firmware updates and needs a HFS+ formatted partition for UEFI. This + GUID will allow dual booting Linux systems to determine the correct + partition to use when upgrading or re-installing systems. + 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. diff --git a/doc/C/parted.8 b/doc/C/parted.8 index f8e6a3d..ccbfd18 100644 --- a/doc/C/parted.8 +++ b/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", "irst", "esp" and "palo". +"legacy_boot", "irst", "esp", "hfs_esp" and "palo". \fIstate\fP should be either "on" or "off". .TP .B unit \fIunit\fP diff --git a/doc/parted.texi b/doc/parted.texi index a5effd5..ee5b3f7 100644 --- a/doc/parted.texi +++ b/doc/parted.texi @@ -844,6 +844,10 @@ partition. (MS-DOS, GPT) - this flag identifies a UEFI System Partition. On GPT it is an alias for boot. +@item hfs_esp +(GPT) - this flag identifies a special UEFI HFS+ ESP for use with Mac +hardware. + @item lba (MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and MS Windows ME based operating systems to use Linear (LBA) mode. diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h index d144e21..c34c294 100644 --- a/include/parted/disk.in.h +++ b/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_HFS_ESP=19 }; #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT -#define PED_PARTITION_LAST_FLAG PED_PARTITION_ESP +#define PED_PARTITION_LAST_FLAG PED_PARTITION_HFS_ESP enum _PedDiskTypeFeature { PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ diff --git a/libparted/disk.c b/libparted/disk.c index c22b2a2..7d24f74 100644 --- a/libparted/disk.c +++ b/libparted/disk.c @@ -2445,6 +2445,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) return N_("irst"); case PED_PARTITION_ESP: return N_("esp"); + case PED_PARTITION_HFS_ESP: + return N_("hfs_esp"); default: ped_exception_throw ( diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 64b92b4..c72573c 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -150,6 +150,10 @@ typedef struct ((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 }}) +#define PARTITION_HFS_ESP_GUID \ + ((efi_guid_t) { PED_CPU_TO_LE32 (0x47CB5633), PED_CPU_TO_LE16 (0x7E3E), \ + PED_CPU_TO_LE16 (0x408B), 0xB7, 0xB8, \ + { 0x2D, 0x91, 0x5B, 0x7B, 0x21, 0xB1 }}) struct __attribute__ ((packed)) _GuidPartitionTableHeader_t { @@ -293,6 +297,7 @@ typedef struct _GPTPartitionData int msftrecv; int legacy_boot; int irst; + int hfs_esp; } GPTPartitionData; static PedDiskType gpt_disk_type; @@ -803,6 +808,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) = gpt_part_data->msftrecv = gpt_part_data->legacy_boot = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; if (pte->Attributes.RequiredToFunction & 0x1) @@ -830,6 +836,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) gpt_part_data->atvrecv = 1; else if (!guid_cmp (gpt_part_data->type, PARTITION_IRST_GUID)) gpt_part_data->irst = 1; + else if (!guid_cmp (gpt_part_data->type, PARTITION_HFS_ESP_GUID)) + gpt_part_data->hfs_esp = 1; return part; } @@ -1348,6 +1356,7 @@ gpt_partition_new (const PedDisk *disk, gpt_part_data->atvrecv = 0; gpt_part_data->legacy_boot = 0; gpt_part_data->irst = 0; + gpt_part_data->hfs_esp = 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); @@ -1461,6 +1470,11 @@ gpt_partition_set_system (PedPartition *part, gpt_part_data->type = PARTITION_IRST_GUID; return 1; } + if (gpt_part_data->hfs_esp) + { + gpt_part_data->type = PARTITION_HFS_ESP_GUID; + return 1; + } if (fs_type) { @@ -1604,6 +1618,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_BIOS_GRUB: @@ -1617,6 +1632,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_RAID: @@ -1630,6 +1646,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_LVM: @@ -1643,6 +1660,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_HPSERVICE: @@ -1656,6 +1674,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_MSFT_RESERVED: @@ -1669,6 +1688,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftrecv = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_MSFT_DATA: @@ -1682,6 +1702,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftres = gpt_part_data->msftrecv = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->atvrecv = 0; gpt_part_data->msftdata = 1; } else { @@ -1699,6 +1720,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftdata = gpt_part_data->msftres = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->atvrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_APPLE_TV_RECOVERY: @@ -1712,6 +1734,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftres = gpt_part_data->msftdata = gpt_part_data->irst + = gpt_part_data->hfs_esp = gpt_part_data->msftrecv = 0; return gpt_partition_set_system (part, part->fs_type); case PED_PARTITION_IRST: @@ -1725,6 +1748,21 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftres = gpt_part_data->msftdata = gpt_part_data->msftrecv + = gpt_part_data->hfs_esp + = gpt_part_data->atvrecv = 0; + return gpt_partition_set_system (part, part->fs_type); + case PED_PARTITION_HFS_ESP: + gpt_part_data->hfs_esp = 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->msftdata + = 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_HIDDEN: @@ -1776,6 +1814,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) return gpt_part_data->legacy_boot; case PED_PARTITION_IRST: return gpt_part_data->irst; + case PED_PARTITION_HFS_ESP: + return gpt_part_data->hfs_esp; case PED_PARTITION_SWAP: case PED_PARTITION_LBA: case PED_PARTITION_ROOT: @@ -1804,6 +1844,7 @@ gpt_partition_is_flag_available (const PedPartition *part, case PED_PARTITION_LEGACY_BOOT: case PED_PARTITION_IRST: case PED_PARTITION_ESP: + case PED_PARTITION_HFS_ESP: return 1; case PED_PARTITION_SWAP: case PED_PARTITION_ROOT: -- 1.8.3.1
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:21:02 GMT) Full text and rfc822 format available.Message #26 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: [PATCH 13/19] libparted: Add Intel Rapid Start Technology partition flag. Date: Wed, 11 Sep 2013 12:25:03 -0700
From: "Brian C. Lane" <bcl <at> redhat.com> 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. * NEWS (Changes in behavior): Mention it. * doc/C/parted.8: Document irst flag. * doc/parted.texti: Document irst flag. * include/parted/disk.in.h (_PedPartitionFlag): Add PED_PARTITION_IRST flag * libparted/disk.c (ped_partition_flag_get_name): Add irst flag * libparted/labels/dos.c (DosPartitionData): Likewise (raw_part_parse): Likewise (msdos_partition_new): Likewise (msdos_partition_duplicate): Likewise (msdos_partition_set_system): Likewise (clear_flags): Likewise (msdos_partition_set_flag): Likewise (msdos_partition_get_flag): Likewise (msdos_partition_is_flag_available): Likewise * libparted/labels/gpt.c: Add PARTITION_IRST_GUID (GPTPartitionData): Add irst flag (_parse_part_entry): Likewise (gpt_partition_new): Likewise (gpt_partition_set_system): Likewise (gpt_partition_set_flag): Likewise (gpt_partition_get_flag): Likewise (gpt_partition_is_flag_available): Likewise --- NEWS | 4 ++++ doc/C/parted.8 | 2 +- doc/parted.texi | 4 ++++ include/parted/disk.in.h | 5 +++-- libparted/disk.c | 2 ++ libparted/labels/dos.c | 21 +++++++++++++++++++++ libparted/labels/gpt.c | 39 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 74 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 98f7c6e..b53a9d0 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,10 @@ GNU parted NEWS -*- outline -*- ** Changes in behavior + Added new partition type flag, irst, for use with Intel Rapid Start + Technology. On MS-DOS disk labels it sets the type to 0x84 and on GPT + it sets the GUID to D3BFE2DE-3DAF-11DF-BA-40-E3A556D89593. + parted -l no longer lists device-mapper devices other than dmraid whole disks. diff --git a/doc/C/parted.8 b/doc/C/parted.8 index a9f73f5..2f8e9f5 100644 --- a/doc/C/parted.8 +++ b/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 diff --git a/doc/parted.texi b/doc/parted.texi index 008c383..fd8ccb9 100644 --- a/doc/parted.texi +++ b/doc/parted.texi @@ -836,6 +836,10 @@ used by Windows on GPT disks. Note that this flag should not normally be set on Windows filesystem partitions (those that contain NTFS or FAT filesystems). +@item irst +(MS-DOS, GPT) - this flag identifies an Intel Rapid Start Technology +partition. + @item lba (MS-DOS) - this flag can be enabled to tell MS DOS, MS Windows 9x and MS Windows ME based operating systems to use Linear (LBA) mode. diff --git a/include/parted/disk.in.h b/include/parted/disk.in.h index aa905c5..585383d 100644 --- a/include/parted/disk.in.h +++ b/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_MSFT_DATA=16 + PED_PARTITION_MSFT_DATA=16, + PED_PARTITION_IRST=17 }; #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT -#define PED_PARTITION_LAST_FLAG PED_PARTITION_MSFT_DATA +#define PED_PARTITION_LAST_FLAG PED_PARTITION_IRST enum _PedDiskTypeFeature { PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ diff --git a/libparted/disk.c b/libparted/disk.c index d3cd5bb..4ca7255 100644 --- a/libparted/disk.c +++ b/libparted/disk.c @@ -2441,6 +2441,8 @@ ped_partition_flag_get_name (PedPartitionFlag flag) return N_("diag"); case PED_PARTITION_LEGACY_BOOT: return N_("legacy_boot"); + case PED_PARTITION_IRST: + return N_("irst"); default: ped_exception_throw ( diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c index b8c161f..f8591ff 100644 --- a/libparted/labels/dos.c +++ b/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, const DosRawPartition* raw_part, 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); @@ -1326,6 +1329,7 @@ msdos_partition_new (const PedDisk* disk, PedPartitionType part_type, dos_data->lba = 0; dos_data->palo = 0; dos_data->prep = 0; + dos_data->irst = 0; } else { part->disk_specific = NULL; } @@ -1361,6 +1365,7 @@ msdos_partition_duplicate (const PedPartition* part) 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)); @@ -1409,6 +1414,7 @@ msdos_partition_set_system (PedPartition* part, 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 @@ -1441,6 +1447,10 @@ msdos_partition_set_system (PedPartition* part, 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; @@ -1477,6 +1487,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; } @@ -1555,6 +1566,12 @@ msdos_partition_set_flag (PedPartition* part, 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; } @@ -1597,6 +1614,9 @@ msdos_partition_get_flag (const PedPartition* part, PedPartitionFlag flag) case PED_PARTITION_PREP: return dos_data->prep; + case PED_PARTITION_IRST: + return dos_data->irst; + default: return 0; } @@ -1619,6 +1639,7 @@ msdos_partition_is_flag_available (const PedPartition* part, case PED_PARTITION_LBA: case PED_PARTITION_PALO: case PED_PARTITION_PREP: + case PED_PARTITION_IRST: case PED_PARTITION_DIAG: return 1; diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c index 25490af..0b7d08b 100644 --- a/libparted/labels/gpt.c +++ b/libparted/labels/gpt.c @@ -146,6 +146,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 { @@ -288,6 +292,7 @@ typedef struct _GPTPartitionData int atvrecv; int msftrecv; int legacy_boot; + int irst; } GPTPartitionData; static PedDiskType gpt_disk_type; @@ -797,6 +802,7 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) = gpt_part_data->msftdata = 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) @@ -822,6 +828,8 @@ _parse_part_entry (PedDisk *disk, GuidPartitionEntry_t *pte) 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; } @@ -1339,6 +1347,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); @@ -1447,6 +1456,11 @@ gpt_partition_set_system (PedPartition *part, 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) { @@ -1588,6 +1602,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftres = gpt_part_data->msftdata = 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: @@ -1600,6 +1615,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftres = gpt_part_data->msftdata = 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: @@ -1612,6 +1628,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftres = gpt_part_data->msftdata = 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: @@ -1624,6 +1641,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftres = gpt_part_data->msftdata = 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: @@ -1636,6 +1654,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->msftres = gpt_part_data->msftdata = 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: @@ -1648,6 +1667,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->hp_service = gpt_part_data->msftdata = 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_DATA: @@ -1660,6 +1680,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->hp_service = gpt_part_data->msftres = gpt_part_data->msftrecv + = gpt_part_data->irst = gpt_part_data->atvrecv = 0; gpt_part_data->msftdata = 1; } else { @@ -1676,6 +1697,7 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->hp_service = gpt_part_data->msftdata = 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: @@ -1688,8 +1710,22 @@ gpt_partition_set_flag (PedPartition *part, PedPartitionFlag flag, int state) = gpt_part_data->hp_service = gpt_part_data->msftres = gpt_part_data->msftdata + = 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->msftdata + = 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; @@ -1736,6 +1772,8 @@ gpt_partition_get_flag (const PedPartition *part, PedPartitionFlag flag) 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: @@ -1762,6 +1800,7 @@ gpt_partition_is_flag_available (const PedPartition *part, 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: -- 1.8.3.1
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:21:03 GMT) Full text and rfc822 format available.Message #29 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: [PATCH 07/19] libparted: add support for EAV DASD partitions Date: Wed, 11 Sep 2013 12:24:57 -0700
From: Nageswara R Sastry <rnsastry <at> linux.vnet.ibm.com> Extended Address Volume (EAV) DASDs are ECKD DASDs with more than 65520 cylinders. This patch adds support for recognizing and modifying partitions on EAV DASDs to Parted. The changes are based on the EAV support added to version 1.8.1 [1] of the s390-tools package. [1] http://www.ibm.com/developerworks/linux/linux390/s390-tools-1.8.1.html Signed-off-by: Nageswara R Sastry <rnsastry <at> linux.vnet.ibm.com> Signed-off-by: Peter Oberparleiter <oberpar <at> linux.vnet.ibm.com> --- include/parted/fdasd.in.h | 89 +++++++++++++++--- include/parted/vtoc.in.h | 59 ++++++++++-- libparted/labels/dasd.c | 1 + libparted/labels/fdasd.c | 226 ++++++++++++++++++++++++++++++++-------------- libparted/labels/vtoc.c | 173 ++++++++++++++++++++++++++++++----- 5 files changed, 436 insertions(+), 112 deletions(-) diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h index a755246..b4e7dd1 100644 --- a/include/parted/fdasd.in.h +++ b/include/parted/fdasd.in.h @@ -74,6 +74,80 @@ typedef struct dasd_information_t { char configuration_data[256]; /* from read_configuration_data */ } dasd_information_t; +struct dasd_eckd_characteristics { + unsigned short cu_type; + struct { + unsigned char support:2; + unsigned char async:1; + unsigned char reserved:1; + unsigned char cache_info:1; + unsigned char model:3; + } __attribute__ ((packed)) cu_model; + unsigned short dev_type; + unsigned char dev_model; + struct { + unsigned char mult_burst:1; + unsigned char RT_in_LR:1; + unsigned char reserved1:1; + unsigned char RD_IN_LR:1; + unsigned char reserved2:4; + unsigned char reserved3:8; + unsigned char defect_wr:1; + unsigned char XRC_supported:1; + unsigned char reserved4:1; + unsigned char striping:1; + unsigned char reserved5:4; + unsigned char cfw:1; + unsigned char reserved6:2; + unsigned char cache:1; + unsigned char dual_copy:1; + unsigned char dfw:1; + unsigned char reset_alleg:1; + unsigned char sense_down:1; + } __attribute__ ((packed)) facilities; + unsigned char dev_class; + unsigned char unit_type; + unsigned short no_cyl; + unsigned short trk_per_cyl; + unsigned char sec_per_trk; + unsigned char byte_per_track[3]; + unsigned short home_bytes; + unsigned char formula; + union { + struct { + unsigned char f1; + unsigned short f2; + unsigned short f3; + } __attribute__ ((packed)) f_0x01; + struct { + unsigned char f1; + unsigned char f2; + unsigned char f3; + unsigned char f4; + unsigned char f5; + } __attribute__ ((packed)) f_0x02; + } __attribute__ ((packed)) factors; + unsigned short first_alt_trk; + unsigned short no_alt_trk; + unsigned short first_dia_trk; + unsigned short no_dia_trk; + unsigned short first_sup_trk; + unsigned short no_sup_trk; + unsigned char MDR_ID; + unsigned char OBR_ID; + unsigned char director; + unsigned char rd_trk_set; + unsigned short max_rec_zero; + unsigned char reserved1; + unsigned char RWANY_in_LR; + unsigned char factor6; + unsigned char factor7; + unsigned char factor8; + unsigned char reserved2[3]; + unsigned char reserved3[6]; + unsigned int long_no_cyl; +} __attribute__ ((packed)); + /* * struct format_data_t * represents all data necessary to format a dasd @@ -116,18 +190,6 @@ typedef struct format_data_t { #define BLKRRPART _IO(0x12,95) /* get block device sector size */ #define BLKSSZGET _IO(0x12,104) - -/***************************************************************************** - * SECTION: Definition from hdreq.h * - *****************************************************************************/ - -struct fdasd_hd_geometry { - unsigned char heads; - unsigned char sectors; - unsigned short cylinders; - unsigned long start; -}; - /* get device geometry */ #define HDIO_GETGEO 0x0301 @@ -189,10 +251,13 @@ typedef struct fdasd_anchor { format4_label_t *f4; format5_label_t *f5; format7_label_t *f7; + format9_label_t *f9; /* template for all f9 labels */ partition_info_t *first; partition_info_t *last; volume_label_t *vlabel; config_data_t confdata[USABLE_PARTITIONS]; + u_int32_t hw_cylinders; + u_int32_t formatted_cylinders; struct fdasd_hd_geometry geo; unsigned int label_block; unsigned int FBA_layout; diff --git a/include/parted/vtoc.in.h b/include/parted/vtoc.in.h index d79ce39..499c2d3 100644 --- a/include/parted/vtoc.in.h +++ b/include/parted/vtoc.in.h @@ -42,6 +42,18 @@ #define VOLSER_LENGTH 6 #define BIG_DISK_SIZE 0x10000 +#define LV_COMPAT_CYL 0xFFFE + +/***************************************************************************** + * SECTION: Definition from hdreq.h * + *****************************************************************************/ + +struct fdasd_hd_geometry { + unsigned char heads; + unsigned char sectors; + unsigned short cylinders; + unsigned long start; +}; typedef struct ttr ttr_t; @@ -59,6 +71,7 @@ typedef struct ds5ext ds5ext_t; typedef struct format5_label format5_label_t; typedef struct ds7ext ds7ext_t; typedef struct format7_label format7_label_t; +typedef struct format9_label format9_label_t; struct __attribute__ ((packed)) ttr { u_int16_t tt; @@ -169,6 +182,10 @@ struct __attribute__ ((packed)) dev_const { u_int8_t DS4DEVDB; /* number of directory blocks per track */ }; +/* + * format 1 and format 8 label have the same layout so we use the following + * structure for both. + */ struct __attribute__ ((packed)) format1_label { char DS1DSNAM[44]; /* data set name */ u_int8_t DS1FMTID; /* format identifier */ @@ -229,7 +246,11 @@ struct __attribute__ ((packed)) format4_label { char res2[10]; /* reserved */ u_int8_t DS4EFLVL; /* extended free-space management level */ cchhb_t DS4EFPTR; /* pointer to extended free-space info */ - char res3[9]; /* reserved */ + char res3; /* reserved */ + u_int32_t DS4DCYL; /* number of logical cyls */ + char res4[2]; /* reserved */ + u_int8_t DS4DEVF2; /* device flags */ + char res5; /* reserved */ }; struct __attribute__ ((packed)) ds5ext { @@ -261,12 +282,28 @@ struct __attribute__ ((packed)) format7_label { cchhb_t DS7PTRDS; /* pointer to next FMT7 DSCB */ }; +struct __attribute__ ((packed)) format9_label { + u_int8_t DS9KEYID; /* key code for format 9 labels (0x09) */ + u_int8_t DS9SUBTY; /* subtype (0x01) */ + u_int8_t DS9NUMF9; /* number of F9 datasets */ + u_int8_t res1[41]; /* reserved */ + u_int8_t DS9FMTID; /* format identifier */ + u_int8_t res2[95]; /* reserved */ +}; + char *vtoc_ebcdic_enc (char const *source, char *target, int l); char *vtoc_ebcdic_dec (char const *source, char *target, int l); void vtoc_set_extent (extent_t *ext, u_int8_t typeind, u_int8_t seqno, cchh_t *lower, cchh_t *upper); -void vtoc_set_cchh (cchh_t *addr, u_int16_t cc, u_int16_t hh); -void vtoc_set_cchhb (cchhb_t *addr, u_int16_t cc, u_int16_t hh, u_int8_t b); +void vtoc_set_cchh (cchh_t *addr, u_int32_t cc, u_int16_t hh); +u_int32_t vtoc_get_cyl_from_cchh(cchh_t *addr); +u_int16_t vtoc_get_head_from_cchh(cchh_t *addr); +void vtoc_set_cchhb (cchhb_t *addr, u_int32_t cc, u_int16_t hh, u_int8_t b); +u_int32_t vtoc_get_cyl_from_cchhb(cchhb_t *addr); +u_int16_t vtoc_get_head_from_cchhb(cchhb_t *addr); +u_int64_t cchhb2blk(cchhb_t *p, struct fdasd_hd_geometry *geo); +u_int64_t cchh2blk (cchh_t *p, struct fdasd_hd_geometry *geo); +u_int32_t cchh2trk (cchh_t *p, struct fdasd_hd_geometry *geo); void vtoc_set_date (labeldate_t *d, u_int8_t year, u_int16_t day); void vtoc_volume_label_init (volume_label_t *vlabel); @@ -295,14 +332,16 @@ void vtoc_write_label (int fd, unsigned long position, format1_label_t const *f1, format4_label_t const *f4, format5_label_t const *f5, - format7_label_t const *f7); + format7_label_t const *f7, + format9_label_t const *f9); void vtoc_init_format1_label (char *volid, unsigned int blksize, extent_t *part_extent, format1_label_t *f1); void vtoc_init_format4_label (format4_label_t *f4lbl, unsigned int usable_partitions, - unsigned int cylinders, + unsigned int compat_cylinders, + unsigned int real_cylinders, unsigned int tracks, unsigned int blocks, unsigned int blksize, @@ -329,8 +368,16 @@ void vtoc_update_format7_label_add (format7_label_t *f7, int verbose, void vtoc_update_format7_label_del (format7_label_t *f7, int verbose, u_int32_t a, u_int32_t b); +void vtoc_init_format8_label (char *volid, unsigned int blksize, + extent_t *part_extent, format1_label_t *f1); + +void vtoc_update_format8_label (cchhb_t *associated_f9, format1_label_t *f8); + +void vtoc_init_format9_label (format9_label_t *f9); + void vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5, format7_label_t *f7, char ch, int verbose, - u_int32_t start, u_int32_t stop, int cyl, int trk); + u_int32_t start, u_int32_t stop, u_int32_t cyl, + u_int32_t trk); #endif /* VTOC_H */ diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c index b4e80b1..081b3c5 100644 --- a/libparted/labels/dasd.c +++ b/libparted/labels/dasd.c @@ -631,6 +631,7 @@ dasd_write (const PedDisk* disk) /* initialize the anchor */ fdasd_initialize_anchor(&anchor); fdasd_get_geometry(disk->dev, &anchor, arch_specific->fd); + fdasd_check_volume(&anchor, arch_specific->fd); memcpy(anchor.vlabel, &disk_specific->vlabel, sizeof(volume_label_t)); anchor.vlabel_changed++; diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c index f92065f..2735b2a 100644 --- a/libparted/labels/fdasd.c +++ b/libparted/labels/fdasd.c @@ -59,6 +59,48 @@ setpos (fdasd_anchor_t *anc, int dsn, int pos) anc->partno[dsn] = pos; } +static u_int32_t +get_usable_cylinders (fdasd_anchor_t *anc) +{ + u_int32_t cyl; + + /* large volume */ + if (anc->f4->DS4DEVCT.DS4DSCYL == LV_COMPAT_CYL && + anc->f4->DS4DCYL > anc->f4->DS4DEVCT.DS4DSCYL) + return anc->f4->DS4DCYL; + /* normal volume */ + if (anc->f4->DS4DEVCT.DS4DEVFG & ALTERNATE_CYLINDERS_USED) + cyl = anc->f4->DS4DEVCT.DS4DSCYL - + (u_int16_t) anc->f4->DS4DEVAC; + else + cyl = anc->f4->DS4DEVCT.DS4DSCYL; + return cyl; +} + +static void +get_addr_of_highest_f1_f8_label (fdasd_anchor_t *anc, cchhb_t *addr) +{ + + u_int8_t record; + /* We have to count the follwing labels: + * one format 4 + * one format 5 + * format 7 only if we have moren then BIG_DISK_SIZE tracks + * one for each format 1 or format 8 label == one for each partition + * one for each format 9 label before the last format 8 + * We assume that all partitions use format 8 labels when + * anc->formatted_cylinders > LV_COMPAT_CYL + * Note: Record zero is special, so block 0 on our disk is record 1! + */ + + record = anc->used_partitions + 2; + if (anc->big_disk) + record++; + if (anc->formatted_cylinders > LV_COMPAT_CYL) + record += anc->used_partitions - 1; + vtoc_set_cchhb(addr, VTOC_START_CC, VTOC_START_HH, record); +} + void fdasd_cleanup (fdasd_anchor_t *anchor) { @@ -72,6 +114,7 @@ fdasd_cleanup (fdasd_anchor_t *anchor) free(anchor->f4); free(anchor->f5); free(anchor->f7); + free(anchor->f9); free(anchor->vlabel); p = anchor->first; @@ -82,6 +125,7 @@ fdasd_cleanup (fdasd_anchor_t *anchor) if (p == NULL) return; q = p->next; + free(p->f1); free(p); p = q; } @@ -154,17 +198,6 @@ fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char const *str) } /* - * converts cyl-cyl-head-head-blk to blk - */ -static unsigned long -cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo) -{ - PDEBUG - return (unsigned long) (p->cc * geo->heads * geo->sectors - + p->hh * geo->sectors + p->b); -} - -/* * initializes the anchor structure and allocates some * memory for the labels */ @@ -216,9 +249,16 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) if (anc->f7 == NULL) fdasd_error(anc, malloc_failed, "FMT7 DSCB."); + /* template for all format 9 labels */ + anc->f9 = malloc(sizeof(format9_label_t)); + if (anc->f9 == NULL) + fdasd_error(anc, malloc_failed, "FMT9 DSCB."); + bzero(anc->f4, sizeof(format4_label_t)); bzero(anc->f5, sizeof(format5_label_t)); bzero(anc->f7, sizeof(format7_label_t)); + bzero(anc->f9, sizeof(format9_label_t)); + vtoc_init_format9_label(anc->f9); v = malloc(sizeof(volume_label_t)); if (v == NULL) @@ -259,6 +299,8 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc) q = p; } + anc->hw_cylinders = 0; + anc->formatted_cylinders = 0; } /* @@ -269,44 +311,46 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd) { PDEBUG partition_info_t *p; - unsigned long b; + unsigned long b, maxblk; char dsno[6], s1[7], s2[45], *c1, *c2, *ch; int i = 0, k = 0; + cchhb_t f9addr; + format1_label_t emptyf1; b = (cchhb2blk (&anc->vlabel->vtoc, &anc->geo) - 1) * anc->blksize; if (b <= 0) fdasd_error (anc, vlabel_corrupted, ""); + maxblk = b + anc->blksize * 9; /* f4+f5+f7+3*f8+3*f9 */ /* write FMT4 DSCB */ - vtoc_write_label (fd, b, NULL, anc->f4, NULL, NULL); + vtoc_write_label (fd, b, NULL, anc->f4, NULL, NULL, NULL); + b += anc->blksize; /* write FMT5 DSCB */ + vtoc_write_label (fd, b, NULL, NULL, anc->f5, NULL, NULL); b += anc->blksize; - vtoc_write_label (fd, b, NULL, NULL, anc->f5, NULL); /* write FMT7 DSCB */ if (anc->big_disk) { + vtoc_write_label (fd, b, NULL, NULL, NULL, anc->f7, NULL); b += anc->blksize; - vtoc_write_label (fd, b, NULL, NULL, NULL, anc->f7); } - /* loop over all FMT1 DSCBs */ - p = anc->first; - for (i = 0; i < USABLE_PARTITIONS; i++) { - b += anc->blksize; + /* loop over all partitions (format 1 or format 8 DCB) */ + for (p = anc->first; p != NULL; p = p->next) { if (p->used != 0x01) { - vtoc_write_label (fd, b, p->f1, NULL, NULL, NULL); continue; } + i++; strncpy (p->f1->DS1DSSN, anc->vlabel->volid, 6); ch = p->f1->DS1DSNAM; vtoc_ebcdic_dec (ch, ch, 44); c1 = ch + 7; - if (getdsn (anc, i) > -1) { + if (getdsn (anc, i-1) > -1) { /* re-use the existing data set name */ c2 = strchr (c1, '.'); if (c2 != NULL) @@ -325,11 +369,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd) while (getpos (anc, k) > -1) k++; - setpos (anc, k, i); - - strncpy (s2, ch, 44); - s2[44] = 0; - vtoc_ebcdic_dec (s2, s2, 44); + setpos (anc, k, i-1); strncpy (ch, "LINUX.V " " ", 44); @@ -366,8 +406,32 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd) vtoc_ebcdic_enc (ch, ch, 44); - vtoc_write_label (fd, b, p->f1, NULL, NULL, NULL); - p = p->next; + if (p->f1->DS1FMTID == 0xf8 ) { + /* Now as we know where which label will be written, we + * can add the address of the format 9 label to the + * format 8 label. The f9 record will be written to the + * block after the current blk. Remember: records are of + * by one, so we have to add 2 and not just one. + */ + vtoc_set_cchhb(&f9addr, VTOC_START_CC, VTOC_START_HH, + ((b / anc->blksize) % anc->geo.sectors) + 2); + vtoc_update_format8_label(&f9addr, p->f1); + vtoc_write_label(fd, b, p->f1, NULL, NULL, NULL, NULL); + b += anc->blksize; + vtoc_write_label(fd, b, NULL, NULL, NULL, NULL, + anc->f9); + b += anc->blksize; + } else { + vtoc_write_label(fd, b, p->f1, NULL, NULL, NULL, NULL); + b += anc->blksize; + } + } + + /* write empty labels to the rest of the blocks */ + bzero(&emptyf1, sizeof(emptyf1)); + while (b < maxblk) { + vtoc_write_label(fd, b, &emptyf1, NULL, NULL, NULL, NULL); + b += anc->blksize; } } @@ -394,20 +458,25 @@ int fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) { PDEBUG - partition_info_t *p = anc->first; + partition_info_t *p; char dsno[6], s1[7], s2[45], *c1, *c2, *ch; int i = 0, k = 0; - /* loop over all FMT1 DSCBs */ - p = anc->first; - for (i = 0; i < USABLE_PARTITIONS; i++) { + /* loop over all partitions (format 1 or format 8 DCB) */ + for (p = anc->first; p != NULL; p = p->next) { + + if (p->used != 0x01) { + continue; + } + + i++; strncpy (p->f1->DS1DSSN, anc->vlabel->volid, 6); ch = p->f1->DS1DSNAM; vtoc_ebcdic_dec (ch, ch, 44); c1 = ch + 7; - if (getdsn (anc, i) > -1) { + if (getdsn (anc, i-1) > -1) { /* re-use the existing data set name */ c2 = strchr (c1, '.'); if (c2 != NULL) @@ -426,11 +495,7 @@ fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) while (getpos (anc, k) > -1) k++; - setpos (anc, k, i); - - strncpy (s2, ch, 44); - s2[44] = 0; - vtoc_ebcdic_dec (s2, s2, 44); + setpos (anc, k, i-1); strncpy (ch, "LINUX.V " " ", 44); @@ -466,7 +531,6 @@ fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) } vtoc_ebcdic_enc (ch, ch, 44); - p = p->next; } return 1; @@ -482,6 +546,7 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS, anc->geo.cylinders, + anc->formatted_cylinders, anc->geo.heads, anc->geo.sectors, anc->blksize, @@ -492,8 +557,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose, FIRST_USABLE_TRK, - anc->geo.cylinders * anc->geo.heads - 1, - anc->geo.cylinders, anc->geo.heads); + anc->formatted_cylinders * anc->geo.heads - 1, + anc->formatted_cylinders, anc->geo.heads); for (i = 0; i < USABLE_PARTITIONS; i++) { bzero(p->f1, sizeof(format1_label_t)); @@ -507,7 +572,8 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) } anc->used_partitions = 0; - anc->fspace_trk = anc->geo.cylinders * anc->geo.heads - FIRST_USABLE_TRK; + anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads - + FIRST_USABLE_TRK; for (i=0; i<USABLE_PARTITIONS; i++) setpos(anc, i, -1); @@ -526,15 +592,15 @@ fdasd_update_partition_info (fdasd_anchor_t *anc) { PDEBUG partition_info_t *q = NULL, *p = anc->first; - unsigned int h = anc->geo.heads; - unsigned long max = anc->geo.cylinders * h - 1; + unsigned long max = anc->formatted_cylinders * anc->geo.heads - 1; int i; char *ch; anc->used_partitions = anc->geo.sectors - 2 - anc->f4->DS4DSREC; for (i = 1; i <= USABLE_PARTITIONS; i++) { - if (p->f1->DS1FMTID != 0xf1) { + if (p->f1->DS1FMTID != 0xf1 && + p->f1->DS1FMTID != 0xf8) { if (i == 1) /* there is no partition at all */ anc->fspace_trk = max - FIRST_USABLE_TRK + 1; @@ -546,8 +612,8 @@ fdasd_update_partition_info (fdasd_anchor_t *anc) /* this is a valid format 1 label */ p->used = 0x01; - p->start_trk = p->f1->DS1EXT1.llimit.cc * h + p->f1->DS1EXT1.llimit.hh; - p->end_trk = p->f1->DS1EXT1.ulimit.cc * h + p->f1->DS1EXT1.ulimit.hh; + p->start_trk = cchh2trk(&p->f1->DS1EXT1.llimit, &anc->geo); + p->end_trk = cchh2trk(&p->f1->DS1EXT1.ulimit, &anc->geo); p->len_trk = p->end_trk - p->start_trk + 1; if (i == 1) { @@ -618,14 +684,22 @@ fdasd_process_valid_vtoc (fdasd_anchor_t * anc, unsigned long b, int fd) format1_label_t q; char s[5], *ch; + if (anc->f4->DS4DEVCT.DS4DSCYL == LV_COMPAT_CYL && + anc->f4->DS4DCYL > anc->f4->DS4DEVCT.DS4DSCYL) + anc->formatted_cylinders = anc->f4->DS4DCYL; + else + anc->formatted_cylinders = anc->f4->DS4DEVCT.DS4DSCYL; + anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads - + FIRST_USABLE_TRK; b += anc->blksize; - for (i = 1; i <= anc->geo.sectors; i++) { + for (i = 1; i < anc->geo.sectors; i++) { bzero (&q, f1size); vtoc_read_label (fd, b, &q, NULL, NULL, NULL); switch (q.DS1FMTID) { case 0xf1: + case 0xf8: if (p == NULL) break; memcpy (p->f1, &q, f1size); @@ -669,6 +743,12 @@ fdasd_process_valid_vtoc (fdasd_anchor_t * anc, unsigned long b, int fd) memcpy (anc->f7, &q, f1size); f7_counter++; break; + case 0xf9: + /* each format 8 lable has an associated + * format 9 lable, but they are of no further + * use to us. + */ + break; } b += anc->blksize; @@ -718,7 +798,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd) { PDEBUG volume_label_t *v = anc->vlabel; - unsigned long b = -1; + long long b = -1; char str[LINE_LENGTH]; memset(v, 0, sizeof(volume_label_t)); @@ -784,6 +864,7 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) PDEBUG int blksize = 0; dasd_information_t dasd_info; + struct dasd_eckd_characteristics *characteristics; /* We can't get geometry from a regular file, so simulate something usable, for the sake of testing. */ @@ -803,6 +884,8 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) dasd_info.devno = 513; dasd_info.label_block = 2; dasd_info.FBA_layout = 0; + anc->hw_cylinders = ((st.st_size / blksize) / anc->geo.sectors) / + anc->geo.heads; } else { if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0) fdasd_error(anc, unable_to_ioctl, @@ -816,13 +899,20 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t *anc, int f) if (ioctl(f, BIODASDINFO, &dasd_info) != 0) fdasd_error(anc, unable_to_ioctl, _("Could not retrieve disk information.")); + + characteristics = (struct dasd_eckd_characteristics *) + &dasd_info.characteristics; + if (characteristics->no_cyl == LV_COMPAT_CYL && + characteristics->long_no_cyl) + anc->hw_cylinders = characteristics->long_no_cyl; + else + anc->hw_cylinders = characteristics->no_cyl; } anc->dev_type = dasd_info.dev_type; anc->blksize = blksize; anc->label_pos = dasd_info.label_block * blksize; anc->devno = dasd_info.devno; - anc->fspace_trk = anc->geo.cylinders * anc->geo.heads - FIRST_USABLE_TRK; anc->label_block = dasd_info.label_block; anc->FBA_layout = dasd_info.FBA_layout; } @@ -850,20 +940,17 @@ fdasd_get_partition_data (fdasd_anchor_t *anc, extent_t *part_extent, unsigned int *stop_ptr) { PDEBUG - unsigned int limit, cc, hh; + unsigned int limit; + u_int32_t cc, c; + u_int16_t hh, h; cchh_t llimit, ulimit; partition_info_t *q; u_int8_t b1, b2; - u_int16_t c, h; unsigned int start = *start_ptr, stop = *stop_ptr; int i; char *ch; - if (anc->f4->DS4DEVCT.DS4DEVFG & ALTERNATE_CYLINDERS_USED) - c = anc->f4->DS4DEVCT.DS4DSCYL - (u_int16_t) anc->f4->DS4DEVAC; - else - c = anc->f4->DS4DEVCT.DS4DSCYL; - + c = get_usable_cylinders(anc); h = anc->f4->DS4DEVCT.DS4DSTRK; limit = (h * c - 1); @@ -1019,7 +1106,6 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, cchhb_t hf1; partition_info_t *p; extent_t ext; - int i; PDEBUG; @@ -1032,8 +1118,14 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, if (fdasd_get_partition_data(anc, &ext, p, &start, &stop) != 0) return 0; - PDEBUG; - vtoc_init_format1_label(anc->vlabel->volid, anc->blksize, &ext, p->f1); + if (anc->formatted_cylinders > LV_COMPAT_CYL) { + vtoc_init_format8_label(anc->vlabel->volid, anc->blksize, &ext, + p->f1); + } else { + PDEBUG; + vtoc_init_format1_label(anc->vlabel->volid, anc->blksize, &ext, + p->f1); + } PDEBUG; fdasd_enqueue_new_partition(anc); @@ -1041,23 +1133,17 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, PDEBUG; anc->used_partitions += 1; - i = anc->used_partitions + 2; - if (anc->big_disk) - i++; - PDEBUG; - - vtoc_set_cchhb(&hf1, VTOC_START_CC, VTOC_START_HH, i); - + get_addr_of_highest_f1_f8_label(anc, &hf1); vtoc_update_format4_label(anc->f4, &hf1, anc->f4->DS4DSREC - 1); PDEBUG; - start = ext.llimit.cc * anc->geo.heads + ext.llimit.hh; - stop = ext.ulimit.cc * anc->geo.heads + ext.ulimit.hh; + start = cchh2trk(&ext.llimit, &anc->geo); + stop = cchh2trk(&ext.ulimit, &anc->geo); PDEBUG; vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '-', anc->verbose, - start, stop, anc->geo.cylinders, anc->geo.heads); + start, stop, anc->formatted_cylinders, anc->geo.heads); anc->vtoc_changed++; diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c index cf2990e..fdfa94f 100644 --- a/libparted/labels/vtoc.c +++ b/libparted/labels/vtoc.c @@ -218,11 +218,32 @@ vtoc_set_extent (extent_t *ext, u_int8_t typeind, u_int8_t seqno, } void -vtoc_set_cchh (cchh_t *addr, u_int16_t cc, u_int16_t hh) +vtoc_set_cchh (cchh_t *addr, u_int32_t cc, u_int16_t hh) { PDEBUG - addr->cc = cc; - addr->hh = hh; + addr->cc = (u_int16_t) cc; + addr->hh = cc >> 16; + addr->hh <<= 4; + addr->hh |= hh; +} + +u_int32_t +vtoc_get_cyl_from_cchh (cchh_t *addr) +{ + u_int32_t cyl; + + /*decode cylinder for large volumes */ + cyl = addr->hh & 0xFFF0; + cyl <<= 12; + cyl |= addr->cc; + return cyl; +} + +u_int16_t +vtoc_get_head_from_cchh (cchh_t *addr) +{ + /* decode heads for large volumes */ + return addr->hh & 0x000F; } static void @@ -234,12 +255,63 @@ vtoc_set_ttr (ttr_t *addr, u_int16_t tt, u_int8_t r) } void -vtoc_set_cchhb (cchhb_t *addr, u_int16_t cc, u_int16_t hh, u_int8_t b) +vtoc_set_cchhb (cchhb_t *addr, u_int32_t cc, u_int16_t hh, u_int8_t b) { PDEBUG - addr->cc = cc; - addr->hh = hh; - addr->b = b; + addr->cc = (u_int16_t) cc; + addr->hh = cc >> 16; + addr->hh <<= 4; + addr->hh |= hh; + addr->b = b; +} + +u_int32_t +vtoc_get_cyl_from_cchhb(cchhb_t *addr) +{ + u_int32_t cyl; + + /* decode cylinder for large volumes */ + cyl = addr->hh & 0xFFF0; + cyl <<= 12; + cyl |= addr->cc; + return cyl; +} + +u_int16_t +vtoc_get_head_from_cchhb(cchhb_t *addr) +{ + /* decode heads for large volumes */ + return addr->hh & 0x000F; +} + +/* + * some functions to convert cyl-cyl-head-head addresses to + * block or track numbers + * Note: Record zero is special, so first block on a track is + * in record 1! + */ +u_int64_t +cchhb2blk (cchhb_t *p, struct fdasd_hd_geometry *geo) +{ + return (u_int64_t) vtoc_get_cyl_from_cchhb(p) * + geo->heads * geo->sectors + + vtoc_get_head_from_cchhb(p) * geo->sectors + + p->b; +} + +u_int64_t +cchh2blk (cchh_t *p, struct fdasd_hd_geometry *geo) +{ + return (u_int64_t) vtoc_get_cyl_from_cchh(p) * + geo->heads * geo->sectors + + vtoc_get_head_from_cchh(p) * geo->sectors; +} + +u_int32_t +cchh2trk (cchh_t *p, struct fdasd_hd_geometry *geo) +{ + return vtoc_get_cyl_from_cchh(p) * geo->heads + + vtoc_get_head_from_cchh(p); } void @@ -506,7 +578,8 @@ vtoc_write_label (int f, unsigned long position, format1_label_t const *f1, format4_label_t const *f4, format5_label_t const *f5, - format7_label_t const *f7) + format7_label_t const *f7, + format9_label_t const *f9) { PDEBUG int t; @@ -542,6 +615,17 @@ vtoc_write_label (int f, unsigned long position, vtoc_error(unable_to_write, "vtoc_write_label", _("Could not write VTOC FMT7 DSCB.")); } + + if (f9 != NULL) + { + t = sizeof(format9_label_t); + if (write(f, f9, t) != t) + { + close(f); + vtoc_error(unable_to_write, "vtoc_write_label", + _("Could not write VTOC FMT9 DSCB.")); + } + } } /* @@ -549,7 +633,8 @@ vtoc_write_label (int f, unsigned long position, */ void vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions, - unsigned int cylinders, unsigned int tracks, + unsigned int compat_cylinders, + unsigned int real_cylinders, unsigned int tracks, unsigned int blocks, unsigned int blksize, u_int16_t dev_type) { @@ -574,7 +659,7 @@ vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions, f4->DS4DEVAC = 0x00; /* -- begin f4->DS4DEVCT -- */ - f4->DS4DEVCT.DS4DSCYL = cylinders; + f4->DS4DEVCT.DS4DSCYL = compat_cylinders; f4->DS4DEVCT.DS4DSTRK = tracks; switch (dev_type) { @@ -613,7 +698,11 @@ vtoc_init_format4_label (format4_label_t *f4, unsigned int usable_partitions, bzero(f4->res2, sizeof(f4->res2)); f4->DS4EFLVL = 0x00; bzero(&f4->DS4EFPTR, sizeof(f4->DS4EFPTR)); - bzero(f4->res3, sizeof(f4->res3)); + bzero(&f4->res3, sizeof(f4->res3)); + f4->DS4DCYL = real_cylinders; + bzero(f4->res4, sizeof(f4->res4)); + f4->DS4DEVF2 = 0x40; /* allow format 8 and 9 labels */ + bzero(&f4->res5, sizeof(f4->res5)); } /* @@ -647,11 +736,12 @@ vtoc_init_format7_label (format7_label_t *f7) } /* - * initializes a format1 label + * helper function that initializes a most parts of a + * format1 or format 8 label, all but the field DS1FMTID */ void -vtoc_init_format1_label (char *volid, unsigned int blksize, - extent_t *part_extent, format1_label_t *f1) +vtoc_init_format_1_8_label (char *volid, unsigned int blksize, + extent_t *part_extent, format1_label_t *f1) { PDEBUG struct tm * creatime; @@ -666,7 +756,6 @@ vtoc_init_format1_label (char *volid, unsigned int blksize, sprintf(str, "PART .NEW "); vtoc_ebcdic_enc(str, str, 44); strncpy(f1->DS1DSNAM, str, 44); - f1->DS1FMTID = 0xf1; strncpy(f1->DS1DSSN, " ", 6); f1->DS1VOLSQ = 0x0001; @@ -704,6 +793,37 @@ vtoc_init_format1_label (char *volid, unsigned int blksize, vtoc_set_cchhb(&f1->DS1PTRDS, 0x0000, 0x0000, 0x00); } +void +vtoc_init_format1_label (char *volid, unsigned int blksize, + extent_t *part_extent, format1_label_t *f1) +{ + vtoc_init_format_1_8_label(volid, blksize, part_extent, f1); + f1->DS1FMTID = 0xf1; +} + +void +vtoc_init_format8_label (char *volid, unsigned int blksize, + extent_t *part_extent, format1_label_t *f8) +{ + vtoc_init_format_1_8_label(volid, blksize, part_extent, f8); + f8->DS1FMTID = 0xf8; +} + +void +vtoc_update_format8_label (cchhb_t *associated_f9, format1_label_t *f8) +{ + memcpy(&f8->DS1PTRDS, associated_f9, sizeof(*associated_f9)); +} + +void +vtoc_init_format9_label (format9_label_t *f9) +{ + f9->DS9KEYID = 0x09; + f9->DS9SUBTY = 0x01; + f9->DS9NUMF9 = 1; + f9->DS9FMTID = 0xf9; +} + /* * do some updates to the VTOC format4 label */ @@ -1060,7 +1180,7 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose, if ((ext->a + ext->b) == 0x00000000) continue; - if ((ext->b + 1) == tmp->a) { + if (ext->b == tmp->a) { /* this extent precedes the new one */ ext->b = tmp->b; bzero(tmp, sizeof(ds7ext_t)); @@ -1074,7 +1194,7 @@ vtoc_update_format7_label_add (format7_label_t *f7, int verbose, continue; } - if (ext->a == (tmp->b + 1)) { + if (ext->a == tmp->b) { /* this extent succeeds the new one */ ext->a = tmp->a; bzero(tmp, sizeof(ds7ext_t)); @@ -1119,7 +1239,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, if ((a == ext->a) && (b < ext->b)) { /* left-bounded in free space gap */ - ext->a = b + 1; + ext->a = b; if (verbose) puts ("FMT7 add extent: left-bounded"); @@ -1130,7 +1250,7 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, if ((a > ext->a) && (b == ext->b)) { /* right-bounded in free space gap */ - ext->b = a - 1; + ext->b = a; if (verbose) puts ("FMT7 add extent: right-bounded"); @@ -1141,8 +1261,8 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, if ((a > ext->a) && (b < ext->b)) { /* partition devides free space into 2 pieces */ - vtoc_update_format7_label_add(f7, verbose, b+1, ext->b); - ext->b = a - 1; + vtoc_update_format7_label_add(f7, verbose, b, ext->b); + ext->b = a; if (verbose) puts ("FMT7 add extent: 2 pieces"); @@ -1172,14 +1292,19 @@ vtoc_update_format7_label_del (format7_label_t *f7, int verbose, void vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5, format7_label_t *f7, char ch, int verbose, - u_int32_t start, u_int32_t stop, int cyl, int trk) + u_int32_t start, u_int32_t stop, u_int32_t cyl, + u_int32_t trk) { PDEBUG if ((cyl * trk) > BIG_DISK_SIZE) { if (ch == '+') - vtoc_update_format7_label_add(f7, verbose, start, stop); + vtoc_update_format7_label_add(f7, verbose, start, + /* ds7ext RTA + 1 */ + stop + 1); else if (ch == '-') - vtoc_update_format7_label_del(f7, verbose, start, stop); + vtoc_update_format7_label_del(f7, verbose, start, + /* ds7ext RTA + 1 */ + stop + 1); else puts ("BUG: syntax error in vtoc_set_freespace call"); -- 1.8.3.1
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Wed, 11 Sep 2013 20:47:01 GMT) Full text and rfc822 format available.Message #32 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Wed, 11 Sep 2013 13:46:14 -0700
[Message part 1 (text/plain, inline)]
Uhh, what the heck is up with the To: line and the subject lines? I sent these to the list address (bug-parted <at> gnu.org) - Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
[Message part 2 (application/pgp-signature, inline)]
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Thu, 12 Sep 2013 03:17:01 GMT) Full text and rfc822 format available.Message #35 received at 15356 <at> debbugs.gnu.org (full text, mbox):
From: Phillip Susi <psusi <at> ubuntu.com> To: "Brian C. Lane" <bcl <at> redhat.com> Cc: 15356 <at> debbugs.gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Wed, 11 Sep 2013 23:16:34 -0400
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 It looks like somehow the mailing list got tangled in with the debbugs system and all messages to the list are automatically converted into a bug report. I've been in contact with the sysadmins about it. On 09/11/2013 04:46 PM, Brian C. Lane wrote: > Uhh, what the heck is up with the To: line and the subject lines? I > sent these to the list address (bug-parted <at> gnu.org) > > - Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port > Orchard, WA (PST8PDT) > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSMTISAAoJEJrBOlT6nu75B7AIALBeZykoPMZ8e+20/Yhclt3h W2ktbLPWu0bzesqfe8oWFNRaSwZZVq5EFg9hud+7b+ocp7G7QKpNAuq97grQgtqW CgYwmiGQmiYRl5I19sc1iwt0oGEvMrkdRsmORcOolgiAgG58Atr2ikVqalPFfLCm ngPk6LBR+cR21299OdPhdJNMpJrfor125B+akJh6LE9gQpBVdwQkNq6EPuAxVTIS a9x6CRZHryLwee7pTtvJ0FFfD176jgatj4sth/yA5sQNT4JoocP2gaXROLxVo7yQ 0dMEwbFA1x0MAny0T3kdZ2frWTWuHhSvXZnOOCZzl3tJIxugO2ItgP/QEYYwlGA= =jTx4 -----END PGP SIGNATURE-----
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Thu, 12 Sep 2013 21:43:02 GMT) Full text and rfc822 format available.Message #38 received at 15356 <at> debbugs.gnu.org (full text, mbox):
From: Jim Meyering <jim <at> meyering.net> To: "Brian C. Lane" <bcl <at> redhat.com> Cc: 15356 <at> debbugs.gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Thu, 12 Sep 2013 14:42:28 -0700
On Wed, Sep 11, 2013 at 1:46 PM, Brian C. Lane <bcl <at> redhat.com> wrote: > Uhh, what the heck is up with the To: line and the subject lines? I sent these to the list > address (bug-parted <at> gnu.org) Hi Brian, Sorry I didn't announce it, but I've requested that this list (like coreutils, emacs -- and now grep, gzip, diffutils, etc.) be hooked up to the debbugs bug-tracking system. I should have asked or at least given a heads-up here, but have been distracted with things like piano-through-window moving details. Nothing broke :)
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Fri, 13 Sep 2013 18:19:02 GMT) Full text and rfc822 format available.Message #41 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Phillip Susi <psusi <at> ubuntu.com> To: "bug-parted <at> gnu.org" <bug-parted <at> gnu.org> Subject: Re: cross post test Date: Fri, 13 Sep 2013 14:17:45 -0400
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This is a test to see how badly the list header munging breaks cross posting. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSM1bJAAoJEJrBOlT6nu75lycIALhiYMN+K9ZGwOzzJpIAS3Dd 7ppW2oePEZN8Dfsmze9j1bBsaBrKEpwnaXnki+3MNBULJTE8qs1x8Wdcf7h1nfbv rmgLXuLA14ybp7IlzDmBjzDUzAQfiFbN/c5RvNMS/PYBKs6eXKfJ/OGM8CXjoVjq h6mhrF/l766UpEOP+Z0+XclshIsp2yeZKe1J7HaO1miOsOM7kcFuTrsf4p9GDnUD 1H57lIlqkc9DKXBCDoBJuK7NrvjMZ/JYN3slwB0ZvgCKCnyGV1CLz+GsfC1qzHei +fxkmKu/P482XsrmdQOYDtXclBOC6q7X7lz4MiPvPR15KisrfJ1EE8GzYQnvVnA= =1/RZ -----END PGP SIGNATURE-----
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Mon, 23 Sep 2013 21:29:01 GMT) Full text and rfc822 format available.Message #44 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Brian C. Lane" <bcl <at> redhat.com> To: bug-parted <at> gnu.org Subject: Re: bug#15356: [PATCH 15/19] libparted: Add hfs_esp partition flag to GPT. Date: Mon, 23 Sep 2013 14:27:31 -0700
[Message part 1 (text/plain, inline)]
On Wed, Sep 11, 2013 at 12:25:05PM -0700, Brian C. Lane wrote: > From: "Brian C. Lane" <bcl <at> redhat.com> > > Mac uses a HFS+ formatted partition for ESP. When dual booting with > Linux we need a way to differentiate between the Mac partition and the > one created by Linux which contains just enough stuff to fake OSX into > displaying a nice logo and allowing it to be selected for boot. I > generated a GUID (47CB5633-7E3E-408B-B7B8-2D915B7B21B1) and added a new > flag to control it. Ends up this doesn't work -- Apple firmware ignores the GUID and won't boot, so I'll be dropping this patch. -- Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
[Message part 2 (application/pgp-signature, inline)]
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Sun, 29 Sep 2013 01:06:02 GMT) Full text and rfc822 format available.Message #47 received at 15356 <at> debbugs.gnu.org (full text, mbox):
From: Phillip Susi <psusi <at> ubuntu.com> To: "Brian C. Lane" <bcl <at> redhat.com>, 15356 <at> debbugs.gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Sat, 28 Sep 2013 21:05:52 -0400
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 I see what you meant now about the comment style: *file1: add feature x *file2: same *file3: test feature x *file4: document feature x I don't think these kind of comments adds anything of value so I'd prefer to avoid it. A few of the patches you posted also could use NEWS entries. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCgAGBQJSR3zsAAoJEJrBOlT6nu75kcwH/1tqFrwJ3gY64bUSuLOobkiR 4ySQJ4jseSKlZVE4vI0qLP5powypA2fGagX6KejhZjkn+YhbveDS/nteyD/kjJzL MYxGj9Rlq84NuifnEwUNrE5XnCZcG12tYWyaj9ipnxbN8g88lZd11i4IMjJsiHR3 XFGJwvA53SYRkkM23Ld2X4JxbxdJbiJOh5UpfQ9YrepxKatFcVb6i+pxQaqn551r XHi27tel9MgHRm4yIZetQzb0TD+DjxAUuUckIFP1NDGHcXr2bWajJmSuAVkpEKfT 3Nih14GqABaKnAdzWM8IjUtZ33lKXTQUQleJyMiQb4zW/2JWRGvji3h4CgPtbb0= =CVzY -----END PGP SIGNATURE-----
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Sun, 29 Sep 2013 16:00:03 GMT) Full text and rfc822 format available.Message #50 received at 15356 <at> debbugs.gnu.org (full text, mbox):
From: Jim Meyering <jim <at> meyering.net> To: Phillip Susi <psusi <at> ubuntu.com> Cc: "Brian C. Lane" <bcl <at> redhat.com>, 15356 <at> debbugs.gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Sun, 29 Sep 2013 08:59:26 -0700
On Sat, Sep 28, 2013 at 6:05 PM, Phillip Susi <psusi <at> ubuntu.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > I see what you meant now about the comment style: > > *file1: add feature x > *file2: same > *file3: test feature x > *file4: document feature x > > I don't think these kind of comments adds anything of value so I'd > prefer to avoid it. A few of the patches you posted also could use > NEWS entries. Hi Phillip, I have found that the discipline imposed by having to write up that style of ChangeLog entry tends to help me spot my own errors (as I write it), and also makes it easier to review changes written by others -- when they adopt that style. Of course, it works only if you provide the sort of detail that is useful. If you merely say "as above", referring to the high-level what-this-does description, it provides almost no value. However, the intent is to provide additional, typically lower-level detail. Sometimes, it feels stilted, because you've already given that detail in the top-level description, but when the implementation details are not 100% obvious, and especially when you're changing types, adding or removing global variables, parameters, etc. there are plenty of ways to make a commit message better by saying more. Given a well-written ChangeLog, it is often possible to use it as a spec and produce an identical patch. This ostensible duplication is what makes it so useful (and hard to write if you're not used to it) for catching differences between the detailed, expressed intent of the patch-writer, and the actual patch. Sure, it is an added cost, but in the write-once-read-many coding world, it is a worthwhile investment. Your patches will be read by far more than one or two people, so optimizing for the reader makes sense. Jim
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Mon, 30 Sep 2013 01:03:02 GMT) Full text and rfc822 format available.Message #53 received at 15356 <at> debbugs.gnu.org (full text, mbox):
From: Phillip Susi <psusi <at> ubuntu.com> To: Jim Meyering <jim <at> meyering.net> Cc: 15356 <at> debbugs.gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Sun, 29 Sep 2013 21:02:11 -0400
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 I find that most comments that get added this way end up being of the useless restating the obvious variety. In the event that some code isn't obvious from the general description, either the description needs a little more fleshing out, or the code in question deserves a good comment in the code instead of a one liner in the commit message. On 09/29/2013 11:59 AM, Jim Meyering wrote: > I have found that the discipline imposed by having to write up > that style of ChangeLog entry tends to help me spot my own errors > (as I write it), and also makes it easier to review changes written > by others -- when they adopt that style. Of course, it works only > if you provide the sort of detail that is useful. If you merely > say "as above", referring to the high-level what-this-does > description, it provides almost no value. However, the intent is > to provide additional, typically lower-level detail. Sometimes, it > feels stilted, because you've already given that detail in the > top-level description, but when the implementation details are not > 100% obvious, and especially when you're changing types, adding or > removing global variables, parameters, etc. there are plenty of > ways to make a commit message better by saying more. Given a > well-written ChangeLog, it is often possible to use it as a spec > and produce an identical patch. This ostensible duplication is what > makes it so useful (and hard to write if you're not used to it) for > catching differences between the detailed, expressed intent of the > patch-writer, and the actual patch. > > Sure, it is an added cost, but in the write-once-read-many coding > world, it is a worthwhile investment. Your patches will be read > by far more than one or two people, so optimizing for the reader > makes sense. > > Jim > > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCgAGBQJSSM2TAAoJEJrBOlT6nu75r7sH/2930x5RmfPx1kAd5//NK7Hk TbeDEaE6O9uBTWrGmVmN9ysw9/cfwRgOz3HbZnjt+zRLkS4NsS8vZi+IUb7fvPRd Uh6KAO+v4XWW8A3Uau/kKL57hd1qo/BsRp813r9fAO219o5hxFpSpw3ITowKgNEH th+xGo7dK5PxULQigmfKn48LuRBu5+ATjPYg2q3R1/3qSAqE8DeAmxjhgjqlJbuB YkYgNrX264O5DH9iaOrxVBacfDuG8O/m0IHXKzWpSuFT4guEr/7WVhI8VLOyKJwq Vvk1I6yPABSdLA234En9mzI4G6XF8/KRrRnp3fYr6sDPotKXumeU8YzjyxPDhUc= =d/w2 -----END PGP SIGNATURE-----
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Tue, 01 Oct 2013 14:23:02 GMT) Full text and rfc822 format available.Message #56 received at 15356 <at> debbugs.gnu.org (full text, mbox):
From: Jim Meyering <jim <at> meyering.net> To: Phillip Susi <psusi <at> ubuntu.com> Cc: 15356 <at> debbugs.gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Tue, 1 Oct 2013 07:21:55 -0700
On Sun, Sep 29, 2013 at 6:02 PM, Phillip Susi <psusi <at> ubuntu.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > I find that most comments that get added this way end up being of the > useless restating the obvious variety. In the event that some code > isn't obvious from the general description, either the description > needs a little more fleshing out, or the code in question deserves a > good comment in the code instead of a one liner in the commit message. I agree 100% with the detailed-log->comment sentiment. Since I often write the ChangeLog last, since it forces me to reexamine my patch chunk by chunk and to organize the description well enough to present it, that tends to catch little things that I might otherwise overlook. Bottom line: please try to include enough information (the "why" motivation and/or a test case is easy to forget) to help someone less familiar than you with the code to decide whether to revert your change -- and the consequences -- in the event that someday we find reason to consider that. The consequences part often ends up in the NEWS entry, so people get an idea of which bugs have been fixed per release, along with enough description e.g., to match symptoms.
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Thu, 21 Nov 2013 16:07:02 GMT) Full text and rfc822 format available.Message #59 received at 15356 <at> debbugs.gnu.org (full text, mbox):
From: Phillip Susi <psusi <at> ubuntu.com> To: "Brian C. Lane" <bcl <at> redhat.com>, 15356 <at> debbugs.gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Thu, 21 Nov 2013 11:05:54 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Brian, I was just wondering if you might coordinate with Nageswara R Sastry and get the DASD patches ironed out so this series can be pushed soon. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSji9iAAoJEJrBOlT6nu75OV4H/iGLKCM3ojhqDLDvDGneZtde zpkKsdUcqVsu5MMlil79kk5g/FjgzMTw1+t7OgrSmrsQezYPRsKw6lJ9d728tZqo qHQYGzBaTywUmuyo/1J24PZ8gZD0tlSOVCSYSEcqNBw+/bboRnciEtrCR/co/o5O aUO61FHY1kS+mT+5/ildkkHAHQlWiImBvWZ6QZRGu1fDnIdh8L46f0rYE474aiBw i8m3AB1LawdccKfKbudg1mu9H1QP8FrEeR9f42cf0GBiK1WOH46RrYf5A+Be+lF0 2FpbTdcByL7DtAxLomHKa4NwZVrmiRp/0s4U03carNT40SEUmZbNFk3oRw4Eplo= =Z2SF -----END PGP SIGNATURE-----
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Mon, 25 Nov 2013 00:47:01 GMT) Full text and rfc822 format available.Message #62 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Håkon Løvdal <hlovdal <at> gmail.com> To: "Brian C. Lane" <bcl <at> redhat.com> Cc: 15356 <at> debbugs.gnu.org, "bug-parted <at> gnu.org" <bug-parted <at> gnu.org> Subject: Re: bug#15356: [PATCH 16/19] libparted: Recognize btrfs filesystem Date: Sun, 24 Nov 2013 20:48:46 +0100
On 11 September 2013 21:25, Brian C. Lane <bcl <at> redhat.com> wrote: > From: "Brian C. Lane" <bcl <at> redhat.com> > +static PedGeometry* > +btrfs_probe (PedGeometry* geom) > +{ ... > + if (geom->length < offset+1) > + return 0; > + if (!ped_geometry_read (geom, &buf, offset, 1)) > + return 0; Should not these be NULL rather than 0? > + > + if (PED_LE64_TO_CPU(buf.sb.magic) == BTRFS_MAGIC) { > + return ped_geometry_new (geom->dev, geom->start, geom->length); > + } > + return NULL; > +} When already providing feedback on this code, I will also ask if this test can be reversed, so that the conceptual flow is if (some_error_condition) { handle_error } normal_code e.g. "test exceptions, not the normal case" BR Håkon Løvdal
bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Mon, 25 Nov 2013 00:47:02 GMT) Full text and rfc822 format available.bug-parted <at> gnu.org
:bug#15356
; Package parted
.
(Tue, 25 Feb 2014 15:56:02 GMT) Full text and rfc822 format available.Message #68 received at 15356 <at> debbugs.gnu.org (full text, mbox):
From: Phillip Susi <psusi <at> ubuntu.com> To: "Brian C. Lane" <bcl <at> redhat.com>, 15356 <at> debbugs.gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Tue, 25 Feb 2014 10:55:19 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 9/11/2013 3:24 PM, Brian C. Lane wrote: > From: "Brian C. Lane" <bcl <at> redhat.com> > > Here is the stack of patches that I'm currently carrying for the > master branch of parted in Fedora. I think patches 1-12 have been > posted before, but I recently rebased things onto parted master. > The patches adding new flags (13-16) are all new. > > Patch 4 is my take on handling the uuid of dm devices. > > Patch 18 is similar to Phillip's, except that I didn't see any > reason to sync all the partition devices since all of our access is > via offsets into the parent device so I left the kernel 2.6 check > in place. > > > Brian C. Lane (14): libparted: copy pmbr_boot when duplicating GPT > disk tests: test creating 20 device-mapper partitions (#803108) > libparted: use dm_udev_wait (#698121) There are a few instances of unneccesary whitespace changes of the form: - - if (!dm_task_run(dmt)) + if (!dm_task_run (dmt)) Do you mind if I drop those before I commit? Also could you write a NEWS entry? > libparted: preserve the uuid on dm partitions (#832145) tests: Make > sure dm UUIDs are not erased libparted: don't canonicalize /dev/md/ > paths (#872361) Could you write a NEWS entry for this? > tests: rewrite t6001 to use /dev/mapper libparted: Add Intel Rapid > Start Technology partition flag. libparted: Add UEFI System > Partition flag. libparted: Add hfs_esp partition flag to GPT. Dropped per your request. > libparted: Recognize btrfs filesystem For the two flags and btrfs changes, you added the entry in the NEWS file under the changes in behavior section. I think they should be under the new features section instead. Do you mind if I move them before I commit? > tests: Add btrfs and xfs to the fs probe test libparted: Flush > parent device on open (#962611) Holding this one for now due to reasons posted previously. My patch titled [PATCH 9/9] Revert "linux-commit: do not unnecessarily open partition device nodes" should solve this instead. > tests: Restrict gpt-header-munge to little-endian systems > > Nageswara R Sastry (5): libparted: add support for implicit FBA > DASD partitions libparted: add support for EAV DASD partitions > libparted: mklabel to support EAV DASD libparted: Avoid dasd as > default disk type while probe libparted: mklabel to support EDEV > DASD Holding these DASD patches since it sounded like they still needed some cleaning up. The rest look good and I'm ready to commit them if you are ok with those minor changes and can send some NEWS entries to add. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (MingW32) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJTDLznAAoJEI5FoCIzSKrwnv8H/2x2vEjd+cXfKk8EpaUEUf5a 1Nl+EyVDDd8WDxa03OZUZXYSv71beKldCBH9k/AR7+5cog2DmuBNsRsvbupAFlAN MgtKhdvKve8YaKH7CyG9GKDNTvS/ovhVzSLkj3Z+VEt6PhseGU9hMJXEr4rKlrfD 6YmCbC5ePKH+lZvvs8EMoztE2xgbaHgGBC8XSzMZokX750Q5Y+vmY+ldOKN+XesI vtqnfU38NzEZRRQm9t17XLuWrbTzxwnDDP37zlnMqxxPJ3jgIlIro4M+gE7y/SYs wkwgzXJ7w+SK4/uh4rLkhV4fvfTlYc/iPB1+f+nwkPlyLoLKme9Qcc+a895dncE= =dUsW -----END PGP SIGNATURE-----
Phillip Susi <psusi <at> ubuntu.com>
:"Brian C. Lane" <bcl <at> redhat.com>
:Message #73 received at 15356-done <at> debbugs.gnu.org (full text, mbox):
From: Phillip Susi <psusi <at> ubuntu.com> To: 15356-done <at> debbugs.gnu.org Subject: Re: bug#15356: [PATCH 00/19] Fedora parted patches Date: Sun, 02 Mar 2014 23:16:45 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Patches pushed, save for the dasd patches which will need resubmitted when cleaned up. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCgAGBQJTFAItAAoJEI5FoCIzSKrw8hUH+QH0avfvw2MPK36AUUr/SGRV xAE6pv8/USc/Daopm0YUxF7rR8cZqS0CkImotQiGf7ImKAqhpfnEO3zChqLi7L+k mqQ0HZYcCvfag6aJdSc3vuDY7mFNlAyReLs51en4JnokOB2PCDXiBSUWNorx3eAI uXrWCqB0geWHNiltU6AthGFlUrTMzF9N8Bh4TWEcFNbSjlwaig2a+oGHHBq3hXF5 Iy+xOef22bzDFABpBROpXKy/Ivv7zQi5jnMiG2gk4bh8g8mYhI8EOFDMTZqWtrQk obFhgorJk/AsmMahtJBvx7iripJIFsmkZbn+8hMh82m1rvrmqWBZMe0S/Tc/x+Q= =ae2q -----END PGP SIGNATURE-----
Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Mon, 31 Mar 2014 11:24:04 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.