diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2025-09-15 10:48:30 +0200 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2025-09-15 11:04:10 +0200 |
commit | d4d1fc527bdb333d818038081c17ed7d9b1697c1 (patch) | |
tree | 3f5c4823780c7581fbcd083477d07f96fefd63a1 /src/include/storage/bufmgr.h | |
parent | 70407d39b7ea8fd41496489b5f6a30c285e7d7d0 (diff) |
Update various forward declarations to use typedef
There are a number of forward declarations that use struct but not the
customary typedef, because that could have led to repeat typedefs,
which was not allowed. This is now allowed in C11, so we can update
these to provide the typedefs as well, so that the later uses of the
types look more consistent.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org
Diffstat (limited to 'src/include/storage/bufmgr.h')
-rw-r--r-- | src/include/storage/bufmgr.h | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index 41fdc1e7693..47360a3d3d8 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -93,6 +93,9 @@ typedef enum ExtendBufferedFlags EB_LOCK_TARGET = (1 << 5), } ExtendBufferedFlags; +/* forward declared, to avoid including smgr.h here */ +typedef struct SMgrRelationData *SMgrRelation; + /* * Some functions identify relations either by relation or smgr + * relpersistence. Used via the BMR_REL()/BMR_SMGR() macros below. This @@ -101,7 +104,7 @@ typedef enum ExtendBufferedFlags typedef struct BufferManagerRelation { Relation rel; - struct SMgrRelationData *smgr; + SMgrRelation smgr; char relpersistence; } BufferManagerRelation; @@ -122,7 +125,7 @@ struct ReadBuffersOperation { /* The following members should be set by the caller. */ Relation rel; /* optional */ - struct SMgrRelationData *smgr; + SMgrRelation smgr; char persistence; ForkNumber forknum; BufferAccessStrategy strategy; @@ -143,11 +146,8 @@ struct ReadBuffersOperation typedef struct ReadBuffersOperation ReadBuffersOperation; -/* forward declared, to avoid having to expose buf_internals.h here */ -struct WritebackContext; - -/* forward declared, to avoid including smgr.h here */ -struct SMgrRelationData; +/* to avoid having to expose buf_internals.h here */ +typedef struct WritebackContext WritebackContext; /* in globals.c ... this duplicates miscadmin.h */ extern PGDLLIMPORT int NBuffers; @@ -201,7 +201,7 @@ extern PGDLLIMPORT int32 *LocalRefCount; /* * prototypes for functions in bufmgr.c */ -extern PrefetchBufferResult PrefetchSharedBuffer(struct SMgrRelationData *smgr_reln, +extern PrefetchBufferResult PrefetchSharedBuffer(SMgrRelation smgr_reln, ForkNumber forkNum, BlockNumber blockNum); extern PrefetchBufferResult PrefetchBuffer(Relation reln, ForkNumber forkNum, @@ -268,15 +268,15 @@ extern BlockNumber RelationGetNumberOfBlocksInFork(Relation relation, ForkNumber forkNum); extern void FlushOneBuffer(Buffer buffer); extern void FlushRelationBuffers(Relation rel); -extern void FlushRelationsAllBuffers(struct SMgrRelationData **smgrs, int nrels); +extern void FlushRelationsAllBuffers(SMgrRelation *smgrs, int nrels); extern void CreateAndCopyRelationData(RelFileLocator src_rlocator, RelFileLocator dst_rlocator, bool permanent); extern void FlushDatabaseBuffers(Oid dbid); -extern void DropRelationBuffers(struct SMgrRelationData *smgr_reln, +extern void DropRelationBuffers(SMgrRelation smgr_reln, ForkNumber *forkNum, int nforks, BlockNumber *firstDelBlock); -extern void DropRelationsAllBuffers(struct SMgrRelationData **smgr_reln, +extern void DropRelationsAllBuffers(SMgrRelation *smgr_reln, int nlocators); extern void DropDatabaseBuffers(Oid dbid); @@ -298,7 +298,7 @@ extern bool ConditionalLockBufferForCleanup(Buffer buffer); extern bool IsBufferCleanupOK(Buffer buffer); extern bool HoldingBufferPinThatDelaysRecovery(void); -extern bool BgBufferSync(struct WritebackContext *wb_context); +extern bool BgBufferSync(WritebackContext *wb_context); extern uint32 GetPinLimit(void); extern uint32 GetLocalPinLimit(void); |