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