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