aboutsummaryrefslogtreecommitdiff
path: root/src/include/storage/bufmgr.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-11-30 01:39:08 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-11-30 01:39:08 +0000
commit680b7357ce850c28d06997be793aee18f72434ba (patch)
tree79c9ab2ef4ac257301510d9ca6bc37b8c6dfba8b /src/include/storage/bufmgr.h
parent9f20852f878dbacc0412d909d48fcbd779d7779e (diff)
downloadpostgresql-680b7357ce850c28d06997be793aee18f72434ba.tar.gz
postgresql-680b7357ce850c28d06997be793aee18f72434ba.zip
Rearrange bufmgr header files so that buf_internals.h need not be
included by everything that includes bufmgr.h --- it's supposed to be internals, after all, not part of the API! This fixes the conflict against FreeBSD headers reported by Rosenman, by making it unnecessary for s_lock.h to be included by plperl.c.
Diffstat (limited to 'src/include/storage/bufmgr.h')
-rw-r--r--src/include/storage/bufmgr.h43
1 files changed, 29 insertions, 14 deletions
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index 275146eea80..2452ac64967 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufmgr.h,v 1.44 2000/11/28 23:27:57 tgl Exp $
+ * $Id: bufmgr.h,v 1.45 2000/11/30 01:39:08 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,14 +15,35 @@
#define BUFMGR_H
#include "access/xlogdefs.h"
-#include "storage/buf_internals.h"
+#include "storage/buf.h"
+#include "storage/lock.h"
#include "storage/relfilenode.h"
+#include "utils/rel.h"
typedef void *Block;
+/* in globals.c ... this duplicates miscadmin.h */
+extern int NBuffers;
+
+/* in buf_init.c */
+extern Block *BufferBlockPointers;
+extern long *PrivateRefCount;
+
+/* in localbuf.c */
+extern int NLocBuffer;
+extern Block *LocalBufferBlockPointers;
+extern long *LocalRefCount;
+
/* special pageno for bget */
#define P_NEW InvalidBlockNumber /* grow the file to get a new page */
+/*
+ * Buffer context lock modes
+ */
+#define BUFFER_LOCK_UNLOCK 0
+#define BUFFER_LOCK_SHARE 1
+#define BUFFER_LOCK_EXCLUSIVE 2
+
/**********************************************************************
@@ -32,18 +53,10 @@ typedef void *Block;
/*
* These routines are beaten on quite heavily, hence the macroization.
- * See buf_internals.h for a related comment.
*/
-#define BufferDescriptorGetBuffer(bdesc) ((bdesc)->buf_id + 1)
-extern int ShowPinTrace;
-
-/*
- * Buffer context lock modes
- */
-#define BUFFER_LOCK_UNLOCK 0
-#define BUFFER_LOCK_SHARE 1
-#define BUFFER_LOCK_EXCLUSIVE 2
+#define BAD_BUFFER_ID(bid) ((bid) < 1 || (bid) > NBuffers)
+#define INVALID_DESCRIPTOR (-3)
#define UnlockAndReleaseBuffer(buffer) \
( \
@@ -136,9 +149,9 @@ extern int ShowPinTrace;
( \
AssertMacro(BufferIsValid(buffer)), \
BufferIsLocal(buffer) ? \
- ((Block) MAKE_PTR(LocalBufferDescriptors[-(buffer) - 1].data)) \
+ LocalBufferBlockPointers[-(buffer) - 1] \
: \
- ((Block) MAKE_PTR(BufferDescriptors[(buffer) - 1].data)) \
+ BufferBlockPointers[(buffer) - 1] \
)
@@ -184,4 +197,6 @@ extern void BufmgrCommit(void);
extern void BufferSync(void);
#endif
+extern void InitLocalBuffer(void);
+
#endif