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