|
|
1.1 ! root 1: # ! 2: /* ! 3: ** ACCESS.H -- definitions relating to the access methods. ! 4: ** ! 5: ** Version: ! 6: ** @(#)access.h 8.2 2/8/85 ! 7: */ ! 8: ! 9: # ifndef PGSIZE ! 10: ! 11: ! 12: /* ! 13: ** PGSIZE is the physical size of a page. ! 14: ** MAXTUP is the maximum size of a tuple, assuming only one ! 15: ** tuple on the page. This is PGSIZE-hdrsize, where ! 16: ** hdrsize is the size of the page header (12 bytes). ! 17: ** MAXLINENO is the maximum number of tuples on a page ! 18: ** assuming minimum size tuples (1 byte). This is ! 19: ** constrained by the size of the lineid field of ! 20: ** the tid. ! 21: */ ! 22: ! 23: # define PGSIZE 1024 /* size of page */ ! 24: # define MAXTUP 1010 /* max size of a tuple */ ! 25: # define MAXLINENO 254 /* max tuples per page */ ! 26: # define PGPTRSIZ 4 /* size of a tid */ ! 27: # define MAXTUPS 100 /* maximum number of tups */ ! 28: ! 29: /* storage structure flags; < 0 means compressed */ ! 30: # define M_HEAP 5 /* paged heap */ ! 31: # define M_ISAM 11 /* indexed sequential */ ! 32: # define M_HASH 21 /* random hash */ ! 33: # define M_BTREE 31 /* BTREES */ ! 34: # define M_ORDER 41 /* ordered */ ! 35: # define M_TRUNC 99 /* internal pseudo-mode: truncated */ ! 36: ! 37: # define NACCBUFS 3 /* number of access method buffers */ ! 38: ! 39: /* error flags */ ! 40: # define AMREAD_ERR -1 ! 41: # define AMWRITE_ERR -2 ! 42: # define AMNOFILE_ERR -3 /* can't open file for a relation */ ! 43: # define AMREL_ERR -4 /* can't open relation relation */ ! 44: # define AMATTR_ERR -5 /* can't open attribute relation */ ! 45: # define AMNOATTS_ERR -6 /* attribute missing or xtra in att-rel */ ! 46: # define AMCLOSE_ERR -7 /* can't close relation */ ! 47: # define AMFIND_ERR -8 /* unidentifiable stora Petructure in find */ ! 48: # define AMINVL_ERR -9 /* invalid TID */ ! 49: # define AMOPNVIEW_ERR -10 /* attempt to open a view for rd or wr */ ! 50: ! 51: /* the following is the access methods buffer */ ! 52: struct accbuf ! 53: { ! 54: /* this stuff is actually stored in the relation */ ! 55: long mainpg; /* next main page (0 - eof) */ ! 56: long ovflopg; /* next ovflo page (0 - none) */ ! 57: short nxtlino; /* next avail line no for this page */ ! 58: char firstup[PGSIZE - 12]; /* tuple space */ ! 59: short linetab[1]; /* line table at end of buffer - grows down */ ! 60: /* linetab[lineno] is offset into ! 61: ** the buffer for that line; linetab[nxtlino] ! 62: ** is free space pointer */ ! 63: ! 64: /* this stuff is not stored in the relation */ ! 65: long rel_tupid; /* unique relation id */ ! 66: long thispage; /* page number of the current page */ ! 67: int filedesc; /* file descriptor for this reln */ ! 68: struct accbuf *modf; /* use time link list forward pointer */ ! 69: struct accbuf *modb; /* back pointer */ ! 70: int bufstatus; /* various bits defined below */ ! 71: }; ! 72: ! 73: /* The following assignments are status bits for accbuf.bufstatus */ ! 74: # define BUF_DIRTY 001 /* page has been changed */ ! 75: # define BUF_LOCKED 002 /* page has a page lock on it */ ! 76: # define BUF_DIRECT 004 /* this is a page from isam direct */ ! 77: ! 78: /* access method buffer typed differently for various internal operations */ ! 79: struct ! 80: { ! 81: char acc_buf[NACCBUFS]; ! 82: }; ! 83: ! 84: /* pointers to maintain the buffer */ ! 85: extern struct accbuf *Acc_head; /* head of the LRU list */ ! 86: extern struct accbuf *Acc_tail; /* tail of the LRU list */ ! 87: extern struct accbuf Acc_buf[NACCBUFS]; /* the buffers themselves */ ! 88: ! 89: ! 90: /* ! 91: ** ADMIN file struct ! 92: ** ! 93: ** The ADMIN struct describes the initial part of the ADMIN file ! 94: ** which exists in each database. This file is used to initially ! 95: ** create the database, to maintain some information about the ! 96: ** database, and to access the RELATION and ATTRIBUTE relations ! 97: ** on OPENR calls. ! 98: */ ! 99: ! 100: struct adminhdr ! 101: { ! 102: char adowner[2]; /* user code of data base owner */ ! 103: short adflags; /* database flags */ ! 104: short adlength; /* length of adminhdr */ ! 105: short adversion; /* database format stamp */ ! 106: short adreldsz; /* length of relation descriptor */ ! 107: short adattdsz; /* length of attribute descriptor */ ! 108: }; ! 109: ! 110: struct admin ! 111: { ! 112: struct adminhdr adhdr; ! 113: struct descriptor adreld; ! 114: struct descriptor adattd; ! 115: }; ! 116: ! 117: /* ! 118: ** Admin status bits ! 119: ** ! 120: ** These bits define the status of the database. They are ! 121: ** contained in the adflags field of the admin struct. ! 122: */ ! 123: ! 124: # define A_DBCONCUR 0000001 /* set database concurrency */ ! 125: # define A_QRYMOD 0000002 /* database uses query modification */ ! 126: # define A_NEWFMT 0000004 /* database is post-6.2 */ ! 127: ! 128: ! 129: /* following is buffer space for data from admin file */ ! 130: extern struct admin Admin; ! 131: ! 132: /* ! 133: ** PGTUPLE -- btree index key (a tid and an index key) ! 134: */ ! 135: ! 136: struct pgtuple ! 137: { ! 138: struct tup_id childtid; /* the pointer comes before */ ! 139: char childtup[MAXTUP]; ! 140: }; ! 141: ! 142: /* ! 143: ** global counters for the number of UNIX read and write ! 144: ** requests issued by the access methods. ! 145: */ ! 146: ! 147: extern long Accuread, Accuwrite; ! 148: ! 149: /* ! 150: ** Global values used by everything ! 151: */ ! 152: ! 153: extern char *Acctuple; /* pointer to canonical tuple */ ! 154: extern Accerror; /* error no for fatal errors */ ! 155: extern char Accanon[MAXTUP]; /* canonical tuple buffer */ ! 156: ! 157: ! 158: /* Macros for the return values of iutil/add_ovflo.c */ ! 159: # define NOBUFFER -1 /* can't get buffer for overflow page */ ! 160: # define NOSETUP -2 /* can't set up overflow page */ ! 161: # define NOGETCURRENT -3 /* can't get the current page */ ! 162: # define NORMVMAIN -4 /* can't remove the main page */ ! 163: # define NOGETOVFLO -5 /* can't get the overflow page */ ! 164: # endif PGSIZE
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.