1*b6a2ef75Sperry /* $NetBSD: filecore.h,v 1.5 2007/12/25 18:33:43 perry Exp $ */ 2aad01611Sagc 3aad01611Sagc /*- 4aad01611Sagc * Copyright (c) 1994 The Regents of the University of California. 5aad01611Sagc * All rights reserved. 6aad01611Sagc * 7aad01611Sagc * Redistribution and use in source and binary forms, with or without 8aad01611Sagc * modification, are permitted provided that the following conditions 9aad01611Sagc * are met: 10aad01611Sagc * 1. Redistributions of source code must retain the above copyright 11aad01611Sagc * notice, this list of conditions and the following disclaimer. 12aad01611Sagc * 2. Redistributions in binary form must reproduce the above copyright 13aad01611Sagc * notice, this list of conditions and the following disclaimer in the 14aad01611Sagc * documentation and/or other materials provided with the distribution. 15aad01611Sagc * 3. Neither the name of the University nor the names of its contributors 16aad01611Sagc * may be used to endorse or promote products derived from this software 17aad01611Sagc * without specific prior written permission. 18aad01611Sagc * 19aad01611Sagc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20aad01611Sagc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21aad01611Sagc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22aad01611Sagc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23aad01611Sagc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24aad01611Sagc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25aad01611Sagc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26aad01611Sagc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27aad01611Sagc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28aad01611Sagc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29aad01611Sagc * SUCH DAMAGE. 30aad01611Sagc * 31aad01611Sagc * filecore.h 1.0 1998/6/1 32aad01611Sagc */ 335356de15Sjdolecek 345356de15Sjdolecek /*- 355356de15Sjdolecek * Copyright (c) 1998 Andrew McMurry 365356de15Sjdolecek * 375356de15Sjdolecek * Redistribution and use in source and binary forms, with or without 385356de15Sjdolecek * modification, are permitted provided that the following conditions 395356de15Sjdolecek * are met: 405356de15Sjdolecek * 1. Redistributions of source code must retain the above copyright 415356de15Sjdolecek * notice, this list of conditions and the following disclaimer. 425356de15Sjdolecek * 2. Redistributions in binary form must reproduce the above copyright 435356de15Sjdolecek * notice, this list of conditions and the following disclaimer in the 445356de15Sjdolecek * documentation and/or other materials provided with the distribution. 455356de15Sjdolecek * 3. All advertising materials mentioning features or use of this software 465356de15Sjdolecek * must display the following acknowledgement: 475356de15Sjdolecek * This product includes software developed by the University of 485356de15Sjdolecek * California, Berkeley and its contributors. 495356de15Sjdolecek * 4. Neither the name of the University nor the names of its contributors 505356de15Sjdolecek * may be used to endorse or promote products derived from this software 515356de15Sjdolecek * without specific prior written permission. 525356de15Sjdolecek * 535356de15Sjdolecek * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 545356de15Sjdolecek * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 555356de15Sjdolecek * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 565356de15Sjdolecek * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 575356de15Sjdolecek * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 585356de15Sjdolecek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 595356de15Sjdolecek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 605356de15Sjdolecek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 615356de15Sjdolecek * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 625356de15Sjdolecek * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 635356de15Sjdolecek * SUCH DAMAGE. 645356de15Sjdolecek * 655356de15Sjdolecek * filecore.h 1.0 1998/6/1 665356de15Sjdolecek */ 675356de15Sjdolecek 685356de15Sjdolecek /* 695356de15Sjdolecek * Definitions describing Acorn Filecore file system structure, as well as 705356de15Sjdolecek * the functions necessary to access fields of filecore file system 715356de15Sjdolecek * structures. 725356de15Sjdolecek */ 734bffed72Schristos #if !defined(_KERNEL) 744bffed72Schristos #error not supposed to be exposed to userland. 754bffed72Schristos #endif 764bffed72Schristos 775356de15Sjdolecek 785356de15Sjdolecek #define FILECORE_BOOTBLOCK_BLKN 6 795356de15Sjdolecek #define FILECORE_BOOTBLOCK_SIZE 0x200 805356de15Sjdolecek #define FILECORE_BB_DISCREC 0x1C0 815356de15Sjdolecek #define FILECORE_DISCREC_SIZE 60 825356de15Sjdolecek #define FILECORE_DIR_SIZE 2048 835356de15Sjdolecek #define FILECORE_DIRENT_SIZE 26 845356de15Sjdolecek #define FILECORE_MAXDIRENTS 77 855356de15Sjdolecek 865356de15Sjdolecek #define FILECORE_ROOTINO 0xFFFFFFFF 875356de15Sjdolecek #define FILECORE_INO_MASK 0x00FFFFFF 885356de15Sjdolecek #define FILECORE_INO_INDEX 24 895356de15Sjdolecek 905356de15Sjdolecek #define FILECORE_ATTR_READ 1 915356de15Sjdolecek #define FILECORE_ATTR_WRITE 2 925356de15Sjdolecek #define FILECORE_ATTR_DIR 8 935356de15Sjdolecek #define FILECORE_ATTR_OREAD 32 945356de15Sjdolecek #define FILECORE_ATTR_OWRITE 64 955356de15Sjdolecek 965356de15Sjdolecek #if 0 975356de15Sjdolecek #define FILECORE_DEBUG 985356de15Sjdolecek #define FILECORE_DEBUG_BR 995356de15Sjdolecek #endif 1005356de15Sjdolecek 1015356de15Sjdolecek struct filecore_disc_record { 1025356de15Sjdolecek unsigned log2secsize:8; /* base 2 log of the sector size */ 1035356de15Sjdolecek unsigned secspertrack:8; /* number of sectors per track */ 1045356de15Sjdolecek unsigned heads:8; /* number of heads */ 1055356de15Sjdolecek unsigned density:8; /* 0: harddisc, else floppy density */ 1065356de15Sjdolecek unsigned idlen:8; /* length of fragment id in bits */ 1075356de15Sjdolecek unsigned log2bpmb:8; /* base 2 log of the bytes per FAU */ 1085356de15Sjdolecek unsigned skew:8; /* track to sector skew */ 1095356de15Sjdolecek unsigned bootoption:8; /* *OPT option */ 1105356de15Sjdolecek unsigned lowsector:8; /* lowest sector id on a track */ 1115356de15Sjdolecek unsigned nzones:8; /* number of zones in the map */ 1125356de15Sjdolecek unsigned zone_spare:16; /* number of non-map bits per zone */ 1135356de15Sjdolecek unsigned root; /* address of root directory */ 1145356de15Sjdolecek unsigned disc_size; /* disc size in bytes (low word) */ 1155356de15Sjdolecek unsigned disc_id:16; /* disc cycle id */ 1165356de15Sjdolecek char disc_name[10]; /* disc name */ 1175356de15Sjdolecek unsigned disc_type; /* disc type */ 1185356de15Sjdolecek unsigned disc_size_2; /* disc size in bytes (high word) */ 1195356de15Sjdolecek unsigned share_size:8; /* base 2 log sharing granularity */ 1205356de15Sjdolecek unsigned big_flag:8; /* 1 if disc > 512Mb */ 1215356de15Sjdolecek char reserved[18]; 122*b6a2ef75Sperry } __packed; 1235356de15Sjdolecek 1245356de15Sjdolecek struct filecore_direntry { 1255356de15Sjdolecek char name[10]; 1265356de15Sjdolecek unsigned load:32; 1275356de15Sjdolecek unsigned exec:32; 1285356de15Sjdolecek unsigned len:32; 1295356de15Sjdolecek unsigned addr:24; 1305356de15Sjdolecek unsigned attr:8; 131*b6a2ef75Sperry } __packed; 1325356de15Sjdolecek 1335356de15Sjdolecek struct filecore_dirhead { 1345356de15Sjdolecek unsigned mas_seq:8; 1355356de15Sjdolecek unsigned chkname:32; 136*b6a2ef75Sperry } __packed; 1375356de15Sjdolecek 1385356de15Sjdolecek struct filecore_dirtail { 1395356de15Sjdolecek unsigned lastmark:8; 1405356de15Sjdolecek unsigned reserved:16; 1415356de15Sjdolecek unsigned parent1:16; 1425356de15Sjdolecek unsigned parent2:8; 1435356de15Sjdolecek char title[19]; 1445356de15Sjdolecek char name[10]; 1455356de15Sjdolecek unsigned mas_seq:8; 1465356de15Sjdolecek unsigned chkname:32; 1475356de15Sjdolecek unsigned checkbyte:8; 148*b6a2ef75Sperry } __packed; 1495356de15Sjdolecek 1505356de15Sjdolecek #define fcdirhead(dp) ((struct filecore_dirhead *)(dp)) 1515356de15Sjdolecek #define fcdirentry(dp,n) (((struct filecore_direntry *)(((char *)(dp))+5))+(n)) 1525356de15Sjdolecek #define fcdirtail(dp) ((struct filecore_dirtail *)(((char *)(dp))+2007)) 153