diff options
Diffstat (limited to 'src/include/storage')
-rw-r--r-- | src/include/storage/buf_internals.h | 10 | ||||
-rw-r--r-- | src/include/storage/buffile.h | 6 | ||||
-rw-r--r-- | src/include/storage/bufmgr.h | 6 | ||||
-rw-r--r-- | src/include/storage/fd.h | 4 | ||||
-rw-r--r-- | src/include/storage/itempos.h | 4 | ||||
-rw-r--r-- | src/include/storage/lock.h | 26 | ||||
-rw-r--r-- | src/include/storage/proc.h | 8 | ||||
-rw-r--r-- | src/include/storage/s_lock.h | 8 | ||||
-rw-r--r-- | src/include/storage/sinvaladt.h | 22 | ||||
-rw-r--r-- | src/include/storage/smgr.h | 48 |
10 files changed, 73 insertions, 69 deletions
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index 0c5b6d64c0c..2347db17bd0 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: buf_internals.h,v 1.36 2000/04/09 04:43:18 tgl Exp $ + * $Id: buf_internals.h,v 1.37 2000/04/12 17:16:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -67,9 +67,9 @@ typedef struct buftag */ typedef struct bufblindid { - char dbname[NAMEDATALEN]; /* name of db in which buf belongs */ - char relname[NAMEDATALEN]; /* name of reln */ -} BufferBlindId; + char dbname[NAMEDATALEN]; /* name of db in which buf belongs */ + char relname[NAMEDATALEN]; /* name of reln */ +} BufferBlindId; #define BAD_BUFFER_ID(bid) ((bid) < 1 || (bid) > NBuffers) #define INVALID_DESCRIPTOR (-3) @@ -184,7 +184,7 @@ extern BufferDesc *LocalBufferDescriptors; extern int NLocBuffer; extern BufferDesc *LocalBufferAlloc(Relation reln, BlockNumber blockNum, - bool *foundPtr); + bool *foundPtr); extern int WriteLocalBuffer(Buffer buffer, bool release); extern int FlushLocalBuffer(Buffer buffer, bool release); extern void InitLocalBuffer(void); diff --git a/src/include/storage/buffile.h b/src/include/storage/buffile.h index 30ccb6e0933..3f79e5bfab4 100644 --- a/src/include/storage/buffile.h +++ b/src/include/storage/buffile.h @@ -18,7 +18,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: buffile.h,v 1.3 2000/01/26 05:58:32 momjian Exp $ + * $Id: buffile.h,v 1.4 2000/04/12 17:16:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -41,9 +41,9 @@ extern BufFile *BufFileCreate(File file); extern void BufFileClose(BufFile *file); extern size_t BufFileRead(BufFile *file, void *ptr, size_t size); extern size_t BufFileWrite(BufFile *file, void *ptr, size_t size); -extern int BufFileSeek(BufFile *file, int fileno, long offset, int whence); +extern int BufFileSeek(BufFile *file, int fileno, long offset, int whence); extern void BufFileTell(BufFile *file, int *fileno, long *offset); -extern int BufFileSeekBlock(BufFile *file, long blknum); +extern int BufFileSeekBlock(BufFile *file, long blknum); extern long BufFileTellBlock(BufFile *file); #endif /* BUFFILE_H */ diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index e852dfd0520..da078ffbf3c 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.36 2000/04/09 04:43:18 tgl Exp $ + * $Id: bufmgr.h,v 1.37 2000/04/12 17:16:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -169,8 +169,8 @@ extern int BufferPoolCheckLeak(void); extern void FlushBufferPool(void); extern BlockNumber BufferGetBlockNumber(Buffer buffer); extern BlockNumber RelationGetNumberOfBlocks(Relation relation); -extern int FlushRelationBuffers(Relation rel, BlockNumber block, - bool doFlush); +extern int FlushRelationBuffers(Relation rel, BlockNumber block, + bool doFlush); extern void ReleaseRelationBuffers(Relation rel); extern void DropBuffers(Oid dbid); extern void PrintPinnedBufs(void); diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index f82fc14cae9..fb45e204564 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: fd.h,v 1.20 2000/04/09 04:43:18 tgl Exp $ + * $Id: fd.h,v 1.21 2000/04/12 17:16:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -65,7 +65,7 @@ extern FILE *AllocateFile(char *name, char *mode); extern void FreeFile(FILE *); /* Miscellaneous support routines */ -extern bool ReleaseDataFile(void); +extern bool ReleaseDataFile(void); extern void closeAllVfds(void); extern void AtEOXact_Files(void); extern int pg_fsync(int fd); diff --git a/src/include/storage/itempos.h b/src/include/storage/itempos.h index d1306068765..83ff7a63626 100644 --- a/src/include/storage/itempos.h +++ b/src/include/storage/itempos.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: itempos.h,v 1.10 2000/01/26 05:58:33 momjian Exp $ + * $Id: itempos.h,v 1.11 2000/04/12 17:16:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -40,6 +40,6 @@ typedef ItemSubpositionData *ItemSubposition; * unsigned LEN; */ #define PSKIP(OBJP, LEN)\ - { (OBJP)->op_cp += (LEN); (OBJP)->op_len -= (LEN); } + do { (OBJP)->op_cp += (LEN); (OBJP)->op_len -= (LEN); } while (0) #endif /* ITEMPOS_H */ diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 1c0204132ce..5e9fb8b42f2 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: lock.h,v 1.36 2000/01/26 05:58:33 momjian Exp $ + * $Id: lock.h,v 1.37 2000/04/12 17:16:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -32,7 +32,7 @@ typedef int LOCKMASK; * See LockShmemSize() in lock.c. * * NLOCKS_PER_XACT - The number of unique locks acquired in a transaction - * (should be configurable!) + * (should be configurable!) * NLOCKENTS - The maximum number of lock entries in the lock table. * ---------------------- */ @@ -62,19 +62,21 @@ typedef int LOCKMETHOD; typedef struct LTAG { - Oid relId; - Oid dbId; + Oid relId; + Oid dbId; union { - BlockNumber blkno; - TransactionId xid; - } objId; - /* - * offnum should be part of objId.tupleId above, but would increase - * sizeof(LOCKTAG) and so moved here; currently used by userlocks only. + BlockNumber blkno; + TransactionId xid; + } objId; + + /* + * offnum should be part of objId.tupleId above, but would increase + * sizeof(LOCKTAG) and so moved here; currently used by userlocks + * only. */ - OffsetNumber offnum; - uint16 lockmethod; /* needed by userlocks */ + OffsetNumber offnum; + uint16 lockmethod; /* needed by userlocks */ } LOCKTAG; #define TAGSIZE (sizeof(LOCKTAG)) diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 23e657c7918..a0f8660fbea 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: proc.h,v 1.29 2000/02/22 09:55:26 inoue Exp $ + * $Id: proc.h,v 1.30 2000/04/12 17:16:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -82,9 +82,9 @@ typedef struct procglobal int32 freeSemMap[MAX_PROC_SEMS / PROC_NSEMS_PER_SET]; /* - * In each freeSemMap entry, the PROC_NSEMS_PER_SET least-significant bits - * flag whether individual semaphores are in use, and the next higher bit - * is set to show that the entire set is allocated. + * In each freeSemMap entry, the PROC_NSEMS_PER_SET least-significant + * bits flag whether individual semaphores are in use, and the next + * higher bit is set to show that the entire set is allocated. */ } PROC_HDR; diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h index 9ea2d4b5b67..fadd87edb75 100644 --- a/src/include/storage/s_lock.h +++ b/src/include/storage/s_lock.h @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.69 2000/01/26 05:58:33 momjian Exp $ + * $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.70 2000/04/12 17:16:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -260,7 +260,7 @@ tas(slock_t *s_lock) #else /* i.e. not __osf__ */ #define TAS(lock) tas(lock) -#define S_UNLOCK(lock) { __asm__("mb"); *(lock) = 0; } +#define S_UNLOCK(lock) do { __asm__("mb"); *(lock) = 0; } while (0) static __inline__ int tas(volatile slock_t *lock) @@ -300,10 +300,10 @@ __asm__(" ldq $0, %0 \n\ */ #define S_UNLOCK(lock) \ -{ \ +do { \ volatile slock_t *lock_ = (volatile slock_t *) (lock); \ lock_->sema[0] = lock_->sema[1] = lock_->sema[2] = lock_->sema[3] = -1; \ -} +} while (0) #define S_LOCK_FREE(lock) ( *(int *) (((long) (lock) + 15) & ~15) != 0) diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h index 18a14895d77..1d49eb8c620 100644 --- a/src/include/storage/sinvaladt.h +++ b/src/include/storage/sinvaladt.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: sinvaladt.h,v 1.20 2000/01/26 05:58:33 momjian Exp $ + * $Id: sinvaladt.h,v 1.21 2000/04/12 17:16:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,7 @@ /* * The shared cache invalidation manager is responsible for transmitting - * invalidation messages between backends. Any message sent by any backend + * invalidation messages between backends. Any message sent by any backend * must be delivered to all already-running backends before it can be * forgotten. * @@ -35,7 +35,7 @@ * In reality, the messages are stored in a circular buffer of MAXNUMMESSAGES * entries. We translate MsgNum values into circular-buffer indexes by * computing MsgNum % MAXNUMMESSAGES (this should be fast as long as - * MAXNUMMESSAGES is a constant and a power of 2). As long as maxMsgNum + * MAXNUMMESSAGES is a constant and a power of 2). As long as maxMsgNum * doesn't exceed minMsgNum by more than MAXNUMMESSAGES, we have enough space * in the buffer. If the buffer does overflow, we reset it to empty and * force each backend to "reset", ie, discard all its invalidatable state. @@ -85,16 +85,19 @@ typedef struct ProcState /* Shared cache invalidation memory segment */ typedef struct SISeg { + /* * General state information */ int minMsgNum; /* oldest message still needed */ int maxMsgNum; /* next message number to be assigned */ int maxBackends; /* size of procState array */ + /* * Circular buffer holding shared-inval messages */ - SharedInvalidData buffer[MAXNUMMESSAGES]; + SharedInvalidData buffer[MAXNUMMESSAGES]; + /* * Per-backend state info. * @@ -106,20 +109,19 @@ typedef struct SISeg extern SISeg *shmInvalBuffer; /* pointer to the shared buffer segment, - * set by SISegmentAttach() - */ + * set by SISegmentAttach() */ /* * prototypes for functions in sinvaladt.c */ -extern int SISegmentInit(bool createNewSegment, IPCKey key, - int maxBackends); +extern int SISegmentInit(bool createNewSegment, IPCKey key, + int maxBackends); extern int SIBackendInit(SISeg *segP); extern bool SIInsertDataEntry(SISeg *segP, SharedInvalidData *data); -extern int SIGetDataEntry(SISeg *segP, int backendId, - SharedInvalidData *data); +extern int SIGetDataEntry(SISeg *segP, int backendId, + SharedInvalidData *data); extern void SIDelExpiredDataEntries(SISeg *segP); #endif /* SINVALADT_H */ diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index bc0ec04bb2b..64702ffe702 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: smgr.h,v 1.19 2000/04/10 23:41:45 tgl Exp $ + * $Id: smgr.h,v 1.20 2000/04/12 17:16:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,20 +29,20 @@ extern int smgrunlink(int16 which, Relation reln); extern int smgrextend(int16 which, Relation reln, char *buffer); extern int smgropen(int16 which, Relation reln); extern int smgrclose(int16 which, Relation reln); -extern int smgrread(int16 which, Relation reln, BlockNumber blocknum, - char *buffer); -extern int smgrwrite(int16 which, Relation reln, BlockNumber blocknum, - char *buffer); -extern int smgrflush(int16 which, Relation reln, BlockNumber blocknum, - char *buffer); -extern int smgrblindwrt(int16 which, char *dbname, char *relname, - Oid dbid, Oid relid, - BlockNumber blkno, char *buffer, - bool dofsync); +extern int smgrread(int16 which, Relation reln, BlockNumber blocknum, + char *buffer); +extern int smgrwrite(int16 which, Relation reln, BlockNumber blocknum, + char *buffer); +extern int smgrflush(int16 which, Relation reln, BlockNumber blocknum, + char *buffer); +extern int smgrblindwrt(int16 which, char *dbname, char *relname, + Oid dbid, Oid relid, + BlockNumber blkno, char *buffer, + bool dofsync); extern int smgrmarkdirty(int16 which, Relation reln, BlockNumber blkno); -extern int smgrblindmarkdirty(int16 which, char *dbname, char *relname, - Oid dbid, Oid relid, - BlockNumber blkno); +extern int smgrblindmarkdirty(int16 which, char *dbname, char *relname, + Oid dbid, Oid relid, + BlockNumber blkno); extern int smgrnblocks(int16 which, Relation reln); extern int smgrtruncate(int16 which, Relation reln, int nblocks); extern int smgrcommit(void); @@ -62,12 +62,12 @@ extern int mdclose(Relation reln); extern int mdread(Relation reln, BlockNumber blocknum, char *buffer); extern int mdwrite(Relation reln, BlockNumber blocknum, char *buffer); extern int mdflush(Relation reln, BlockNumber blocknum, char *buffer); -extern int mdblindwrt(char *dbname, char *relname, Oid dbid, Oid relid, - BlockNumber blkno, char *buffer, - bool dofsync); +extern int mdblindwrt(char *dbname, char *relname, Oid dbid, Oid relid, + BlockNumber blkno, char *buffer, + bool dofsync); extern int mdmarkdirty(Relation reln, BlockNumber blkno); -extern int mdblindmarkdirty(char *dbname, char *relname, Oid dbid, Oid relid, - BlockNumber blkno); +extern int mdblindmarkdirty(char *dbname, char *relname, Oid dbid, Oid relid, + BlockNumber blkno); extern int mdnblocks(Relation reln); extern int mdtruncate(Relation reln, int nblocks); extern int mdcommit(void); @@ -85,12 +85,12 @@ extern int mmclose(Relation reln); extern int mmread(Relation reln, BlockNumber blocknum, char *buffer); extern int mmwrite(Relation reln, BlockNumber blocknum, char *buffer); extern int mmflush(Relation reln, BlockNumber blocknum, char *buffer); -extern int mmblindwrt(char *dbname, char *relname, Oid dbid, Oid relid, - BlockNumber blkno, char *buffer, - bool dofsync); +extern int mmblindwrt(char *dbname, char *relname, Oid dbid, Oid relid, + BlockNumber blkno, char *buffer, + bool dofsync); extern int mmmarkdirty(Relation reln, BlockNumber blkno); -extern int mmblindmarkdirty(char *dbname, char *relname, Oid dbid, Oid relid, - BlockNumber blkno); +extern int mmblindmarkdirty(char *dbname, char *relname, Oid dbid, Oid relid, + BlockNumber blkno); extern int mmnblocks(Relation reln); extern int mmtruncate(Relation reln, int nblocks); extern int mmcommit(void); |