|
|
8dc857 |
Subject: [PATCH] libparted: mklabel to support EAV DASD
|
|
|
8dc857 |
|
|
|
8dc857 |
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
|
|
|
8dc857 |
|
|
|
8dc857 |
Extended Address Volume (EAV) DASDs are ECKD DASDs with more than
|
|
|
8dc857 |
65520 cylinders. This patch adds support for mklabel to properly
|
|
|
8dc857 |
handle unformatted EAV DASDs.
|
|
|
8dc857 |
|
|
|
8dc857 |
Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
|
|
|
8dc857 |
---
|
|
|
8dc857 |
include/parted/fdasd.h | 1
|
|
|
8dc857 |
libparted/labels/fdasd.c | 92 +++++++++++++++++++++++++++++++++++++++++++++-
|
|
|
8dc857 |
2 files changed, 90 insertions(+), 3 deletions(-)
|
|
|
8dc857 |
|
|
|
8dc857 |
--- a/include/parted/fdasd.h
|
|
|
8dc857 |
+++ b/include/parted/fdasd.h
|
|
|
8dc857 |
@@ -288,7 +288,6 @@ void fdasd_get_geometry (const PedDevice
|
|
|
8dc857 |
void fdasd_check_api_version (fdasd_anchor_t *anc, int fd);
|
|
|
8dc857 |
int fdasd_check_volume (fdasd_anchor_t *anc, int fd);
|
|
|
8dc857 |
int fdasd_write_labels (fdasd_anchor_t *anc, int fd);
|
|
|
8dc857 |
-int fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc);
|
|
|
8dc857 |
void fdasd_recreate_vtoc(fdasd_anchor_t *anc);
|
|
|
8dc857 |
partition_info_t * fdasd_add_partition (fdasd_anchor_t *anc,
|
|
|
8dc857 |
unsigned int start, unsigned int stop);
|
|
|
8dc857 |
--- a/libparted/labels/fdasd.c
|
|
|
8dc857 |
+++ b/libparted/labels/fdasd.c
|
|
|
8dc857 |
@@ -581,6 +581,22 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc
|
|
|
8dc857 |
anc->vtoc_changed++;
|
|
|
8dc857 |
}
|
|
|
8dc857 |
|
|
|
8dc857 |
+ /*
|
|
|
8dc857 |
+ * initialize the VOL1 volume label
|
|
|
8dc857 |
+ */
|
|
|
8dc857 |
+static void
|
|
|
8dc857 |
+fdasd_init_volume_label(fdasd_anchor_t *anc, int fd)
|
|
|
8dc857 |
+{
|
|
|
8dc857 |
+ volume_label_t *vlabel = anc->vlabel;
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ vtoc_volume_label_init(vlabel);
|
|
|
8dc857 |
+ vtoc_volume_label_set_key(vlabel, "VOL1");
|
|
|
8dc857 |
+ vtoc_volume_label_set_label(vlabel, "VOL1");
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ vtoc_set_cchhb(&vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01);
|
|
|
8dc857 |
+}
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+
|
|
|
8dc857 |
/*
|
|
|
8dc857 |
* sets some important partition data
|
|
|
8dc857 |
* (like used, start_trk, end_trk, len_trk)
|
|
|
8dc857 |
@@ -769,6 +785,52 @@ fdasd_process_valid_vtoc (fdasd_anchor_t
|
|
|
8dc857 |
fdasd_update_partition_info (anc);
|
|
|
8dc857 |
}
|
|
|
8dc857 |
|
|
|
8dc857 |
+static void
|
|
|
8dc857 |
+fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc)
|
|
|
8dc857 |
+{
|
|
|
8dc857 |
+ PDEBUG
|
|
|
8dc857 |
+ anc->formatted_cylinders = anc->hw_cylinders;
|
|
|
8dc857 |
+ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads
|
|
|
8dc857 |
+ - FIRST_USABLE_TRK;
|
|
|
8dc857 |
+ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
|
|
|
8dc857 |
+ anc->geo.cylinders, anc->formatted_cylinders,
|
|
|
8dc857 |
+ anc->geo.heads, anc->geo.sectors,
|
|
|
8dc857 |
+ anc->blksize, anc->dev_type);
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ vtoc_init_format5_label(anc->f5);
|
|
|
8dc857 |
+ vtoc_init_format7_label(anc->f7);
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose,
|
|
|
8dc857 |
+ FIRST_USABLE_TRK,
|
|
|
8dc857 |
+ anc->formatted_cylinders * anc->geo.heads - 1,
|
|
|
8dc857 |
+ anc->formatted_cylinders, anc->geo.heads);
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ vtoc_set_cchhb(&anc->vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01);
|
|
|
8dc857 |
+}
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+/*
|
|
|
8dc857 |
+ * we have a invalid FMT4 DSCB and therefore we will re-create the VTOC
|
|
|
8dc857 |
+ */
|
|
|
8dc857 |
+static void
|
|
|
8dc857 |
+fdasd_process_invalid_vtoc(fdasd_anchor_t *anc)
|
|
|
8dc857 |
+{
|
|
|
8dc857 |
+ anc->formatted_cylinders = anc->hw_cylinders;
|
|
|
8dc857 |
+ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads
|
|
|
8dc857 |
+ - FIRST_USABLE_TRK;
|
|
|
8dc857 |
+ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
|
|
|
8dc857 |
+ anc->geo.cylinders, anc->formatted_cylinders,
|
|
|
8dc857 |
+ anc->geo.heads, anc->geo.sectors,
|
|
|
8dc857 |
+ anc->blksize, anc->dev_type);
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ vtoc_init_format5_label(anc->f5);
|
|
|
8dc857 |
+ vtoc_init_format7_label(anc->f7);
|
|
|
8dc857 |
+ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+', anc->verbose,
|
|
|
8dc857 |
+ FIRST_USABLE_TRK,
|
|
|
8dc857 |
+ anc->formatted_cylinders * anc->geo.heads - 1,
|
|
|
8dc857 |
+ anc->formatted_cylinders, anc->geo.heads);
|
|
|
8dc857 |
+}
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+
|
|
|
8dc857 |
static int
|
|
|
8dc857 |
fdasd_valid_vtoc_pointer(fdasd_anchor_t *anc, unsigned long b, int fd)
|
|
|
8dc857 |
{
|
|
|
8dc857 |
@@ -781,6 +843,8 @@ fdasd_valid_vtoc_pointer(fdasd_anchor_t
|
|
|
8dc857 |
if (anc->f4->DS4IDFMT == 0xf4) {
|
|
|
8dc857 |
fdasd_process_valid_vtoc (anc, b, fd);
|
|
|
8dc857 |
return 0;
|
|
|
8dc857 |
+ } else {
|
|
|
8dc857 |
+ fdasd_process_invalid_vtoc(anc);
|
|
|
8dc857 |
}
|
|
|
8dc857 |
if (strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("LNX1",str,4),4) == 0 ||
|
|
|
8dc857 |
strncmp(anc->vlabel->volkey, vtoc_ebcdic_enc("CMS1",str,4),4) == 0)
|
|
|
8dc857 |
@@ -817,13 +881,37 @@ fdasd_check_volume (fdasd_anchor_t *anc,
|
|
|
8dc857 |
else
|
|
|
8dc857 |
return 0;
|
|
|
8dc857 |
} else {
|
|
|
8dc857 |
- return 1;
|
|
|
8dc857 |
+ fdasd_invalid_vtoc_pointer(anc);
|
|
|
8dc857 |
}
|
|
|
8dc857 |
} else if (strncmp (v->volkey, vtoc_ebcdic_enc ("LNX1", str, 4), 4) == 0 ||
|
|
|
8dc857 |
strncmp (v->volkey, vtoc_ebcdic_enc ("CMS1", str, 4), 4) == 0) {
|
|
|
8dc857 |
return 0;
|
|
|
8dc857 |
+ } else if (anc->FBA_layout == 1) {
|
|
|
8dc857 |
+ /* Some times LDL formatted disks does not
|
|
|
8dc857 |
+ contain any volume label */
|
|
|
8dc857 |
+ return 1;
|
|
|
8dc857 |
+ } else {
|
|
|
8dc857 |
+ /* didn't find VOL1 volume label */
|
|
|
8dc857 |
+ anc->formatted_cylinders = anc->hw_cylinders;
|
|
|
8dc857 |
+ anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads
|
|
|
8dc857 |
+ - FIRST_USABLE_TRK;
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ fdasd_init_volume_label(anc, fd);
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ vtoc_init_format4_label(anc->f4, USABLE_PARTITIONS,
|
|
|
8dc857 |
+ anc->geo.cylinders, anc->formatted_cylinders,
|
|
|
8dc857 |
+ anc->geo.heads, anc->geo.sectors,
|
|
|
8dc857 |
+ anc->blksize, anc->dev_type);
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ vtoc_init_format5_label(anc->f5);
|
|
|
8dc857 |
+ vtoc_init_format7_label(anc->f7);
|
|
|
8dc857 |
+
|
|
|
8dc857 |
+ vtoc_set_freespace(anc->f4, anc->f5, anc->f7, '+',
|
|
|
8dc857 |
+ anc->verbose, FIRST_USABLE_TRK,
|
|
|
8dc857 |
+ anc->formatted_cylinders * anc->geo.heads - 1,
|
|
|
8dc857 |
+ anc->formatted_cylinders, anc->geo.heads);
|
|
|
8dc857 |
+ return 0;
|
|
|
8dc857 |
}
|
|
|
8dc857 |
-
|
|
|
8dc857 |
return 1;
|
|
|
8dc857 |
}
|
|
|
8dc857 |
|