1 /* $NetBSD: filecore.h,v 1.5 2007/12/25 18:33:43 perry 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 #if !defined(_KERNEL) 74 #error not supposed to be exposed to userland. 75 #endif 76 77 78 #define FILECORE_BOOTBLOCK_BLKN 6 79 #define FILECORE_BOOTBLOCK_SIZE 0x200 80 #define FILECORE_BB_DISCREC 0x1C0 81 #define FILECORE_DISCREC_SIZE 60 82 #define FILECORE_DIR_SIZE 2048 83 #define FILECORE_DIRENT_SIZE 26 84 #define FILECORE_MAXDIRENTS 77 85 86 #define FILECORE_ROOTINO 0xFFFFFFFF 87 #define FILECORE_INO_MASK 0x00FFFFFF 88 #define FILECORE_INO_INDEX 24 89 90 #define FILECORE_ATTR_READ 1 91 #define FILECORE_ATTR_WRITE 2 92 #define FILECORE_ATTR_DIR 8 93 #define FILECORE_ATTR_OREAD 32 94 #define FILECORE_ATTR_OWRITE 64 95 96 #if 0 97 #define FILECORE_DEBUG 98 #define FILECORE_DEBUG_BR 99 #endif 100 101 struct filecore_disc_record { 102 unsigned log2secsize:8; /* base 2 log of the sector size */ 103 unsigned secspertrack:8; /* number of sectors per track */ 104 unsigned heads:8; /* number of heads */ 105 unsigned density:8; /* 0: harddisc, else floppy density */ 106 unsigned idlen:8; /* length of fragment id in bits */ 107 unsigned log2bpmb:8; /* base 2 log of the bytes per FAU */ 108 unsigned skew:8; /* track to sector skew */ 109 unsigned bootoption:8; /* *OPT option */ 110 unsigned lowsector:8; /* lowest sector id on a track */ 111 unsigned nzones:8; /* number of zones in the map */ 112 unsigned zone_spare:16; /* number of non-map bits per zone */ 113 unsigned root; /* address of root directory */ 114 unsigned disc_size; /* disc size in bytes (low word) */ 115 unsigned disc_id:16; /* disc cycle id */ 116 char disc_name[10]; /* disc name */ 117 unsigned disc_type; /* disc type */ 118 unsigned disc_size_2; /* disc size in bytes (high word) */ 119 unsigned share_size:8; /* base 2 log sharing granularity */ 120 unsigned big_flag:8; /* 1 if disc > 512Mb */ 121 char reserved[18]; 122 } __packed; 123 124 struct filecore_direntry { 125 char name[10]; 126 unsigned load:32; 127 unsigned exec:32; 128 unsigned len:32; 129 unsigned addr:24; 130 unsigned attr:8; 131 } __packed; 132 133 struct filecore_dirhead { 134 unsigned mas_seq:8; 135 unsigned chkname:32; 136 } __packed; 137 138 struct filecore_dirtail { 139 unsigned lastmark:8; 140 unsigned reserved:16; 141 unsigned parent1:16; 142 unsigned parent2:8; 143 char title[19]; 144 char name[10]; 145 unsigned mas_seq:8; 146 unsigned chkname:32; 147 unsigned checkbyte:8; 148 } __packed; 149 150 #define fcdirhead(dp) ((struct filecore_dirhead *)(dp)) 151 #define fcdirentry(dp,n) (((struct filecore_direntry *)(((char *)(dp))+5))+(n)) 152 #define fcdirtail(dp) ((struct filecore_dirtail *)(((char *)(dp))+2007)) 153