Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / DtSearch / raima / trxlog.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: trxlog.h /main/2 1996/05/09 04:20:43 drk $ */
24 /*
25  *   COMPONENT_NAME: austext
26  *
27  *   FUNCTIONS: BITMAP_SIZE
28  *              BM_BASE
29  *              IX_BASE
30  *              IX_SIZE
31  *              PZ_BASE
32  *
33  *   ORIGINS: 157
34  *
35  */
36
37 /* ********************** EDIT HISTORY *******************************
38
39  SCR    DATE    INI                   DESCRIPTION
40 ----- --------- --- -----------------------------------------------------
41   611 21-Feb-89 RSC The defn of BUI for unix and vms needs parenthesis
42 */
43
44
45 /* trxlog.h  -  header file to define structures, constants, etc. for the
46                 memory cache overflow and transaction log file control
47 ==========================================================================
48 */
49 /*
50    The following constants control the functioning of the cache overflow
51    and transaction logging processes
52
53    BUI             The number of bits in an unsigned int
54    IX_PAGESIZE     The size (in bytes) of an index page
55    IX_EPP          The number of entries that will fit on an index page
56    BITMAP_SIZE     The size of the index bitmap (in unsigned int units)
57    IX_SIZE         The number of index pages needed to control the db pages
58    OADDR_OF_IXP    Calculates the overflow file address of an index page #
59    
60 ==========================================================================
61 */
62 /* (BITS(unsigned int)) */
63 #define BUI (8*sizeof(unsigned int))
64
65 #ifndef NO_TRANS
66 /* ((((256*sizeof(F_ADDR))+D_BLKSZ-1) / D_BLKSZ)*D_BLKSZ) */
67 #define IX_PAGESIZE 1024
68
69 /* (IX_PAGESIZE / sizeof(F_ADDR)) */
70 #define IX_EPP 256
71
72 #define BITMAP_SIZE(pcnt) ((int)((IX_SIZE(pcnt)+(BUI-1)) / BUI))
73
74 #define IX_SIZE(pcnt) ((long)( ((pcnt) + (IX_EPP-1)) / IX_EPP))
75
76 /* Next define the base file offsets for entries in the overflow file */
77
78 #define BM_BASE( file ) ( root_ix[file].base )
79 #define IX_BASE(file, pcnt) ((long)(BM_BASE(file) + (BITMAP_SIZE(pcnt)*sizeof(unsigned int))))
80 #define PZ_BASE(file, pcnt) ((long)(IX_BASE(file, pcnt) + (IX_SIZE(pcnt)*IX_PAGESIZE)))
81
82 /*
83 ==========================================================================
84 */
85
86 /* The following typedef'ed structure defines a single entry in the
87    root index data.  */
88
89 typedef struct RI_ENTRY_S {
90    LONG     pg_cnt;           /* Number of pages currently in file */
91    F_ADDR   base;             /* Base of data stored in overflow */
92    BOOLEAN  pz_modified;      /* Was page zero written to overflow? */
93    INT_P    Bitmap;           /* Used index page bitmap */
94 } RI_ENTRY;
95 #define bitmap Bitmap.ptr
96 #define RI_ENTRY_IOSIZE (sizeof(RI_ENTRY)-sizeof(INT_P)+sizeof(INT *))
97 #endif
98
99 /*
100 ==========================================================================
101 */
102
103 /* page zero table entry */
104 #define PGZEROSZ (2*sizeof(F_ADDR)+sizeof(ULONG))
105 typedef struct PGZERO_S {
106    F_ADDR  pz_dchain;         /* delete chain pointer */
107    F_ADDR  pz_next;           /* next available record number */
108    ULONG   pz_timestamp;      /* file's timestamp value */
109    BOOLEAN pz_modified;       /* TRUE if page zero has been modified */
110 } PGZERO;
111
112 /* binary search lookup table entry */
113
114 #ifndef NO_TRANS
115 /* External declarations */
116 extern int trlog_flag;        /* Transaction logging enabled flag */
117 extern int trcommit;          /* Transaction commit in progress flag */
118 extern BOOLEAN use_ovfl;      /* Do we use the overflow file ? */
119 #endif
120
121 /* Maximum number of transactions which can commit a time */
122 #ifndef SINGLE_USER
123 #define TAFLIMIT 5
124 #else
125 #define TAFLIMIT 1
126 #endif
127
128 #define TRXLOG_H
129 /* End - trxlog.h */
130 /* vpp -nOS2 -dUNIX -nBSD -nVANILLA_BSD -nVMS -nMEMLOCK -nWINDOWS -nFAR_ALLOC -f/usr/users/master/config/nonwin trxlog.h */