00001 /********************************************************************** 00002 * Copyright 2002 Jeff Rush <jrush@taupro.com> 00003 * Original Copyright 1979-2002 Udanax.com 00004 * 00005 * This file is part of the Udanax xanalogical storage system. 00006 * 00007 * Udanax is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * Udanax is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with Udanax; if not, write to the Free Software Foundation, 00019 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 **********************************************************************/ 00021 00030 /* Modification History: 00031 * $Log: coredisk.h,v $ 00032 * Revision 1.12 2002/05/28 03:51:13 jrush 00033 * Updated sources to comply with a GPL licensing. 00034 * 00035 * Revision 1.11 2002/05/28 02:44:44 jrush 00036 * Move macro functions into more appropriate protos.h 00037 * 00038 * Revision 1.10 2002/04/13 13:44:35 jrush 00039 * Convert typedefs of structs to just structs, for C++ style. 00040 * 00041 * Revision 1.9 2002/04/12 11:46:25 jrush 00042 * Major rearrangement of include contents, to reflect a hopefully more 00043 * logical layout as we refactor Udanax into classes. 00044 * 00045 * Revision 1.8 2002/04/06 15:00:34 jrush 00046 * Changed INT to just 'int'. 00047 * 00048 * Revision 1.7 2002/02/14 05:40:42 jrush 00049 * Cleaned up source: 00050 * 00051 * 1. ran thru the indent tool to achieve a standard look, 00052 * 2. added structured comments at top for use with DOxygen reporting 00053 * as well as CVS keywords, 00054 * 3. added #ifndef/#defines to prevent duplicate inclusions, 00055 * 4. insured all struct/union defs have names, 00056 * 5. centralized prototypes in protos.h, removing incomplete ones, 00057 * 6. cleaned up use of bool/BOOLEAN type to suit C++ type, 00058 * 7. fixed initializer nesting in tumbler constants. 00059 * 00060 */ 00061 00062 #ifndef __UDANAX_COREDISK_H__ 00063 #define __UDANAX_COREDISK_H__ 00064 00065 struct typediskloafhedr { 00066 int sizeofthisloaf; 00067 unsigned char /* bool */ isapex; /* TRUE if this is top of orgl */ 00068 unsigned char height; /* if == 0, then dbcloaf */ 00069 unsigned char denftype; /* GRAN, SPAN, POOM */ 00070 unsigned char numberofcrums; 00071 unsigned char refcount; /* for subtree sharing, disk garbage collecting */ 00072 unsigned char allignmentdummy; 00073 }; 00074 00075 struct typeduc { // disk upper crum 00076 typewid dwid; 00077 typedsp ddsp; 00078 typediskloafptr sonloafptr; 00079 }; 00080 00081 struct typedbc { // disk bottom crum = loaf 00082 typediskloafhedr xdbchedr; 00083 typewid dbcwid; 00084 typedsp dbcdsp; 00085 typebottomcruminfo dinfo; 00086 }; 00087 00088 //#define typedbcloaf struct structdbc 00089 #define typedbcloaf typedbc 00090 00091 struct type2ddbc { // disk bottom crum = loaf 00092 typediskloafhedr xdbchedr; 00093 typewid dbcwid; 00094 typedsp dbcdsp; 00095 type2dbottomcruminfo d2dinfo; 00096 }; 00097 00098 struct type2ddbcloaf { // disk upper loaf 00099 typediskloafhedr x2ddbcloafhedr; 00100 type2ddbc d2dbcarray[MAX2DBCINLOAF]; 00101 }; 00102 00103 struct typeducloaf { // disk upper loaf 00104 typediskloafhedr xducloafhedr; 00105 typeduc ducarray[MAXUCINLOAF]; 00106 }; 00107 00108 union typediskloaf { 00109 typeducloaf xducloaf; 00110 typedbcloaf xdbcloaf; 00111 type2ddbcloaf x2ddbcloaf; 00112 }; 00113 00114 struct typeuberdiskloaf { 00115 int versiondisknumber; 00116 unsigned short numberofunterloafs; 00117 unsigned char anoherallignmentdummy; 00118 typediskloaf fakepartialuberloaf; 00119 }; 00120 00121 struct typeuberdiskloaffake { 00122 int versiondisknumber; 00123 unsigned short numberofunterloafs; 00124 unsigned char yetanotherallignmentdummy; 00125 int fakepartialuberloaf; 00126 }; 00127 00128 union typediskcrum { 00129 typeduc xduc; 00130 typedbc xdbc; 00131 type2ddbc x2ddbc; 00132 typeducloaf xducloaf; 00133 typedbcloaf xdbcloaf; 00134 type2ddbcloaf x2ddbcloaf; 00135 }; 00136 00137 struct typefreediskloaf { // inverse crum for disk freeing 00138 typefreediskloaf *nextloaftofree; 00139 typefreediskloaf *sonloaftofree; 00140 typediskloafptr freeloafptr; 00141 }; 00142 00143 #define NUMDISKBLOCKSINLOAF 1 /* ((sizeof(typeuberdiskloaf) +XUBUFSIZ -1)/XUBUFSIZ) */ 00144 #define NUMBYTESINLOAF ((NUMDISKBLOCKSINLOAF)*XUBUFSIZ) 00145 00146 union typeuberrawdiskloaf { 00147 typeuberdiskloaffake xuberdiskloaf; 00148 char rawdiskloaf[NUMBYTESINLOAF]; 00149 }; 00150 00151 #define MAXTHINGIESINLOAF 9 /* ((1024-sizeof(struct structdiskloafhedr))/sizeof(struct structduc)) // change these numbers // */ 00152 #define NUMLOAFSOFBITMAP 50 00153 #define BITMAPSIZE (NUMBYTESINLOAF*NUMLOAFSOFBITMAP-(sizeof(unsigned)+sizeof(bool))) 00154 00155 struct Diskheader { // header for file 00156 unsigned filesize; /* number of last allocated block */ 00157 char bitmap[BITMAPSIZE]; /* bit set for each free block */ 00158 bool hasenftops; /* GRAN & SPAN tops are in file */ 00159 }; 00160 00161 #define NUMDISKLOAFSINHEADER (sizeof(Diskheader)/NUMBYTESINLOAF+1) 00162 #define GRANFDISKLOCATION (NUMDISKLOAFSINHEADER+1) 00163 #define SPANFDISKLOCATION (NUMDISKLOAFSINHEADER+2) 00164 #define PARTIALFREEDISKLOCATION (NUMDISKLOAFSINHEADER+3) 00165 00166 struct freediskentry { 00167 int partialdiskblocknumber; 00168 unsigned short freespaceinloaf; 00169 unsigned char moreallignmentdummy; 00170 }; 00171 00172 #define NFREEENTRYS ((NUMBYTESINLOAF - sizeof(freediskentry))/(sizeof(freediskentry))) 00173 00174 struct freediskarray { 00175 int nextdiskblocknumber; 00176 int numberofentrysinthisblock; 00177 freediskentry freeentryarray[NFREEENTRYS]; 00178 }; 00179 00180 #define SIZEOFUBERDISKHEADER 6 00181 00182 #endif /* !__UDANAX_COREDISK_H__*/
1.3.4