aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390
diff options
context:
space:
mode:
authorPeter Oberparleiter <peter.oberparleiter@de.ibm.com>2005-11-07 03:59:09 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:34 -0500
commit4cd5b9f6df96494b8667deea71b61b66f783cca3 (patch)
treeb8a1be3ed691c0624777c00317bfecc86fd3d1b5 /include/asm-s390
parent1e0291bade7678efe4d3ab70ed14bd7bd216bcef (diff)
[PATCH] s390: cleanup of include/asm-s390/vtoc.h
Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-s390')
-rw-r--r--include/asm-s390/vtoc.h505
1 files changed, 156 insertions, 349 deletions
diff --git a/include/asm-s390/vtoc.h b/include/asm-s390/vtoc.h
index a14e34e80b88..41d369f38b0e 100644
--- a/include/asm-s390/vtoc.h
+++ b/include/asm-s390/vtoc.h
@@ -1,372 +1,179 @@
1#ifndef __KERNEL__ 1/*
2#include <string.h> 2 * include/asm-s390/vtoc.h
3#include <stdlib.h> 3 *
4#include <stdio.h> 4 * This file contains volume label definitions for DASD devices.
5#include <errno.h> 5 *
6#include <ctype.h> 6 * (C) Copyright IBM Corp. 2005
7#include <time.h> 7 *
8#include <fcntl.h> 8 * Author(s): Volker Sameske <sameske@de.ibm.com>
9#include <unistd.h> 9 *
10 */
11
12#ifndef _ASM_S390_VTOC_H
13#define _ASM_S390_VTOC_H
10 14
11#include <sys/stat.h>
12#include <sys/ioctl.h>
13
14#include <linux/fs.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/hdreg.h>
17#include <asm/dasd.h>
18#endif
19
20
21#define LINE_LENGTH 80
22#define VTOC_START_CC 0x0
23#define VTOC_START_HH 0x1
24#define FIRST_USABLE_CYL 1
25#define FIRST_USABLE_TRK 2
26
27#define DASD_3380_TYPE 13148
28#define DASD_3390_TYPE 13200
29#define DASD_9345_TYPE 37701
30
31#define DASD_3380_VALUE 0xbb60
32#define DASD_3390_VALUE 0xe5a2
33#define DASD_9345_VALUE 0xbc98
34
35#define VOLSER_LENGTH 6
36#define BIG_DISK_SIZE 0x10000
37
38#define VTOC_ERROR "VTOC error:"
39
40 16
41typedef struct ttr 17struct vtoc_ttr
42{ 18{
43 __u16 tt; 19 __u16 tt;
44 __u8 r; 20 __u8 r;
45} __attribute__ ((packed)) ttr_t; 21} __attribute__ ((packed));
46 22
47typedef struct cchhb 23struct vtoc_cchhb
48{ 24{
49 __u16 cc; 25 __u16 cc;
50 __u16 hh; 26 __u16 hh;
51 __u8 b; 27 __u8 b;
52} __attribute__ ((packed)) cchhb_t; 28} __attribute__ ((packed));
53 29
54typedef struct cchh 30struct vtoc_cchh
55{ 31{
56 __u16 cc; 32 __u16 cc;
57 __u16 hh; 33 __u16 hh;
58} __attribute__ ((packed)) cchh_t; 34} __attribute__ ((packed));
59 35
60typedef struct labeldate 36struct vtoc_labeldate
61{ 37{
62 __u8 year; 38 __u8 year;
63 __u16 day; 39 __u16 day;
64} __attribute__ ((packed)) labeldate_t; 40} __attribute__ ((packed));
65 41
66 42struct vtoc_volume_label
67typedef struct volume_label
68{ 43{
69 char volkey[4]; /* volume key = volume label */ 44 char volkey[4]; /* volume key = volume label */
70 char vollbl[4]; /* volume label */ 45 char vollbl[4]; /* volume label */
71 char volid[6]; /* volume identifier */ 46 char volid[6]; /* volume identifier */
72 __u8 security; /* security byte */ 47 __u8 security; /* security byte */
73 cchhb_t vtoc; /* VTOC address */ 48 struct vtoc_cchhb vtoc; /* VTOC address */
74 char res1[5]; /* reserved */ 49 char res1[5]; /* reserved */
75 char cisize[4]; /* CI-size for FBA,... */ 50 char cisize[4]; /* CI-size for FBA,... */
76 /* ...blanks for CKD */ 51 /* ...blanks for CKD */
77 char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */ 52 char blkperci[4]; /* no of blocks per CI (FBA), blanks for CKD */
78 char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */ 53 char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */
79 char res2[4]; /* reserved */ 54 char res2[4]; /* reserved */
80 char lvtoc[14]; /* owner code for LVTOC */ 55 char lvtoc[14]; /* owner code for LVTOC */
81 char res3[29]; /* reserved */ 56 char res3[29]; /* reserved */
82} __attribute__ ((packed)) volume_label_t; 57} __attribute__ ((packed));
83 58
84 59struct vtoc_extent
85typedef struct extent
86{ 60{
87 __u8 typeind; /* extent type indicator */ 61 __u8 typeind; /* extent type indicator */
88 __u8 seqno; /* extent sequence number */ 62 __u8 seqno; /* extent sequence number */
89 cchh_t llimit; /* starting point of this extent */ 63 struct vtoc_cchh llimit; /* starting point of this extent */
90 cchh_t ulimit; /* ending point of this extent */ 64 struct vtoc_cchh ulimit; /* ending point of this extent */
91} __attribute__ ((packed)) extent_t; 65} __attribute__ ((packed));
92
93 66
94typedef struct dev_const 67struct vtoc_dev_const
95{ 68{
96 __u16 DS4DSCYL; /* number of logical cyls */ 69 __u16 DS4DSCYL; /* number of logical cyls */
97 __u16 DS4DSTRK; /* number of tracks in a logical cylinder */ 70 __u16 DS4DSTRK; /* number of tracks in a logical cylinder */
98 __u16 DS4DEVTK; /* device track length */ 71 __u16 DS4DEVTK; /* device track length */
99 __u8 DS4DEVI; /* non-last keyed record overhead */ 72 __u8 DS4DEVI; /* non-last keyed record overhead */
100 __u8 DS4DEVL; /* last keyed record overhead */ 73 __u8 DS4DEVL; /* last keyed record overhead */
101 __u8 DS4DEVK; /* non-keyed record overhead differential */ 74 __u8 DS4DEVK; /* non-keyed record overhead differential */
102 __u8 DS4DEVFG; /* flag byte */ 75 __u8 DS4DEVFG; /* flag byte */
103 __u16 DS4DEVTL; /* device tolerance */ 76 __u16 DS4DEVTL; /* device tolerance */
104 __u8 DS4DEVDT; /* number of DSCB's per track */ 77 __u8 DS4DEVDT; /* number of DSCB's per track */
105 __u8 DS4DEVDB; /* number of directory blocks per track */ 78 __u8 DS4DEVDB; /* number of directory blocks per track */
106} __attribute__ ((packed)) dev_const_t; 79} __attribute__ ((packed));
107 80
108 81struct vtoc_format1_label
109typedef struct format1_label
110{ 82{
111 char DS1DSNAM[44]; /* data set name */ 83 char DS1DSNAM[44]; /* data set name */
112 __u8 DS1FMTID; /* format identifier */ 84 __u8 DS1FMTID; /* format identifier */
113 char DS1DSSN[6]; /* data set serial number */ 85 char DS1DSSN[6]; /* data set serial number */
114 __u16 DS1VOLSQ; /* volume sequence number */ 86 __u16 DS1VOLSQ; /* volume sequence number */
115 labeldate_t DS1CREDT; /* creation date: ydd */ 87 struct vtoc_labeldate DS1CREDT; /* creation date: ydd */
116 labeldate_t DS1EXPDT; /* expiration date */ 88 struct vtoc_labeldate DS1EXPDT; /* expiration date */
117 __u8 DS1NOEPV; /* number of extents on volume */ 89 __u8 DS1NOEPV; /* number of extents on volume */
118 __u8 DS1NOBDB; /* no. of bytes used in last direction blk */ 90 __u8 DS1NOBDB; /* no. of bytes used in last direction blk */
119 __u8 DS1FLAG1; /* flag 1 */ 91 __u8 DS1FLAG1; /* flag 1 */
120 char DS1SYSCD[13]; /* system code */ 92 char DS1SYSCD[13]; /* system code */
121 labeldate_t DS1REFD; /* date last referenced */ 93 struct vtoc_labeldate DS1REFD; /* date last referenced */
122 __u8 DS1SMSFG; /* system managed storage indicators */ 94 __u8 DS1SMSFG; /* system managed storage indicators */
123 __u8 DS1SCXTF; /* sec. space extension flag byte */ 95 __u8 DS1SCXTF; /* sec. space extension flag byte */
124 __u16 DS1SCXTV; /* secondary space extension value */ 96 __u16 DS1SCXTV; /* secondary space extension value */
125 __u8 DS1DSRG1; /* data set organisation byte 1 */ 97 __u8 DS1DSRG1; /* data set organisation byte 1 */
126 __u8 DS1DSRG2; /* data set organisation byte 2 */ 98 __u8 DS1DSRG2; /* data set organisation byte 2 */
127 __u8 DS1RECFM; /* record format */ 99 __u8 DS1RECFM; /* record format */
128 __u8 DS1OPTCD; /* option code */ 100 __u8 DS1OPTCD; /* option code */
129 __u16 DS1BLKL; /* block length */ 101 __u16 DS1BLKL; /* block length */
130 __u16 DS1LRECL; /* record length */ 102 __u16 DS1LRECL; /* record length */
131 __u8 DS1KEYL; /* key length */ 103 __u8 DS1KEYL; /* key length */
132 __u16 DS1RKP; /* relative key position */ 104 __u16 DS1RKP; /* relative key position */
133 __u8 DS1DSIND; /* data set indicators */ 105 __u8 DS1DSIND; /* data set indicators */
134 __u8 DS1SCAL1; /* secondary allocation flag byte */ 106 __u8 DS1SCAL1; /* secondary allocation flag byte */
135 char DS1SCAL3[3]; /* secondary allocation quantity */ 107 char DS1SCAL3[3]; /* secondary allocation quantity */
136 ttr_t DS1LSTAR; /* last used track and block on track */ 108 struct vtoc_ttr DS1LSTAR; /* last used track and block on track */
137 __u16 DS1TRBAL; /* space remaining on last used track */ 109 __u16 DS1TRBAL; /* space remaining on last used track */
138 __u16 res1; /* reserved */ 110 __u16 res1; /* reserved */
139 extent_t DS1EXT1; /* first extent description */ 111 struct vtoc_extent DS1EXT1; /* first extent description */
140 extent_t DS1EXT2; /* second extent description */ 112 struct vtoc_extent DS1EXT2; /* second extent description */
141 extent_t DS1EXT3; /* third extent description */ 113 struct vtoc_extent DS1EXT3; /* third extent description */
142 cchhb_t DS1PTRDS; /* possible pointer to f2 or f3 DSCB */ 114 struct vtoc_cchhb DS1PTRDS; /* possible pointer to f2 or f3 DSCB */
143} __attribute__ ((packed)) format1_label_t; 115} __attribute__ ((packed));
144 116
145 117struct vtoc_format4_label
146typedef struct format4_label
147{ 118{
148 char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */ 119 char DS4KEYCD[44]; /* key code for VTOC labels: 44 times 0x04 */
149 __u8 DS4IDFMT; /* format identifier */ 120 __u8 DS4IDFMT; /* format identifier */
150 cchhb_t DS4HPCHR; /* highest address of a format 1 DSCB */ 121 struct vtoc_cchhb DS4HPCHR; /* highest address of a format 1 DSCB */
151 __u16 DS4DSREC; /* number of available DSCB's */ 122 __u16 DS4DSREC; /* number of available DSCB's */
152 cchh_t DS4HCCHH; /* CCHH of next available alternate track */ 123 struct vtoc_cchh DS4HCCHH; /* CCHH of next available alternate track */
153 __u16 DS4NOATK; /* number of remaining alternate tracks */ 124 __u16 DS4NOATK; /* number of remaining alternate tracks */
154 __u8 DS4VTOCI; /* VTOC indicators */ 125 __u8 DS4VTOCI; /* VTOC indicators */
155 __u8 DS4NOEXT; /* number of extents in VTOC */ 126 __u8 DS4NOEXT; /* number of extents in VTOC */
156 __u8 DS4SMSFG; /* system managed storage indicators */ 127 __u8 DS4SMSFG; /* system managed storage indicators */
157 __u8 DS4DEVAC; /* number of alternate cylinders. 128 __u8 DS4DEVAC; /* number of alternate cylinders.
158 Subtract from first two bytes of 129 * Subtract from first two bytes of
159 DS4DEVSZ to get number of usable 130 * DS4DEVSZ to get number of usable
160 cylinders. can be zero. valid 131 * cylinders. can be zero. valid
161 only if DS4DEVAV on. */ 132 * only if DS4DEVAV on. */
162 dev_const_t DS4DEVCT; /* device constants */ 133 struct vtoc_dev_const DS4DEVCT; /* device constants */
163 char DS4AMTIM[8]; /* VSAM time stamp */ 134 char DS4AMTIM[8]; /* VSAM time stamp */
164 char DS4AMCAT[3]; /* VSAM catalog indicator */ 135 char DS4AMCAT[3]; /* VSAM catalog indicator */
165 char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */ 136 char DS4R2TIM[8]; /* VSAM volume/catalog match time stamp */
166 char res1[5]; /* reserved */ 137 char res1[5]; /* reserved */
167 char DS4F6PTR[5]; /* pointer to first format 6 DSCB */ 138 char DS4F6PTR[5]; /* pointer to first format 6 DSCB */
168 extent_t DS4VTOCE; /* VTOC extent description */ 139 struct vtoc_extent DS4VTOCE; /* VTOC extent description */
169 char res2[10]; /* reserved */ 140 char res2[10]; /* reserved */
170 __u8 DS4EFLVL; /* extended free-space management level */ 141 __u8 DS4EFLVL; /* extended free-space management level */
171 cchhb_t DS4EFPTR; /* pointer to extended free-space info */ 142 struct vtoc_cchhb DS4EFPTR; /* pointer to extended free-space info */
172 char res3[9]; /* reserved */ 143 char res3[9]; /* reserved */
173} __attribute__ ((packed)) format4_label_t; 144} __attribute__ ((packed));
174 145
175 146struct vtoc_ds5ext
176typedef struct ds5ext
177{ 147{
178 __u16 t; /* RTA of the first track of free extent */ 148 __u16 t; /* RTA of the first track of free extent */
179 __u16 fc; /* number of whole cylinders in free ext. */ 149 __u16 fc; /* number of whole cylinders in free ext. */
180 __u8 ft; /* number of remaining free tracks */ 150 __u8 ft; /* number of remaining free tracks */
181} __attribute__ ((packed)) ds5ext_t; 151} __attribute__ ((packed));
182
183 152
184typedef struct format5_label 153struct vtoc_format5_label
185{ 154{
186 char DS5KEYID[4]; /* key identifier */ 155 char DS5KEYID[4]; /* key identifier */
187 ds5ext_t DS5AVEXT; /* first available (free-space) extent. */ 156 struct vtoc_ds5ext DS5AVEXT; /* first available (free-space) extent. */
188 ds5ext_t DS5EXTAV[7]; /* seven available extents */ 157 struct vtoc_ds5ext DS5EXTAV[7]; /* seven available extents */
189 __u8 DS5FMTID; /* format identifier */ 158 __u8 DS5FMTID; /* format identifier */
190 ds5ext_t DS5MAVET[18]; /* eighteen available extents */ 159 struct vtoc_ds5ext DS5MAVET[18]; /* eighteen available extents */
191 cchhb_t DS5PTRDS; /* pointer to next format5 DSCB */ 160 struct vtoc_cchhb DS5PTRDS; /* pointer to next format5 DSCB */
192} __attribute__ ((packed)) format5_label_t; 161} __attribute__ ((packed));
193 162
194 163struct vtoc_ds7ext
195typedef struct ds7ext
196{ 164{
197 __u32 a; /* starting RTA value */ 165 __u32 a; /* starting RTA value */
198 __u32 b; /* ending RTA value + 1 */ 166 __u32 b; /* ending RTA value + 1 */
199} __attribute__ ((packed)) ds7ext_t; 167} __attribute__ ((packed));
200 168
201 169struct vtoc_format7_label
202typedef struct format7_label
203{ 170{
204 char DS7KEYID[4]; /* key identifier */ 171 char DS7KEYID[4]; /* key identifier */
205 ds7ext_t DS7EXTNT[5]; /* space for 5 extent descriptions */ 172 struct vtoc_ds7ext DS7EXTNT[5]; /* space for 5 extent descriptions */
206 __u8 DS7FMTID; /* format identifier */ 173 __u8 DS7FMTID; /* format identifier */
207 ds7ext_t DS7ADEXT[11]; /* space for 11 extent descriptions */ 174 struct vtoc_ds7ext DS7ADEXT[11]; /* space for 11 extent descriptions */
208 char res1[2]; /* reserved */ 175 char res1[2]; /* reserved */
209 cchhb_t DS7PTRDS; /* pointer to next FMT7 DSCB */ 176 struct vtoc_cchhb DS7PTRDS; /* pointer to next FMT7 DSCB */
210} __attribute__ ((packed)) format7_label_t; 177} __attribute__ ((packed));
211 178
212 179#endif /* _ASM_S390_VTOC_H */
213char * vtoc_ebcdic_enc (
214 unsigned char source[LINE_LENGTH],
215 unsigned char target[LINE_LENGTH],
216 int l);
217char * vtoc_ebcdic_dec (
218 unsigned char source[LINE_LENGTH],
219 unsigned char target[LINE_LENGTH],
220 int l);
221void vtoc_set_extent (
222 extent_t * ext,
223 __u8 typeind,
224 __u8 seqno,
225 cchh_t * lower,
226 cchh_t * upper);
227void vtoc_set_cchh (
228 cchh_t * addr,
229 __u16 cc,
230 __u16 hh);
231void vtoc_set_cchhb (
232 cchhb_t * addr,
233 __u16 cc,
234 __u16 hh,
235 __u8 b);
236void vtoc_set_date (
237 labeldate_t * d,
238 __u8 year,
239 __u16 day);
240
241void vtoc_volume_label_init (
242 volume_label_t *vlabel);
243
244int vtoc_read_volume_label (
245 char * device,
246 unsigned long vlabel_start,
247 volume_label_t * vlabel);
248
249int vtoc_write_volume_label (
250 char *device,
251 unsigned long vlabel_start,
252 volume_label_t *vlabel);
253
254void vtoc_volume_label_set_volser (
255 volume_label_t *vlabel,
256 char *volser);
257
258char *vtoc_volume_label_get_volser (
259 volume_label_t *vlabel,
260 char *volser);
261
262void vtoc_volume_label_set_key (
263 volume_label_t *vlabel,
264 char *key);
265
266void vtoc_volume_label_set_label (
267 volume_label_t *vlabel,
268 char *lbl);
269
270char *vtoc_volume_label_get_label (
271 volume_label_t *vlabel,
272 char *lbl);
273
274void vtoc_read_label (
275 char *device,
276 unsigned long position,
277 format1_label_t *f1,
278 format4_label_t *f4,
279 format5_label_t *f5,
280 format7_label_t *f7);
281
282void vtoc_write_label (
283 char *device,
284 unsigned long position,
285 format1_label_t *f1,
286 format4_label_t *f4,
287 format5_label_t *f5,
288 format7_label_t *f7);
289
290
291void vtoc_init_format1_label (
292 char *volid,
293 unsigned int blksize,
294 extent_t *part_extent,
295 format1_label_t *f1);
296
297
298void vtoc_init_format4_label (
299 format4_label_t *f4lbl,
300 unsigned int usable_partitions,
301 unsigned int cylinders,
302 unsigned int tracks,
303 unsigned int blocks,
304 unsigned int blksize,
305 __u16 dev_type);
306
307void vtoc_update_format4_label (
308 format4_label_t *f4,
309 cchhb_t *highest_f1,
310 __u16 unused_update);
311
312
313void vtoc_init_format5_label (
314 format5_label_t *f5);
315
316void vtoc_update_format5_label_add (
317 format5_label_t *f5,
318 int verbose,
319 int cyl,
320 int trk,
321 __u16 a,
322 __u16 b,
323 __u8 c);
324
325void vtoc_update_format5_label_del (
326 format5_label_t *f5,
327 int verbose,
328 int cyl,
329 int trk,
330 __u16 a,
331 __u16 b,
332 __u8 c);
333
334
335void vtoc_init_format7_label (
336 format7_label_t *f7);
337
338void vtoc_update_format7_label_add (
339 format7_label_t *f7,
340 int verbose,
341 __u32 a,
342 __u32 b);
343
344void vtoc_update_format7_label_del (
345 format7_label_t *f7,
346 int verbose,
347 __u32 a,
348 __u32 b);
349
350
351void vtoc_set_freespace(
352 format4_label_t *f4,
353 format5_label_t *f5,
354 format7_label_t *f7,
355 char ch,
356 int verbose,
357 __u32 start,
358 __u32 stop,
359 int cyl,
360 int trk);
361
362
363
364
365
366
367
368
369
370
371
372