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