xref: /openbmc/linux/arch/s390/include/uapi/asm/vtoc.h (revision 6c33a6f4)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * This file contains volume label definitions for DASD devices.
4  *
5  * Copyright IBM Corp. 2005
6  *
7  * Author(s): Volker Sameske <sameske@de.ibm.com>
8  *
9  */
10 
11 #ifndef _ASM_S390_VTOC_H
12 #define _ASM_S390_VTOC_H
13 
14 #include <linux/types.h>
15 
16 struct vtoc_ttr
17 {
18 	__u16 tt;
19 	__u8 r;
20 } __attribute__ ((packed));
21 
22 struct vtoc_cchhb
23 {
24 	__u16 cc;
25 	__u16 hh;
26 	__u8 b;
27 } __attribute__ ((packed));
28 
29 struct vtoc_cchh
30 {
31 	__u16 cc;
32 	__u16 hh;
33 } __attribute__ ((packed));
34 
35 struct vtoc_labeldate
36 {
37 	__u8 year;
38 	__u16 day;
39 } __attribute__ ((packed));
40 
41 struct vtoc_volume_label_cdl
42 {
43 	char volkey[4];		/* volume key = volume label */
44 	char vollbl[4];		/* volume label */
45 	char volid[6];		/* volume identifier */
46 	__u8 security;		/* security byte */
47 	struct vtoc_cchhb vtoc;	/* VTOC address */
48 	char res1[5];		/* reserved */
49 	char cisize[4];		/* CI-size for FBA,... */
50 				/* ...blanks for CKD */
51 	char blkperci[4];	/* no of blocks per CI (FBA), blanks for CKD */
52 	char labperci[4];	/* no of labels per CI (FBA), blanks for CKD */
53 	char res2[4];		/* reserved */
54 	char lvtoc[14];		/* owner code for LVTOC */
55 	char res3[29];		/* reserved */
56 } __attribute__ ((packed));
57 
58 struct vtoc_volume_label_ldl {
59 	char vollbl[4];		/* volume label */
60 	char volid[6];		/* volume identifier */
61 	char res3[69];		/* reserved */
62 	char ldl_version;	/* version number, valid for ldl format */
63 	__u64 formatted_blocks; /* valid when ldl_version >= f2  */
64 } __attribute__ ((packed));
65 
66 struct vtoc_extent
67 {
68 	__u8 typeind;			/* extent type indicator */
69 	__u8 seqno;			/* extent sequence number */
70 	struct vtoc_cchh llimit;	/* starting point of this extent */
71 	struct vtoc_cchh ulimit;	/* ending point of this extent */
72 } __attribute__ ((packed));
73 
74 struct vtoc_dev_const
75 {
76 	__u16 DS4DSCYL;	/* number of logical cyls */
77 	__u16 DS4DSTRK;	/* number of tracks in a logical cylinder */
78 	__u16 DS4DEVTK;	/* device track length */
79 	__u8 DS4DEVI;	/* non-last keyed record overhead */
80 	__u8 DS4DEVL;	/* last keyed record overhead */
81 	__u8 DS4DEVK;	/* non-keyed record overhead differential */
82 	__u8 DS4DEVFG;	/* flag byte */
83 	__u16 DS4DEVTL;	/* device tolerance */
84 	__u8 DS4DEVDT;	/* number of DSCB's per track */
85 	__u8 DS4DEVDB;	/* number of directory blocks per track */
86 } __attribute__ ((packed));
87 
88 struct vtoc_format1_label
89 {
90 	char DS1DSNAM[44];	/* data set name */
91 	__u8 DS1FMTID;		/* format identifier */
92 	char DS1DSSN[6];	/* data set serial number */
93 	__u16 DS1VOLSQ;		/* volume sequence number */
94 	struct vtoc_labeldate DS1CREDT; /* creation date: ydd */
95 	struct vtoc_labeldate DS1EXPDT; /* expiration date */
96 	__u8 DS1NOEPV;		/* number of extents on volume */
97 	__u8 DS1NOBDB;		/* no. of bytes used in last direction blk */
98 	__u8 DS1FLAG1;		/* flag 1 */
99 	char DS1SYSCD[13];	/* system code */
100 	struct vtoc_labeldate DS1REFD; /* date last referenced	*/
101 	__u8 DS1SMSFG;		/* system managed storage indicators */
102 	__u8 DS1SCXTF;		/* sec. space extension flag byte */
103 	__u16 DS1SCXTV;		/* secondary space extension value */
104 	__u8 DS1DSRG1;		/* data set organisation byte 1 */
105 	__u8 DS1DSRG2;		/* data set organisation byte 2 */
106 	__u8 DS1RECFM;		/* record format */
107 	__u8 DS1OPTCD;		/* option code */
108 	__u16 DS1BLKL;		/* block length */
109 	__u16 DS1LRECL;		/* record length */
110 	__u8 DS1KEYL;		/* key length */
111 	__u16 DS1RKP;		/* relative key position */
112 	__u8 DS1DSIND;		/* data set indicators */
113 	__u8 DS1SCAL1;		/* secondary allocation flag byte */
114 	char DS1SCAL3[3];	/* secondary allocation quantity */
115 	struct vtoc_ttr DS1LSTAR; /* last used track and block on track */
116 	__u16 DS1TRBAL;		/* space remaining on last used track */
117 	__u16 res1;		/* reserved */
118 	struct vtoc_extent DS1EXT1; /* first extent description */
119 	struct vtoc_extent DS1EXT2; /* second extent description */
120 	struct vtoc_extent DS1EXT3; /* third extent description */
121 	struct vtoc_cchhb DS1PTRDS; /* possible pointer to f2 or f3 DSCB */
122 } __attribute__ ((packed));
123 
124 struct vtoc_format4_label
125 {
126 	char DS4KEYCD[44];	/* key code for VTOC labels: 44 times 0x04 */
127 	__u8 DS4IDFMT;		/* format identifier */
128 	struct vtoc_cchhb DS4HPCHR; /* highest address of a format 1 DSCB */
129 	__u16 DS4DSREC;		/* number of available DSCB's */
130 	struct vtoc_cchh DS4HCCHH; /* CCHH of next available alternate track */
131 	__u16 DS4NOATK;		/* number of remaining alternate tracks */
132 	__u8 DS4VTOCI;		/* VTOC indicators */
133 	__u8 DS4NOEXT;		/* number of extents in VTOC */
134 	__u8 DS4SMSFG;		/* system managed storage indicators */
135 	__u8 DS4DEVAC;		/* number of alternate cylinders.
136 				 * Subtract from first two bytes of
137 				 * DS4DEVSZ to get number of usable
138 				 * cylinders. can be zero. valid
139 				 * only if DS4DEVAV on. */
140 	struct vtoc_dev_const DS4DEVCT;	/* device constants */
141 	char DS4AMTIM[8];	/* VSAM time stamp */
142 	char DS4AMCAT[3];	/* VSAM catalog indicator */
143 	char DS4R2TIM[8];	/* VSAM volume/catalog match time stamp */
144 	char res1[5];		/* reserved */
145 	char DS4F6PTR[5];	/* pointer to first format 6 DSCB */
146 	struct vtoc_extent DS4VTOCE; /* VTOC extent description */
147 	char res2[10];		/* reserved */
148 	__u8 DS4EFLVL;		/* extended free-space management level */
149 	struct vtoc_cchhb DS4EFPTR; /* pointer to extended free-space info */
150 	char res3;		/* reserved */
151 	__u32 DS4DCYL;		/* number of logical cyls */
152 	char res4[2];		/* reserved */
153 	__u8 DS4DEVF2;		/* device flags */
154 	char res5;		/* reserved */
155 } __attribute__ ((packed));
156 
157 struct vtoc_ds5ext
158 {
159 	__u16 t;	/* RTA of the first track of free extent */
160 	__u16 fc;	/* number of whole cylinders in free ext. */
161 	__u8 ft;	/* number of remaining free tracks */
162 } __attribute__ ((packed));
163 
164 struct vtoc_format5_label
165 {
166 	char DS5KEYID[4];	/* key identifier */
167 	struct vtoc_ds5ext DS5AVEXT; /* first available (free-space) extent. */
168 	struct vtoc_ds5ext DS5EXTAV[7]; /* seven available extents */
169 	__u8 DS5FMTID;		/* format identifier */
170 	struct vtoc_ds5ext DS5MAVET[18]; /* eighteen available extents */
171 	struct vtoc_cchhb DS5PTRDS; /* pointer to next format5 DSCB */
172 } __attribute__ ((packed));
173 
174 struct vtoc_ds7ext
175 {
176 	__u32 a; /* starting RTA value */
177 	__u32 b; /* ending RTA value + 1 */
178 } __attribute__ ((packed));
179 
180 struct vtoc_format7_label
181 {
182 	char DS7KEYID[4];	/* key identifier */
183 	struct vtoc_ds7ext DS7EXTNT[5]; /* space for 5 extent descriptions */
184 	__u8 DS7FMTID;		/* format identifier */
185 	struct vtoc_ds7ext DS7ADEXT[11]; /* space for 11 extent descriptions */
186 	char res1[2];		/* reserved */
187 	struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */
188 } __attribute__ ((packed));
189 
190 struct vtoc_cms_label {
191 	__u8 label_id[4];		/* Label identifier */
192 	__u8 vol_id[6];		/* Volid */
193 	__u16 version_id;		/* Version identifier */
194 	__u32 block_size;		/* Disk block size */
195 	__u32 origin_ptr;		/* Disk origin pointer */
196 	__u32 usable_count;	/* Number of usable cylinders/blocks */
197 	__u32 formatted_count;	/* Maximum number of formatted cylinders/
198 				 * blocks */
199 	__u32 block_count;	/* Disk size in CMS blocks */
200 	__u32 used_count;		/* Number of CMS blocks in use */
201 	__u32 fst_size;		/* File Status Table (FST) size */
202 	__u32 fst_count;		/* Number of FSTs per CMS block */
203 	__u8 format_date[6];	/* Disk FORMAT date */
204 	__u8 reserved1[2];
205 	__u32 disk_offset;	/* Disk offset when reserved*/
206 	__u32 map_block;		/* Allocation Map Block with next hole */
207 	__u32 hblk_disp;		/* Displacement into HBLK data of next hole */
208 	__u32 user_disp;		/* Displacement into user part of Allocation
209 				 * map */
210 	__u8 reserved2[4];
211 	__u8 segment_name[8];	/* Name of shared segment */
212 } __attribute__ ((packed));
213 
214 #endif /* _ASM_S390_VTOC_H */
215