summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNageswara R Sastry <rnsastry@linux.vnet.ibm.com>2013-08-21 16:27:13 -0700
committerBrian C. Lane <bcl@redhat.com>2014-04-29 11:42:21 -0700
commitcbec53fdb9c8b244b497e42b0b215a8276803a88 (patch)
tree25438b9793ab7daabb65c933c217451049f4489b /include
parentf70ff1fc474764c3a71318ddb4e0d26afc52ac47 (diff)
downloadparted-cbec53fdb9c8b244b497e42b0b215a8276803a88.tar.gz
libparted: add support for EAV DASD partitions
Extended Address Volume (EAV) DASDs are ECKD DASDs with more than 65520 cylinders. This patch adds support for recognizing and modifying partitions on EAV DASDs to Parted. The changes are based on the EAV support added to version 1.8.1 [1] of the s390-tools package. [1] http://www.ibm.com/developerworks/linux/linux390/s390-tools-1.8.1.html Signed-off-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com> Signed-off-by: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
Diffstat (limited to 'include')
-rw-r--r--include/parted/fdasd.in.h89
-rw-r--r--include/parted/vtoc.in.h59
2 files changed, 130 insertions, 18 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 */