1
1
/*-------------------------------------------------------------------------
2
2
*
3
3
* buf_internals.h
4
- * Internal definitions.
4
+ * Internal definitions for buffer manager .
5
5
*
6
6
*
7
7
* Copyright (c) 1994, Regents of the University of California
8
8
*
9
- * $Id: buf_internals.h,v 1.33 1999/09/24 00:25:27 tgl Exp $
10
- *
11
- * NOTE
12
- *If BUFFERPAGE0 is defined, then 0 will be used as a
13
- *valid buffer page number.
9
+ * $Id: buf_internals.h,v 1.34 1999/11/21 19:56:12 tgl Exp $
14
10
*
15
11
*-------------------------------------------------------------------------
16
12
*/
@@ -42,18 +38,14 @@ extern intNum_Descriptors;
42
38
43
39
typedef bits16 BufFlags ;
44
40
45
- typedef struct sbufdesc BufferDesc ;
46
- typedef struct sbufdesc BufferHdr ;
47
- typedef struct buftag BufferTag ;
48
-
49
41
/* long * so alignment will be correct */
50
42
typedef long * * BufferBlock ;
51
43
52
- struct buftag
44
+ typedef struct buftag
53
45
{
54
46
LockRelId relId ;
55
47
BlockNumber blockNum ;/* blknum relative to begin of reln */
56
- };
48
+ }BufferTag ;
57
49
58
50
#define CLEAR_BUFFERTAG (a ) \
59
51
( \
@@ -72,8 +64,8 @@ struct buftag
72
64
#define INVALID_DESCRIPTOR (-3)
73
65
74
66
/*
75
- *struct sbufdesc -- shared buffer cache metadata for a single
76
- * shared buffer descriptor.
67
+ *BufferDesc -- shared buffer cache metadata for a single
68
+ * shared buffer descriptor.
77
69
*
78
70
*We keep the name of the database and relation in which this
79
71
*buffer appears in order to avoid a catalog lookup on cache
@@ -83,17 +75,17 @@ struct buftag
83
75
*Dbname, relname, dbid, and relid are enough to determine where
84
76
*to put the buffer, for all storage managers.
85
77
*/
86
- struct sbufdesc
78
+ typedef struct sbufdesc
87
79
{
88
- Buffer freeNext ;/*link for freelist chain */
80
+ Buffer freeNext ;/*links for freelist chain */
89
81
Buffer freePrev ;
90
82
SHMEM_OFFSET data ;/* pointer to data in buf pool */
91
83
92
84
/* tag and id must be together for table lookup to work */
93
85
BufferTag tag ;/* file/block identifier */
94
86
int buf_id ;/* maps global desc to local desc */
95
87
96
- BufFlags flags ;/*described below */
88
+ BufFlags flags ;/*see bit definitions above */
97
89
unsigned refcount ;/* # of times buffer is pinned */
98
90
99
91
#ifdef HAS_TEST_AND_SET
@@ -107,10 +99,12 @@ struct sbufdesc
107
99
108
100
char sb_dbname [NAMEDATALEN ];/* name of db in which buf belongs */
109
101
char sb_relname [NAMEDATALEN ];/* name of reln */
110
- };
102
+ }BufferDesc ;
111
103
112
104
/*
113
- * Buffer lock infos in BufferLocks below.
105
+ * Each backend has its own BufferLocks[] array holding flag bits
106
+ * showing what locks it has set on each buffer.
107
+ *
114
108
* We have to free these locks in elog(ERROR)...
115
109
*/
116
110
#define BL_IO_IN_PROGRESS (1 << 0)/* unimplemented */
@@ -178,7 +172,7 @@ extern BufferDesc *LocalBufferDescriptors;
178
172
extern int NLocBuffer ;
179
173
180
174
extern BufferDesc * LocalBufferAlloc (Relation reln ,BlockNumber blockNum ,
181
- bool * foundPtr );
175
+ bool * foundPtr );
182
176
extern int WriteLocalBuffer (Buffer buffer ,bool release );
183
177
extern int FlushLocalBuffer (Buffer buffer ,bool release );
184
178
extern void InitLocalBuffer (void );