loader: remove shouting from ORB's variable name
[hvf.git] / cp / include / edf.h
blobccc54ee52692ba65038cd15488e068aa6e0c2267
1 /*
2 * (C) Copyright 2007-2011 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
5 * details.
6 */
8 #ifndef __EDF_H
9 #define __EDF_H
11 #include <mutex.h>
12 #include <device.h>
14 struct ADT {
15 u32 IDENT; /* VOL START / LABEL IDENTIFIER */
16 #define __ADTIDENT 0xC3D4E2F1 /* 'CMS1' in EBCDIC */
17 u8 ID[6]; /* VOL START / VOL IDENTIFIER */
18 u8 VER[2]; /* VERSION LEVEL */
19 u32 DBSIZ; /* DISK BLOCK SIZE */
20 u32 DOP; /* DISK ORIGIN POINTER */
21 u32 CYL; /* NUM OF FORMATTED CYL ON DISK */
22 u32 MCYL; /* MAX NUM FORMATTED CYL ON DISK */
23 u32 NUM; /* Number of Blocks on disk */
24 u32 USED; /* Number of Blocks used */
25 u32 FSTSZ; /* SIZE OF FST */
26 u32 NFST; /* NUMBER OF FST'S PER BLOCK */
27 u8 DCRED[6]; /* DISK CREATION DATE (YYMMDDHHMMSS) */
28 u8 FLGL; /* LABEL FLAG BYTE (ADTFLGL) */
29 #define ADTCNTRY 0x01 /* Century for disk creation date (0=19, 1=20),
30 * corresponds to ADTDCRED. */
31 u8 reserved[1];
32 u32 OFFST; /* DISK OFFSET WHEN RESERVED */
33 u32 AMNB; /* ALLOC MAP BLOCK WITH NEXT HOLE */
34 u32 AMND; /* DISP INTO HBLK DATA OF NEXT HOLE */
35 u32 AMUP; /* DISP INTO USER PART OF ALLOC MAP */
36 u32 OFCNT; /* Count of SFS open files for this ADT */
37 u8 SFNAM[8]; /* NAME OF SHARED SEGMENT */
40 struct FST {
41 u8 FNAME[8]; /* filename */
42 u8 FTYPE[8]; /* filetype */
43 u8 DATEW[2]; /* DATE LAST WRITTEN - MMDD */
44 u8 TIMEW[2]; /* TIME LAST WRITTEN - HHMM */
45 u16 WRPNT; /* WRITE POINTER - ITEM NUMBER */
46 u16 RDPNT; /* READ POINTER - ITEM NUMBER */
47 u8 FMODE[2]; /* FILE MODE - LETTER AND NUMBER */
48 u16 RECCT; /* NUMBER OF LOGICAL RECORDS */
49 u16 FCLPT; /* FIRST CHAIN LINK POINTER */
50 u8 RECFM; /* F*1 - RECORD FORMAT - F OR V */
51 #define FSTDFIX 0xC6 /* Fixed record format (EBCDIC 'F') */
52 #define FSTDVAR 0xE5 /* Variable record format (EBCDIC 'V') */
53 u8 FLAGS; /* F*2 - FST FLAG BYTE */
54 #define FSTRWDSK 0x80 /* READ/WRITE DISK */
55 #define FSTRODSK 0x00 /* READ/ONLY DISK */
56 #define FSTDSFS 0x10 /* Shared File FST */
57 #define FSTXRDSK 0x40 /* EXTENSION OF R/O DISK */
58 #define FSTXWDSK 0xC0 /* EXTENSION OF R/W DISK */
59 #define FSTEPL 0x20 /* EXTENDED PLIST */
60 #define FSTDIA 0x40 /* ITEM AVAILABLE */
61 #define FSTDRA 0x01 /* PREVIOUS RECORD NULL */
62 #define FSTCNTRY 0x08 /* Century for date last written (0=19, 1=20),\\
63 corresponds to FSTYEARW, FSTADATI. */
64 #define FSTACTRD 0x04 /* ACTIVE FOR READING */
65 #define FSTACTWR 0x02 /* ACTIVE FOR WRITING */
66 #define FSTACTPT 0x01 /* ACTIVE FROM A POINT */
67 #define FSTFILEA 0x07 /* THE FILE IS ACTIVE */
68 u32 LRECL; /* LOGICAL RECORD LENGTH */
69 u16 BLKCT; /* NUMBER OF 800 BYTE BLOCKS */
70 u16 YEARW; /* YEAR LAST WRITTEN */
71 u32 FOP; /* ALT. FILE ORIGIN POINTER */
72 u32 ADBC; /* ALT. NUMBER OF DATA BLOCKS */
73 u32 AIC; /* ALT. ITEM COUNT */
74 u8 NLVL; /* NUMBER OF POINTER BLOCK LEVELS */
75 u8 PTRSZ; /* LENGTH OF A POINTER ELEMENT */
76 u8 ADATI[6]; /* ALT. DATE/TIME(YY MM DD HH MM SS) */
77 u8 REALM; /* Real filemode */
78 u8 FLAG2; /* F*3 - FST FLAG BYTE 2 FSTFLAG2 */
79 #define FSTPIPEU 0x10 /* Reserved for CMS PIPELINES usage */
80 u8 reserved[2];
83 #define EDF_LABEL_BLOCK_NO 3
85 #define EDF_SUPPORTED_BLOCK_SIZE 4096
87 #define DIRECTOR_FN ((u8*) "\x00\x00\x00\x01\x00\x00\x00\x00")
88 #define DIRECTOR_FT ((u8*) "\xc4\xc9\xd9\xc5\xc3\xe3\xd6\xd9")
89 #define ALLOCMAP_FN ((u8*) "\x00\x00\x00\x02\x00\x00\x00\x00")
90 #define ALLOCMAP_FT ((u8*) "\xc1\xd3\xd3\xd6\xc3\xd4\xc1\xd7")
92 struct file;
94 struct fs {
95 struct ADT ADT;
96 struct list_head files;
97 mutex_t lock;
98 struct device *dev;
99 struct file *dir;
102 struct file {
103 struct FST FST;
104 struct list_head files; /* fs->files */
105 struct list_head bcache;
106 mutex_t lock;
107 struct fs *fs;
110 extern struct fs *edf_mount(struct device *dev);
111 extern struct file *edf_lookup(struct fs *fs, char *fn, char *ft);
112 extern int edf_read_rec(struct file *file, char *buf, u32 recno);
114 #endif