filecore.h revision 1.1 1 /* $NetBSD: filecore.h,v 1.1 2002/12/23 17:30:40 jdolecek Exp $ */
2
3 /*-
4 * Copyright (c) 1998 Andrew McMurry
5 * Copyright (c) 1994 The Regents of the University of California.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * filecore.h 1.0 1998/6/1
37 */
38
39 /*
40 * Definitions describing Acorn Filecore file system structure, as well as
41 * the functions necessary to access fields of filecore file system
42 * structures.
43 */
44
45 #define FILECORE_BOOTBLOCK_BLKN 6
46 #define FILECORE_BOOTBLOCK_SIZE 0x200
47 #define FILECORE_BB_DISCREC 0x1C0
48 #define FILECORE_DISCREC_SIZE 60
49 #define FILECORE_DIR_SIZE 2048
50 #define FILECORE_DIRENT_SIZE 26
51 #define FILECORE_MAXDIRENTS 77
52
53 #define FILECORE_ROOTINO 0xFFFFFFFF
54 #define FILECORE_INO_MASK 0x00FFFFFF
55 #define FILECORE_INO_INDEX 24
56
57 #define FILECORE_ATTR_READ 1
58 #define FILECORE_ATTR_WRITE 2
59 #define FILECORE_ATTR_DIR 8
60 #define FILECORE_ATTR_OREAD 32
61 #define FILECORE_ATTR_OWRITE 64
62
63 #if 0
64 #define FILECORE_DEBUG
65 #define FILECORE_DEBUG_BR
66 #endif
67
68 struct filecore_disc_record {
69 unsigned log2secsize:8; /* base 2 log of the sector size */
70 unsigned secspertrack:8; /* number of sectors per track */
71 unsigned heads:8; /* number of heads */
72 unsigned density:8; /* 0: harddisc, else floppy density */
73 unsigned idlen:8; /* length of fragment id in bits */
74 unsigned log2bpmb:8; /* base 2 log of the bytes per FAU */
75 unsigned skew:8; /* track to sector skew */
76 unsigned bootoption:8; /* *OPT option */
77 unsigned lowsector:8; /* lowest sector id on a track */
78 unsigned nzones:8; /* number of zones in the map */
79 unsigned zone_spare:16; /* number of non-map bits per zone */
80 unsigned root; /* address of root directory */
81 unsigned disc_size; /* disc size in bytes (low word) */
82 unsigned disc_id:16; /* disc cycle id */
83 char disc_name[10]; /* disc name */
84 unsigned disc_type; /* disc type */
85 unsigned disc_size_2; /* disc size in bytes (high word) */
86 unsigned share_size:8; /* base 2 log sharing granularity */
87 unsigned big_flag:8; /* 1 if disc > 512Mb */
88 char reserved[18];
89 };
90
91 struct filecore_direntry {
92 char name[10];
93 unsigned load:32;
94 unsigned exec:32;
95 unsigned len:32;
96 unsigned addr:24;
97 unsigned attr:8;
98 };
99
100 struct filecore_dirhead {
101 unsigned mas_seq:8;
102 unsigned chkname:32;
103 };
104
105 struct filecore_dirtail {
106 unsigned lastmark:8;
107 unsigned reserved:16;
108 unsigned parent1:16;
109 unsigned parent2:8;
110 char title[19];
111 char name[10];
112 unsigned mas_seq:8;
113 unsigned chkname:32;
114 unsigned checkbyte:8;
115 };
116
117 #define fcdirhead(dp) ((struct filecore_dirhead *)(dp))
118 #define fcdirentry(dp,n) (((struct filecore_direntry *)(((char *)(dp))+5))+(n))
119 #define fcdirtail(dp) ((struct filecore_dirtail *)(((char *)(dp))+2007))
120