11/*-------------------------------------------------------------------------
22 *
33 * buf_internals.h
4- * Internal definitions.
4+ * Internal definitions for buffer manager .
55 *
66 *
77 * Copyright (c) 1994, Regents of the University of California
88 *
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 $
1410 *
1511 *-------------------------------------------------------------------------
1612 */
@@ -42,18 +38,14 @@ extern intNum_Descriptors;
4238
4339typedef bits16 BufFlags ;
4440
45- typedef struct sbufdesc BufferDesc ;
46- typedef struct sbufdesc BufferHdr ;
47- typedef struct buftag BufferTag ;
48-
4941/* long * so alignment will be correct */
5042typedef long * * BufferBlock ;
5143
52- struct buftag
44+ typedef struct buftag
5345{
5446LockRelId relId ;
5547BlockNumber blockNum ;/* blknum relative to begin of reln */
56- };
48+ }BufferTag ;
5749
5850#define CLEAR_BUFFERTAG (a ) \
5951( \
@@ -72,8 +64,8 @@ struct buftag
7264#define INVALID_DESCRIPTOR (-3)
7365
7466/*
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.
7769 *
7870 *We keep the name of the database and relation in which this
7971 *buffer appears in order to avoid a catalog lookup on cache
@@ -83,17 +75,17 @@ struct buftag
8375 *Dbname, relname, dbid, and relid are enough to determine where
8476 *to put the buffer, for all storage managers.
8577 */
86- struct sbufdesc
78+ typedef struct sbufdesc
8779{
88- Buffer freeNext ;/*link for freelist chain */
80+ Buffer freeNext ;/*links for freelist chain */
8981Buffer freePrev ;
9082SHMEM_OFFSET data ;/* pointer to data in buf pool */
9183
9284/* tag and id must be together for table lookup to work */
9385BufferTag tag ;/* file/block identifier */
9486int buf_id ;/* maps global desc to local desc */
9587
96- BufFlags flags ;/*described below */
88+ BufFlags flags ;/*see bit definitions above */
9789unsigned refcount ;/* # of times buffer is pinned */
9890
9991#ifdef HAS_TEST_AND_SET
@@ -107,10 +99,12 @@ struct sbufdesc
10799
108100char sb_dbname [NAMEDATALEN ];/* name of db in which buf belongs */
109101char sb_relname [NAMEDATALEN ];/* name of reln */
110- };
102+ }BufferDesc ;
111103
112104/*
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+ *
114108 * We have to free these locks in elog(ERROR)...
115109 */
116110#define BL_IO_IN_PROGRESS (1 << 0)/* unimplemented */
@@ -178,7 +172,7 @@ extern BufferDesc *LocalBufferDescriptors;
178172extern int NLocBuffer ;
179173
180174extern BufferDesc * LocalBufferAlloc (Relation reln ,BlockNumber blockNum ,
181- bool * foundPtr );
175+ bool * foundPtr );
182176extern int WriteLocalBuffer (Buffer buffer ,bool release );
183177extern int FlushLocalBuffer (Buffer buffer ,bool release );
184178extern void InitLocalBuffer (void );