OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [include/] [asm-s390x/] [vtoc.h] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.