1 #ifndef _ADF_STR_H 2 #define _ADF_STR_H 1 3 4 /* 5 * ADF Library. (C) 1997-2002 Laurent Clevy 6 * 7 * adf_str.h 8 * 9 * $Id$ 10 * 11 * structures/constants definitions 12 * 13 * This file is part of ADFLib. 14 * 15 * ADFLib is free software; you can redistribute it and/or modify 16 * it under the terms of the GNU General Public License as published by 17 * the Free Software Foundation; either version 2 of the License, or 18 * (at your option) any later version. 19 * 20 * ADFLib is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU General Public License for more details. 24 * 25 * You should have received a copy of the GNU General Public License 26 * aint32_t with Foobar; if not, write to the Free Software 27 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 28 * 29 */ 30 31 #include<stdio.h> 32 33 #include"adf_defs.h" 34 #include"adf_blk.h" 35 #include"adf_err.h" 36 37 /* ----- VOLUME ----- */ 38 39 struct Volume { 40 struct Device* dev; 41 42 SECTNUM firstBlock; /* first block of data area (from beginning of device) */ 43 SECTNUM lastBlock; /* last block of data area (from beginning of device) */ 44 SECTNUM rootBlock; /* root block (from firstBlock) */ 45 46 char dosType; /* FFS/OFS, DIRCACHE, INTERNATIONAL */ 47 BOOL bootCode; 48 BOOL readOnly; 49 int datablockSize; /* 488 or 512 */ 50 int blockSize; /* 512 */ 51 52 char *volName; 53 54 BOOL mounted; 55 56 int32_t bitmapSize; /* in blocks */ 57 SECTNUM *bitmapBlocks; /* bitmap blocks pointers */ 58 struct bBitmapBlock **bitmapTable; 59 BOOL *bitmapBlocksChg; 60 61 SECTNUM curDirPtr; 62 }; 63 64 65 struct Partition { 66 int32_t startCyl; 67 int32_t lenCyl; 68 char* volName; 69 int volType; 70 }; 71 72 /* ----- DEVICES ----- */ 73 74 #define DEVTYPE_FLOPDD 1 75 #define DEVTYPE_FLOPHD 2 76 #define DEVTYPE_HARDDISK 3 77 #define DEVTYPE_HARDFILE 4 78 79 struct Device { 80 int devType; /* see below */ 81 BOOL readOnly; 82 int32_t size; /* in bytes */ 83 84 int nVol; /* partitions */ 85 struct Volume** volList; 86 87 int32_t cylinders; /* geometry */ 88 int32_t heads; 89 int32_t sectors; 90 91 BOOL isNativeDev; 92 void *nativeDev; 93 }; 94 95 96 /* ----- FILE ----- */ 97 98 struct File { 99 struct Volume *volume; 100 101 struct bFileHeaderBlock* fileHdr; 102 void *currentData; 103 struct bFileExtBlock* currentExt; 104 105 int32_t nDataBlock; 106 SECTNUM curDataPtr; 107 uint32_t pos; 108 109 int posInDataBlk; 110 int posInExtBlk; 111 BOOL eof, writeMode; 112 }; 113 114 115 /* ----- ENTRY ---- */ 116 117 struct Entry{ 118 int type; 119 char* name; 120 SECTNUM sector; 121 SECTNUM real; 122 SECTNUM parent; 123 char* comment; 124 uint32_t size; 125 int32_t access; 126 int year, month, days; 127 int hour, mins, secs; 128 }; 129 130 struct CacheEntry{ 131 int32_t header, size, protect; 132 short days, mins, ticks; 133 signed char type; 134 char nLen, cLen; 135 char name[MAXNAMELEN+1], comm[MAXCMMTLEN+1]; 136 /* char *name, *comm;*/ 137 138 }; 139 140 141 142 143 struct DateTime{ 144 int year,mon,day,hour,min,sec; 145 }; 146 147 /* ----- ENVIRONMENT ----- */ 148 149 #define PR_VFCT 1 150 #define PR_WFCT 2 151 #define PR_EFCT 3 152 #define PR_NOTFCT 4 153 #define PR_USEDIRC 5 154 #define PR_USE_NOTFCT 6 155 #define PR_PROGBAR 7 156 #define PR_USE_PROGBAR 8 157 #define PR_RWACCESS 9 158 #define PR_USE_RWACCESS 10 159 160 struct Env{ 161 void (*vFct)(char*); /* verbose callback function */ 162 void (*wFct)(char*); /* warning callback function */ 163 void (*eFct)(char*); /* error callback function */ 164 165 void (*notifyFct)(SECTNUM, int); 166 BOOL useNotify; 167 168 void (*rwhAccess)(SECTNUM,SECTNUM,BOOL); 169 BOOL useRWAccess; 170 171 void (*progressBar)(int); 172 BOOL useProgressBar; 173 174 BOOL useDirCache; 175 176 void *nativeFct; 177 }; 178 179 180 181 struct List{ /* generic linked tree */ 182 void *content; 183 struct List* subdir; 184 struct List* next; 185 }; 186 187 struct GenBlock{ 188 SECTNUM sect; 189 SECTNUM parent; 190 int type; 191 int secType; 192 char *name; /* if (type == 2 and (secType==2 or secType==-3)) */ 193 }; 194 195 struct FileBlocks{ 196 SECTNUM header; 197 int32_t nbExtens; 198 SECTNUM* extens; 199 int32_t nbData; 200 SECTNUM* data; 201 }; 202 203 struct bEntryBlock { 204 /*000*/ int32_t type; /* T_HEADER == 2 */ 205 /*004*/ int32_t headerKey; /* current block number */ 206 int32_t r1[3]; 207 /*014*/ uint32_t checkSum; 208 /*018*/ int32_t hashTable[HT_SIZE]; 209 int32_t r2[2]; 210 /*140*/ int32_t access; /* bit0=del, 1=modif, 2=write, 3=read */ 211 /*144*/ int32_t byteSize; 212 /*148*/ char commLen; 213 /*149*/ char comment[MAXCMMTLEN+1]; 214 char r3[91-(MAXCMMTLEN+1)]; 215 /*1a4*/ int32_t days; 216 /*1a8*/ int32_t mins; 217 /*1ac*/ int32_t ticks; 218 /*1b0*/ char nameLen; 219 /*1b1*/ char name[MAXNAMELEN+1]; 220 int32_t r4; 221 /*1d4*/ int32_t realEntry; 222 /*1d8*/ int32_t nextLink; 223 int32_t r5[5]; 224 /*1f0*/ int32_t nextSameHash; 225 /*1f4*/ int32_t parent; 226 /*1f8*/ int32_t extension; 227 /*1fc*/ int32_t secType; 228 }; 229 230 231 #define ENV_DECLARATION struct Env adfEnv 232 233 234 #endif /* _ADF_STR_H */ 235 /*##########################################################################*/ 236