diff options
Diffstat (limited to 'src/include/storage')
| -rw-r--r-- | src/include/storage/backendid.h | 6 | ||||
| -rw-r--r-- | src/include/storage/block.h | 10 | ||||
| -rw-r--r-- | src/include/storage/buf.h | 4 | ||||
| -rw-r--r-- | src/include/storage/buf_internals.h | 117 | ||||
| -rw-r--r-- | src/include/storage/bufmgr.h | 58 | ||||
| -rw-r--r-- | src/include/storage/bufpage.h | 38 | ||||
| -rw-r--r-- | src/include/storage/fd.h | 50 | ||||
| -rw-r--r-- | src/include/storage/ipc.h | 86 | ||||
| -rw-r--r-- | src/include/storage/itemid.h | 16 | ||||
| -rw-r--r-- | src/include/storage/itempos.h | 12 | ||||
| -rw-r--r-- | src/include/storage/itemptr.h | 10 | ||||
| -rw-r--r-- | src/include/storage/large_object.h | 34 | ||||
| -rw-r--r-- | src/include/storage/lmgr.h | 48 | ||||
| -rw-r--r-- | src/include/storage/lock.h | 96 | ||||
| -rw-r--r-- | src/include/storage/multilev.h | 12 | ||||
| -rw-r--r-- | src/include/storage/off.h | 4 | ||||
| -rw-r--r-- | src/include/storage/pagenum.h | 6 | ||||
| -rw-r--r-- | src/include/storage/pos.h | 4 | ||||
| -rw-r--r-- | src/include/storage/proc.h | 64 | ||||
| -rw-r--r-- | src/include/storage/shmem.h | 46 | ||||
| -rw-r--r-- | src/include/storage/sinval.h | 12 | ||||
| -rw-r--r-- | src/include/storage/sinvaladt.h | 66 | ||||
| -rw-r--r-- | src/include/storage/smgr.h | 84 | ||||
| -rw-r--r-- | src/include/storage/spin.h | 12 |
24 files changed, 447 insertions, 448 deletions
diff --git a/src/include/storage/backendid.h b/src/include/storage/backendid.h index 5abdd770e8..25be9a4fdc 100644 --- a/src/include/storage/backendid.h +++ b/src/include/storage/backendid.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: backendid.h,v 1.3 1997/09/07 05:00:40 momjian Exp $ + * $Id: backendid.h,v 1.4 1997/09/08 02:38:53 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,12 +17,12 @@ * -cim 8/17/90 * ---------------- */ -typedef int16 BackendId; /* unique currently active backend +typedef int16 BackendId; /* unique currently active backend * identifier */ #define InvalidBackendId (-1) -typedef int32 BackendTag; /* unique backend identifier */ +typedef int32 BackendTag; /* unique backend identifier */ #define InvalidBackendTag (-1) diff --git a/src/include/storage/block.h b/src/include/storage/block.h index 9702b53e2e..a057122438 100644 --- a/src/include/storage/block.h +++ b/src/include/storage/block.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: block.h,v 1.3 1997/09/07 05:00:42 momjian Exp $ + * $Id: block.h,v 1.4 1997/09/08 02:38:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -27,7 +27,7 @@ * more or less the only pieces of code that should be accessing disk * blocks directly. */ -typedef uint32 BlockNumber; +typedef uint32 BlockNumber; #define InvalidBlockNumber ((BlockNumber) 0xFFFFFFFF) @@ -49,9 +49,9 @@ typedef uint32 BlockNumber; */ typedef struct BlockIdData { - uint16 bi_hi; - uint16 bi_lo; -} BlockIdData; + uint16 bi_hi; + uint16 bi_lo; +} BlockIdData; typedef BlockIdData *BlockId; /* block identifier */ diff --git a/src/include/storage/buf.h b/src/include/storage/buf.h index 481033c4a7..86288cb345 100644 --- a/src/include/storage/buf.h +++ b/src/include/storage/buf.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: buf.h,v 1.2 1997/09/07 05:00:45 momjian Exp $ + * $Id: buf.h,v 1.3 1997/09/08 02:38:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,7 @@ #define InvalidBuffer (0) #define UnknownBuffer (-99999) -typedef long Buffer; +typedef long Buffer; /* * BufferIsInvalid -- diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h index aea48e15cb..482b15d9d1 100644 --- a/src/include/storage/buf_internals.h +++ b/src/include/storage/buf_internals.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: buf_internals.h,v 1.15 1997/09/07 05:00:52 momjian Exp $ + * $Id: buf_internals.h,v 1.16 1997/09/08 02:38:57 momjian Exp $ * * NOTE * If BUFFERPAGE0 is defined, then 0 will be used as a @@ -22,11 +22,11 @@ /* Buf Mgr constants */ /* in bufmgr.c */ -extern int NBuffers; -extern int Data_Descriptors; -extern int Free_List_Descriptor; -extern int Lookup_List_Descriptor; -extern int Num_Descriptors; +extern int NBuffers; +extern int Data_Descriptors; +extern int Free_List_Descriptor; +extern int Lookup_List_Descriptor; +extern int Num_Descriptors; /* * Flags for buffer descriptors @@ -40,19 +40,19 @@ extern int Num_Descriptors; #define BM_IO_ERROR (1 << 6) #define BM_JUST_DIRTIED (1 << 7) -typedef bits16 BufFlags; +typedef bits16 BufFlags; typedef struct sbufdesc BufferDesc; typedef struct sbufdesc BufferHdr; typedef struct buftag BufferTag; /* long * so alignment will be correct */ -typedef long **BufferBlock; +typedef long **BufferBlock; struct buftag { - LRelId relId; - BlockNumber blockNum; /* blknum relative to begin of reln */ + LRelId relId; + BlockNumber blockNum; /* blknum relative to begin of reln */ }; #define CLEAR_BUFFERTAG(a)\ @@ -110,45 +110,44 @@ struct buftag */ struct sbufdesc_unpadded { - Buffer freeNext; - Buffer freePrev; - SHMEM_OFFSET data; - BufferTag tag; - int buf_id; - BufFlags flags; - int16 bufsmgr; - unsigned refcount; + Buffer freeNext; + Buffer freePrev; + SHMEM_OFFSET data; + BufferTag tag; + int buf_id; + BufFlags flags; + int16 bufsmgr; + unsigned refcount; #ifdef HAS_TEST_AND_SET - slock_t io_in_progress_lock; + slock_t io_in_progress_lock; #endif /* HAS_TEST_AND_SET */ - char sb_dbname[NAMEDATALEN]; + char sb_dbname[NAMEDATALEN]; /* NOTE NO PADDING OF THE MEMBER HERE */ - char sb_relname[NAMEDATALEN]; + char sb_relname[NAMEDATALEN]; }; /* THE REAL STRUCTURE - the structure above must match it, minus sb_pad */ struct sbufdesc { - Buffer freeNext; /* link for freelist chain */ - Buffer freePrev; - SHMEM_OFFSET data; /* pointer to data in buf pool */ + Buffer freeNext; /* link for freelist chain */ + Buffer freePrev; + SHMEM_OFFSET data; /* pointer to data in buf pool */ /* tag and id must be together for table lookup to work */ - BufferTag tag; /* file/block identifier */ - int buf_id; /* maps global desc to local desc */ + BufferTag tag; /* file/block identifier */ + int buf_id; /* maps global desc to local desc */ - BufFlags flags; /* described below */ - int16 bufsmgr; /* storage manager id for buffer */ - unsigned refcount; /* # of times buffer is pinned */ + BufFlags flags; /* described below */ + int16 bufsmgr; /* storage manager id for buffer */ + unsigned refcount; /* # of times buffer is pinned */ #ifdef HAS_TEST_AND_SET /* can afford a dedicated lock if test-and-set locks are available */ - slock_t io_in_progress_lock; + slock_t io_in_progress_lock; #endif /* HAS_TEST_AND_SET */ - char sb_dbname[NAMEDATALEN]; /* name of db in which buf - * belongs */ + char sb_dbname[NAMEDATALEN]; /* name of db in which buf belongs */ /* * I padded this structure to a power of 2 (PADDED_SBUFDESC_SIZE) @@ -167,8 +166,8 @@ struct sbufdesc * something important */ - char sb_relname[NAMEDATALEN + /* name of reln */ - PADDED_SBUFDESC_SIZE - sizeof(struct sbufdesc_unpadded)]; + char sb_relname[NAMEDATALEN + /* name of reln */ + PADDED_SBUFDESC_SIZE - sizeof(struct sbufdesc_unpadded)]; }; /* @@ -180,19 +179,19 @@ struct sbufdesc typedef struct _bmtrace { - int bmt_pid; - long bmt_buf; - long bmt_dbid; - long bmt_relid; - int bmt_blkno; - int bmt_op; + int bmt_pid; + long bmt_buf; + long bmt_dbid; + long bmt_relid; + int bmt_blkno; + int bmt_op; #define BMT_NOTUSED 0 #define BMT_ALLOCFND 1 #define BMT_ALLOCNOTFND 2 #define BMT_DEALLOC 3 -} bmtrace; +} bmtrace; #endif /* BMTRACE */ @@ -204,39 +203,39 @@ typedef struct _bmtrace /* Internal routines: only called by buf.c */ /*freelist.c*/ -extern void AddBufferToFreelist(BufferDesc * bf); -extern void PinBuffer(BufferDesc * buf); -extern void PinBuffer_Debug(char *file, int line, BufferDesc * buf); -extern void UnpinBuffer(BufferDesc * buf); +extern void AddBufferToFreelist(BufferDesc * bf); +extern void PinBuffer(BufferDesc * buf); +extern void PinBuffer_Debug(char *file, int line, BufferDesc * buf); +extern void UnpinBuffer(BufferDesc * buf); extern BufferDesc *GetFreeBuffer(void); -extern void InitFreeList(bool init); +extern void InitFreeList(bool init); /* buf_table.c */ -extern void InitBufTable(void); +extern void InitBufTable(void); extern BufferDesc *BufTableLookup(BufferTag * tagPtr); -extern bool BufTableDelete(BufferDesc * buf); -extern bool BufTableInsert(BufferDesc * buf); +extern bool BufTableDelete(BufferDesc * buf); +extern bool BufTableInsert(BufferDesc * buf); /* bufmgr.c */ extern BufferDesc *BufferDescriptors; extern BufferBlock BufferBlocks; -extern long *PrivateRefCount; -extern long *LastRefCount; -extern long *CommitInfoNeedsSave; +extern long *PrivateRefCount; +extern long *LastRefCount; +extern long *CommitInfoNeedsSave; extern SPINLOCK BufMgrLock; /* localbuf.c */ -extern long *LocalRefCount; +extern long *LocalRefCount; extern BufferDesc *LocalBufferDescriptors; -extern int NLocBuffer; +extern int NLocBuffer; extern BufferDesc * LocalBufferAlloc(Relation reln, BlockNumber blockNum, bool * foundPtr); -extern int WriteLocalBuffer(Buffer buffer, bool release); -extern int FlushLocalBuffer(Buffer buffer, bool release); -extern void InitLocalBuffer(void); -extern void LocalBufferSync(void); -extern void ResetLocalBufferPool(void); +extern int WriteLocalBuffer(Buffer buffer, bool release); +extern int FlushLocalBuffer(Buffer buffer, bool release); +extern void InitLocalBuffer(void); +extern void LocalBufferSync(void); +extern void ResetLocalBufferPool(void); #endif /* BUFMGR_INTERNALS_H */ diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h index d432506c7c..9f65b80f67 100644 --- a/src/include/storage/bufmgr.h +++ b/src/include/storage/bufmgr.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: bufmgr.h,v 1.12 1997/09/07 05:01:06 momjian Exp $ + * $Id: bufmgr.h,v 1.13 1997/09/08 02:38:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,13 +29,13 @@ */ #define MAXBLCKSZ 8192 -typedef void *Block; +typedef void *Block; /* special pageno for bget */ #define P_NEW InvalidBlockNumber /* grow the file to get a new page */ -typedef bits16 BufferLock; +typedef bits16 BufferLock; /********************************************************************** @@ -60,7 +60,7 @@ typedef bits16 BufferLock; #define BufferIsPinned BufferIsValid -extern int ShowPinTrace; +extern int ShowPinTrace; /* * BufferWriteModes (settable via SetBufferWriteMode) @@ -71,38 +71,38 @@ extern int ShowPinTrace; /* * prototypes for functions in bufmgr.c */ -extern Buffer +extern Buffer RelationGetBufferWithBuffer(Relation relation, BlockNumber blockNumber, Buffer buffer); -extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum); -extern int WriteBuffer(Buffer buffer); -extern int WriteNoReleaseBuffer(Buffer buffer); -extern Buffer +extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum); +extern int WriteBuffer(Buffer buffer); +extern int WriteNoReleaseBuffer(Buffer buffer); +extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation, BlockNumber blockNum); -extern void InitBufferPool(IPCKey key); -extern void PrintBufferUsage(FILE * statfp); -extern void ResetBufferUsage(void); -extern void ResetBufferPool(void); -extern int BufferPoolCheckLeak(void); -extern void FlushBufferPool(int StableMainMemoryFlag); -extern bool BufferIsValid(Buffer bufnum); +extern void InitBufferPool(IPCKey key); +extern void PrintBufferUsage(FILE * statfp); +extern void ResetBufferUsage(void); +extern void ResetBufferPool(void); +extern int BufferPoolCheckLeak(void); +extern void FlushBufferPool(int StableMainMemoryFlag); +extern bool BufferIsValid(Buffer bufnum); extern BlockNumber BufferGetBlockNumber(Buffer buffer); extern Relation BufferGetRelation(Buffer buffer); extern BlockNumber RelationGetNumberOfBlocks(Relation relation); -extern Block BufferGetBlock(Buffer buffer); -extern void ReleaseRelationBuffers(Relation rdesc); -extern void DropBuffers(Oid dbid); -extern void PrintBufferDescs(void); -extern void PrintPinnedBufs(void); -extern int BufferShmemSize(void); -extern void IncrBufferRefCount(Buffer buffer); -extern int ReleaseBuffer(Buffer buffer); - -extern void BufferRefCountReset(int *refcountsave); -extern void BufferRefCountRestore(int *refcountsave); -extern int SetBufferWriteMode(int mode); -extern void SetBufferCommitInfoNeedsSave(Buffer buffer); +extern Block BufferGetBlock(Buffer buffer); +extern void ReleaseRelationBuffers(Relation rdesc); +extern void DropBuffers(Oid dbid); +extern void PrintBufferDescs(void); +extern void PrintPinnedBufs(void); +extern int BufferShmemSize(void); +extern void IncrBufferRefCount(Buffer buffer); +extern int ReleaseBuffer(Buffer buffer); + +extern void BufferRefCountReset(int *refcountsave); +extern void BufferRefCountRestore(int *refcountsave); +extern int SetBufferWriteMode(int mode); +extern void SetBufferCommitInfoNeedsSave(Buffer buffer); #endif /* !defined(BufMgrIncluded) */ diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h index a252ccc3e4..4b031746f0 100644 --- a/src/include/storage/bufpage.h +++ b/src/include/storage/bufpage.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: bufpage.h,v 1.11 1997/09/07 05:01:10 momjian Exp $ + * $Id: bufpage.h,v 1.12 1997/09/08 02:38:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -87,7 +87,7 @@ * note that this is actually limited to 2^13 because we have limited * ItemIdData.lp_off and ItemIdData.lp_len to 13 bits (see itemid.h). */ -typedef uint16 LocationIndex; +typedef uint16 LocationIndex; /* @@ -101,8 +101,8 @@ typedef uint16 LocationIndex; */ typedef struct OpaqueData { - uint16 od_pagesize; -} OpaqueData; + uint16 od_pagesize; +} OpaqueData; typedef OpaqueData *Opaque; @@ -112,12 +112,12 @@ typedef OpaqueData *Opaque; */ typedef struct PageHeaderData { - LocationIndex pd_lower; /* offset to start of free space */ - LocationIndex pd_upper; /* offset to end of free space */ - LocationIndex pd_special; /* offset to start of special space */ - OpaqueData pd_opaque; /* AM-generic information */ - ItemIdData pd_linp[1]; /* line pointers */ -} PageHeaderData; + LocationIndex pd_lower; /* offset to start of free space */ + LocationIndex pd_upper; /* offset to end of free space */ + LocationIndex pd_special; /* offset to start of special space */ + OpaqueData pd_opaque; /* AM-generic information */ + ItemIdData pd_linp[1]; /* line pointers */ +} PageHeaderData; typedef PageHeaderData *PageHeader; @@ -125,7 +125,7 @@ typedef enum { ShufflePageManagerMode, OverwritePageManagerMode -} PageManagerMode; +} PageManagerMode; /* ---------------- * misc support macros @@ -279,17 +279,17 @@ typedef enum * ---------------------------------------------------------------- */ -extern void PageInit(Page page, Size pageSize, Size specialSize); -extern OffsetNumber +extern void PageInit(Page page, Size pageSize, Size specialSize); +extern OffsetNumber PageAddItem(Page page, Item item, Size size, OffsetNumber offsetNumber, ItemIdFlags flags); -extern Page PageGetTempPage(Page page, Size specialSize); -extern void PageRestoreTempPage(Page tempPage, Page oldPage); +extern Page PageGetTempPage(Page page, Size specialSize); +extern void PageRestoreTempPage(Page tempPage, Page oldPage); extern OffsetNumber PageGetMaxOffsetNumber(Page page); -extern void PageRepairFragmentation(Page page); -extern Size PageGetFreeSpace(Page page); -extern void PageManagerModeSet(PageManagerMode mode); -extern void PageIndexTupleDelete(Page page, OffsetNumber offset); +extern void PageRepairFragmentation(Page page); +extern Size PageGetFreeSpace(Page page); +extern void PageManagerModeSet(PageManagerMode mode); +extern void PageIndexTupleDelete(Page page, OffsetNumber offset); #endif /* BUFPAGE_H */ diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index 9fbe004d4a..e5404154a6 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: fd.h,v 1.9 1997/09/07 05:01:12 momjian Exp $ + * $Id: fd.h,v 1.10 1997/09/08 02:39:00 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -40,41 +40,41 @@ * FileSeek uses the standard UNIX lseek(2) flags. */ -typedef char *FileName; +typedef char *FileName; -typedef int File; +typedef int File; /* originally in libpq-fs.h */ struct pgstat { /* just the fields we need from stat * structure */ - int st_ino; - int st_mode; - unsigned int st_size; - unsigned int st_sizehigh;/* high order bits */ + int st_ino; + int st_mode; + unsigned int st_size; + unsigned int st_sizehigh; /* high order bits */ /* 2^64 == 1.8 x 10^20 bytes */ - int st_uid; - int st_atime_s; /* just the seconds */ - int st_mtime_s; /* since SysV and the new BSD both have */ - int st_ctime_s; /* usec fields.. */ + int st_uid; + int st_atime_s; /* just the seconds */ + int st_mtime_s; /* since SysV and the new BSD both have */ + int st_ctime_s; /* usec fields.. */ }; /* * prototypes for functions in fd.c */ -extern File FileNameOpenFile(FileName fileName, int fileFlags, int fileMode); -extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode); -extern void FileClose(File file); -extern void FileUnlink(File file); -extern int FileRead(File file, char *buffer, int amount); -extern int FileWrite(File file, char *buffer, int amount); -extern long FileSeek(File file, long offset, int whence); -extern int FileTruncate(File file, int offset); -extern int FileSync(File file); -extern int FileNameUnlink(char *filename); -extern FILE *AllocateFile(char *name, char *mode); -extern void FreeFile(FILE *); -extern void closeAllVfds(void); -extern int pg_fsync(int fd); +extern File FileNameOpenFile(FileName fileName, int fileFlags, int fileMode); +extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode); +extern void FileClose(File file); +extern void FileUnlink(File file); +extern int FileRead(File file, char *buffer, int amount); +extern int FileWrite(File file, char *buffer, int amount); +extern long FileSeek(File file, long offset, int whence); +extern int FileTruncate(File file, int offset); +extern int FileSync(File file); +extern int FileNameUnlink(char *filename); +extern FILE *AllocateFile(char *name, char *mode); +extern void FreeFile(FILE *); +extern void closeAllVfds(void); +extern int pg_fsync(int fd); #endif /* FD_H */ diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h index 9e08d6b94e..e75a26c045 100644 --- a/src/include/storage/ipc.h +++ b/src/include/storage/ipc.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: ipc.h,v 1.18 1997/09/07 05:01:14 momjian Exp $ + * $Id: ipc.h,v 1.19 1997/09/08 02:39:01 momjian Exp $ * * NOTES * This file is very architecture-specific. This stuff should actually @@ -28,15 +28,15 @@ #if defined(HAS_TEST_AND_SET) -extern void S_LOCK(slock_t * lock); -extern void S_UNLOCK(slock_t * lock); -extern void S_INIT_LOCK(slock_t * lock); +extern void S_LOCK(slock_t * lock); +extern void S_UNLOCK(slock_t * lock); +extern void S_INIT_LOCK(slock_t * lock); #if (defined(alpha) && !defined(linuxalpha)) || \ defined(hpux) || \ defined(irix5) || \ defined(nextstep) -extern int S_LOCK_FREE(slock_t * lock); +extern int S_LOCK_FREE(slock_t * lock); #else #define S_LOCK_FREE(lock) ((*lock) == 0) @@ -47,14 +47,14 @@ extern int S_LOCK_FREE(slock_t * lock); #ifndef HAVE_UNION_SEMUN union semun { - int val; + int val; struct semid_ds *buf; unsigned short *array; }; #endif -typedef uint16 SystemPortAddress; +typedef uint16 SystemPortAddress; /* semaphore definitions */ @@ -70,8 +70,8 @@ typedef uint16 SystemPortAddress; #define IpcSemIdExist (-3) #define IpcSemIdNotExist (-4) -typedef uint32 IpcSemaphoreKey;/* semaphore key */ -typedef int IpcSemaphoreId; +typedef uint32 IpcSemaphoreKey; /* semaphore key */ +typedef int IpcSemaphoreId; /* shared memory definitions */ @@ -79,37 +79,37 @@ typedef int IpcSemaphoreId; #define IpcMemIdGetFailed (-2) #define IpcMemAttachFailed 0 -typedef uint32 IPCKey; +typedef uint32 IPCKey; #define PrivateIPCKey IPC_PRIVATE #define DefaultIPCKey 17317 -typedef uint32 IpcMemoryKey; /* shared memory key */ -typedef int IpcMemoryId; +typedef uint32 IpcMemoryKey; /* shared memory key */ +typedef int IpcMemoryId; /* ipc.c */ -extern void exitpg(int code); -extern void quasi_exitpg(void); -extern int on_exitpg(void (*function) (), caddr_t arg); +extern void exitpg(int code); +extern void quasi_exitpg(void); +extern int on_exitpg(void (*function) (), caddr_t arg); -extern IpcSemaphoreId +extern IpcSemaphoreId IpcSemaphoreCreate(IpcSemaphoreKey semKey, int semNum, int permission, int semStartValue, int removeOnExit, int *status); -extern void IpcSemaphoreKill(IpcSemaphoreKey key); -extern void IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock); -extern void IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock); -extern int IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem); -extern int IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem); -extern IpcMemoryId +extern void IpcSemaphoreKill(IpcSemaphoreKey key); +extern void IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock); +extern void IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock); +extern int IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem); +extern int IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem); +extern IpcMemoryId IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, int permission); extern IpcMemoryId IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size); -extern char *IpcMemoryAttach(IpcMemoryId memId); -extern void IpcMemoryKill(IpcMemoryKey memKey); -extern void CreateAndInitSLockMemory(IPCKey key); -extern void AttachSLockMemory(IPCKey key); +extern char *IpcMemoryAttach(IpcMemoryId memId); +extern void IpcMemoryKill(IpcMemoryKey memKey); +extern void CreateAndInitSLockMemory(IPCKey key); +extern void AttachSLockMemory(IPCKey key); #ifdef HAS_TEST_AND_SET @@ -135,24 +135,24 @@ typedef enum _LockId_ PROCSTRUCTLOCKID, FIRSTFREELOCKID -} _LockId_; +} _LockId_; #define MAX_SPINS FIRSTFREELOCKID typedef struct slock { - slock_t locklock; - unsigned char flag; - short nshlocks; - slock_t shlock; - slock_t exlock; - slock_t comlock; - struct slock *next; -} SLock; - -extern void ExclusiveLock(int lockid); -extern void ExclusiveUnlock(int lockid); -extern bool LockIsFree(int lockid); + slock_t locklock; + unsigned char flag; + short nshlocks; + slock_t shlock; + slock_t exlock; + slock_t comlock; + struct slock *next; +} SLock; + +extern void ExclusiveLock(int lockid); +extern void ExclusiveUnlock(int lockid); +extern bool LockIsFree(int lockid); #else /* HAS_TEST_AND_SET */ @@ -171,7 +171,7 @@ typedef enum _LockId_ PROCSTRUCTLOCKID, OIDGENLOCKID, FIRSTFREELOCKID -} _LockId_; +} _LockId_; #define MAX_SPINS FIRSTFREELOCKID @@ -220,8 +220,8 @@ typedef enum _LockId_ ((key == PrivateIPCKey) ? key : 14 + (key)) /* ipci.c */ -extern IPCKey SystemPortAddressCreateIPCKey(SystemPortAddress address); -extern void CreateSharedMemoryAndSemaphores(IPCKey key); -extern void AttachSharedMemoryAndSemaphores(IPCKey key); +extern IPCKey SystemPortAddressCreateIPCKey(SystemPortAddress address); +extern void CreateSharedMemoryAndSemaphores(IPCKey key); +extern void AttachSharedMemoryAndSemaphores(IPCKey key); #endif /* IPC_H */ diff --git a/src/include/storage/itemid.h b/src/include/storage/itemid.h index 9e5e6f94d4..1c382fb1b9 100644 --- a/src/include/storage/itemid.h +++ b/src/include/storage/itemid.h @@ -6,27 +6,27 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: itemid.h,v 1.2 1997/09/07 05:01:17 momjian Exp $ + * $Id: itemid.h,v 1.3 1997/09/08 02:39:02 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef ITEMID_H #define ITEMID_H -typedef uint16 ItemOffset; -typedef uint16 ItemLength; +typedef uint16 ItemOffset; +typedef uint16 ItemLength; -typedef bits16 ItemIdFlags; +typedef bits16 ItemIdFlags; typedef struct ItemIdData { /* line pointers */ - unsigned lp_off:13, /* offset to find tup */ + unsigned lp_off:13, /* offset to find tup */ /* can be reduced by 2 if necc. */ - lp_flags:6, /* flags on tuple */ - lp_len:13; /* length of tuple */ -} ItemIdData; + lp_flags:6, /* flags on tuple */ + lp_len:13; /* length of tuple */ +} ItemIdData; typedef struct ItemIdData *ItemId; diff --git a/src/include/storage/itempos.h b/src/include/storage/itempos.h index bea9cd6474..332636ce95 100644 --- a/src/include/storage/itempos.h +++ b/src/include/storage/itempos.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: itempos.h,v 1.4 1997/09/07 05:01:20 momjian Exp $ + * $Id: itempos.h,v 1.5 1997/09/08 02:39:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -18,11 +18,11 @@ typedef struct ItemSubpositionData { - Buffer op_db; - ItemId op_lpp; - char *op_cp; /* XXX */ - uint32 op_len; -} ItemSubpositionData; + Buffer op_db; + ItemId op_lpp; + char *op_cp; /* XXX */ + uint32 op_len; +} ItemSubpositionData; typedef ItemSubpositionData *ItemSubposition; diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h index 3460cd19f9..b6156ca229 100644 --- a/src/include/storage/itemptr.h +++ b/src/include/storage/itemptr.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: itemptr.h,v 1.5 1997/09/07 05:01:22 momjian Exp $ + * $Id: itemptr.h,v 1.6 1997/09/08 02:39:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,9 +25,9 @@ */ typedef struct ItemPointerData { - BlockIdData ip_blkid; - OffsetNumber ip_posid; -} ItemPointerData; + BlockIdData ip_blkid; + OffsetNumber ip_posid; +} ItemPointerData; typedef ItemPointerData *ItemPointer; @@ -108,6 +108,6 @@ typedef ItemPointerData *ItemPointer; * ---------------- */ -extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2); +extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2); #endif /* ITEMPTR_H */ diff --git a/src/include/storage/large_object.h b/src/include/storage/large_object.h index 1144d1ca02..710b1bac5c 100644 --- a/src/include/storage/large_object.h +++ b/src/include/storage/large_object.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: large_object.h,v 1.5 1997/09/07 05:01:24 momjian Exp $ + * $Id: large_object.h,v 1.6 1997/09/08 02:39:03 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,22 +23,22 @@ */ typedef struct LargeObjectDesc { - Relation heap_r; /* heap relation */ - Relation index_r; /* index relation on seqno attribute */ - IndexScanDesc iscan; /* index scan we're using */ - TupleDesc hdesc; /* heap relation tuple desc */ - TupleDesc idesc; /* index relation tuple desc */ - uint32 lowbyte; /* low byte on the current page */ - uint32 highbyte; /* high byte on the current page */ - uint32 offset; /* current seek pointer */ + Relation heap_r; /* heap relation */ + Relation index_r; /* index relation on seqno attribute */ + IndexScanDesc iscan; /* index scan we're using */ + TupleDesc hdesc; /* heap relation tuple desc */ + TupleDesc idesc; /* index relation tuple desc */ + uint32 lowbyte; /* low byte on the current page */ + uint32 highbyte; /* high byte on the current page */ + uint32 offset; /* current seek pointer */ ItemPointerData htid; /* tid of current heap tuple */ #define IFS_RDLOCK (1 << 0) #define IFS_WRLOCK (1 << 1) #define IFS_ATEOF (1 << 2) - u_long flags; /* locking info, etc */ -} LargeObjectDesc; + u_long flags; /* locking info, etc */ +} LargeObjectDesc; /* * Function definitions... @@ -47,11 +47,11 @@ typedef struct LargeObjectDesc /* inversion stuff in inv_api.c */ extern LargeObjectDesc *inv_create(int flags); extern LargeObjectDesc *inv_open(Oid lobjId, int flags); -extern void inv_close(LargeObjectDesc * obj_desc); -extern int inv_destroy(Oid lobjId); -extern int inv_seek(LargeObjectDesc * obj_desc, int offset, int whence); -extern int inv_tell(LargeObjectDesc * obj_desc); -extern int inv_read(LargeObjectDesc * obj_desc, char *buf, int nbytes); -extern int inv_write(LargeObjectDesc * obj_desc, char *buf, int nbytes); +extern void inv_close(LargeObjectDesc * obj_desc); +extern int inv_destroy(Oid lobjId); +extern int inv_seek(LargeObjectDesc * obj_desc, int offset, int whence); +extern int inv_tell(LargeObjectDesc * obj_desc); +extern int inv_read(LargeObjectDesc * obj_desc, char *buf, int nbytes); +extern int inv_write(LargeObjectDesc * obj_desc, char *buf, int nbytes); #endif /* LARGE_OBJECT_H */ diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h index debe950c7c..bd8d50f709 100644 --- a/src/include/storage/lmgr.h +++ b/src/include/storage/lmgr.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: lmgr.h,v 1.6 1997/09/07 05:01:25 momjian Exp $ + * $Id: lmgr.h,v 1.7 1997/09/08 02:39:04 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -22,31 +22,31 @@ */ typedef struct LRelId { - Oid relId; /* a relation identifier */ - Oid dbId; /* a database identifier */ -} LRelId; + Oid relId; /* a relation identifier */ + Oid dbId; /* a database identifier */ +} LRelId; typedef struct LockInfoData { - bool initialized; - LRelId lRelId; - TransactionId transactionIdData; - uint16 flags; -} LockInfoData; + bool initialized; + LRelId lRelId; + TransactionId transactionIdData; + uint16 flags; +} LockInfoData; typedef LockInfoData *LockInfo; #define LockInfoIsValid(linfo) \ ((PointerIsValid(linfo)) && ((LockInfo) linfo)->initialized) -extern LRelId RelationGetLRelId(Relation relation); -extern Oid LRelIdGetRelationId(LRelId lRelId); -extern void RelationInitLockInfo(Relation relation); -extern void RelationSetLockForDescriptorOpen(Relation relation); -extern void RelationSetLockForRead(Relation relation); -extern void RelationUnsetLockForRead(Relation relation); -extern void RelationSetLockForWrite(Relation relation); -extern void RelationUnsetLockForWrite(Relation relation); +extern LRelId RelationGetLRelId(Relation relation); +extern Oid LRelIdGetRelationId(LRelId lRelId); +extern void RelationInitLockInfo(Relation relation); +extern void RelationSetLockForDescriptorOpen(Relation relation); +extern void RelationSetLockForRead(Relation relation); +extern void RelationUnsetLockForRead(Relation relation); +extern void RelationSetLockForWrite(Relation relation); +extern void RelationUnsetLockForWrite(Relation relation); /* used in vaccum.c */ extern void @@ -66,18 +66,18 @@ RelationSetSingleRLockPage(Relation relation, extern void RelationUnsetSingleRLockPage(Relation relation, ItemPointer itemPointer); -extern void RelationSetRIntentLock(Relation relation); -extern void RelationUnsetRIntentLock(Relation relation); -extern void RelationSetWIntentLock(Relation relation); -extern void RelationUnsetWIntentLock(Relation relation); +extern void RelationSetRIntentLock(Relation relation); +extern void RelationUnsetRIntentLock(Relation relation); +extern void RelationSetWIntentLock(Relation relation); +extern void RelationUnsetWIntentLock(Relation relation); /* single.c */ -extern bool SingleLockReln(LockInfo linfo, LOCKT lockt, int action); -extern bool +extern bool SingleLockReln(LockInfo linfo, LOCKT lockt, int action); +extern bool SingleLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt, int action); /* proc.c */ -extern void InitProcGlobal(IPCKey key); +extern void InitProcGlobal(IPCKey key); #endif /* LMGR_H */ diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h index 2b0f76649b..8987957534 100644 --- a/src/include/storage/lock.h +++ b/src/include/storage/lock.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: lock.h,v 1.6 1997/09/07 05:01:26 momjian Exp $ + * $Id: lock.h,v 1.7 1997/09/08 02:39:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,7 +17,7 @@ #include <storage/itemptr.h> extern SPINLOCK LockMgrLock; -typedef int MASK; +typedef int MASK; #define INIT_TABLE_SIZE 100 #define MAX_TABLE_SIZE 1000 @@ -36,9 +36,9 @@ typedef int MASK; #define NLOCKS_PER_XACT 40 #define NLOCKENTS NLOCKS_PER_XACT*NBACKENDS -typedef int LOCK_TYPE; -typedef int LOCKT; -typedef int LockTableId; +typedef int LOCK_TYPE; +typedef int LOCKT; +typedef int LockTableId; /* MAX_LOCKTYPES cannot be larger than the bits in MASK */ #define MAX_LOCKTYPES 6 @@ -57,10 +57,10 @@ typedef int LockTableId; typedef struct ltag { - Oid relId; - Oid dbId; + Oid relId; + Oid dbId; ItemPointerData tupleId; -} LOCKTAG; +} LOCKTAG; #define TAGSIZE (sizeof(LOCKTAG)) @@ -86,12 +86,12 @@ typedef struct ltag */ typedef struct lockctl { - LockTableId tableId; - int nLockTypes; - int conflictTab[MAX_LOCKTYPES]; - int prio[MAX_LOCKTYPES]; - SPINLOCK masterLock; -} LOCKCTL; + LockTableId tableId; + int nLockTypes; + int conflictTab[MAX_LOCKTYPES]; + int prio[MAX_LOCKTYPES]; + SPINLOCK masterLock; +} LOCKCTL; /* * lockHash -- hash table on lock Ids, @@ -101,10 +101,10 @@ typedef struct lockctl */ typedef struct ltable { - HTAB *lockHash; - HTAB *xidHash; - LOCKCTL *ctl; -} LOCKTAB; + HTAB *lockHash; + HTAB *xidHash; + LOCKCTL *ctl; +} LOCKTAB; /* ----------------------- * A transaction never conflicts with its own locks. Hence, if @@ -137,30 +137,30 @@ typedef struct ltable typedef struct XIDTAG { - SHMEM_OFFSET lock; - int pid; - TransactionId xid; -} XIDTAG; + SHMEM_OFFSET lock; + int pid; + TransactionId xid; +} XIDTAG; typedef struct XIDLookupEnt { /* tag */ - XIDTAG tag; + XIDTAG tag; /* data */ - int holders[MAX_LOCKTYPES]; - int nHolding; - SHM_QUEUE queue; -} XIDLookupEnt; + int holders[MAX_LOCKTYPES]; + int nHolding; + SHM_QUEUE queue; +} XIDLookupEnt; #define XID_TAGSIZE (sizeof(XIDTAG)) /* originally in procq.h */ typedef struct procQueue { - SHM_QUEUE links; - int size; -} PROC_QUEUE; + SHM_QUEUE links; + int size; +} PROC_QUEUE; /* @@ -177,16 +177,16 @@ typedef struct procQueue typedef struct Lock { /* hash key */ - LOCKTAG tag; + LOCKTAG tag; /* data */ - int mask; - PROC_QUEUE waitProcs; - int holders[MAX_LOCKTYPES]; - int nHolding; - int activeHolders[MAX_LOCKTYPES]; - int nActive; -} LOCK; + int mask; + PROC_QUEUE waitProcs; + int holders[MAX_LOCKTYPES]; + int nHolding; + int activeHolders[MAX_LOCKTYPES]; + int nActive; +} LOCK; #define LockGetLock_nHolders(l) l->nHolders @@ -202,23 +202,23 @@ extern SPINLOCK LockMgrLock; /* * function prototypes */ -extern void InitLocks(void); -extern void LockDisable(int status); -extern LockTableId +extern void InitLocks(void); +extern void LockDisable(int status); +extern LockTableId LockTabInit(char *tabName, MASK * conflictsP, int *prioP, int ntypes); -extern bool LockAcquire(LockTableId tableId, LOCKTAG * lockName, LOCKT lockt); +extern bool LockAcquire(LockTableId tableId, LOCKTAG * lockName, LOCKT lockt); extern int LockResolveConflicts(LOCKTAB * ltable, LOCK * lock, LOCKT lockt, TransactionId xid); -extern bool LockRelease(LockTableId tableId, LOCKTAG * lockName, LOCKT lockt); -extern void GrantLock(LOCK * lock, LOCKT lockt); -extern bool LockReleaseAll(LockTableId tableId, SHM_QUEUE * lockQueue); -extern int LockShmemSize(void); -extern bool LockingDisabled(void); +extern bool LockRelease(LockTableId tableId, LOCKTAG * lockName, LOCKT lockt); +extern void GrantLock(LOCK * lock, LOCKT lockt); +extern bool LockReleaseAll(LockTableId tableId, SHM_QUEUE * lockQueue); +extern int LockShmemSize(void); +extern bool LockingDisabled(void); #ifdef DEADLOCK_DEBUG -extern void DumpLocks(void); +extern void DumpLocks(void); #endif diff --git a/src/include/storage/multilev.h b/src/include/storage/multilev.h index befc6227ae..3d4aa1edbb 100644 --- a/src/include/storage/multilev.h +++ b/src/include/storage/multilev.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: multilev.h,v 1.4 1997/09/07 05:01:28 momjian Exp $ + * $Id: multilev.h,v 1.5 1997/09/08 02:39:05 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -39,7 +39,7 @@ #define RELN_LEVEL 0 #define PAGE_LEVEL 1 #define TUPLE_LEVEL 2 -typedef int LOCK_LEVEL; +typedef int LOCK_LEVEL; /* multi.c */ @@ -50,9 +50,9 @@ extern LockTableId ShortTermTableId; * function prototypes */ extern LockTableId InitMultiLevelLockm(void); -extern bool MultiLockReln(LockInfo linfo, LOCKT lockt); -extern bool MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt); -extern bool MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt); -extern bool MultiReleaseReln(LockInfo linfo, LOCKT lockt); +extern bool MultiLockReln(LockInfo linfo, LOCKT lockt); +extern bool MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt); +extern bool MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt); +extern bool MultiReleaseReln(LockInfo linfo, LOCKT lockt); #endif /* MULTILEV_H */ diff --git a/src/include/storage/off.h b/src/include/storage/off.h index 3eadb842a7..3dc72d6701 100644 --- a/src/include/storage/off.h +++ b/src/include/storage/off.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: off.h,v 1.3 1997/09/07 05:01:29 momjian Exp $ + * $Id: off.h,v 1.4 1997/09/08 02:39:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -19,7 +19,7 @@ * this is a 1-based index into the linp (ItemIdData) array in the * header of each disk page. */ -typedef uint16 OffsetNumber; +typedef uint16 OffsetNumber; #define InvalidOffsetNumber ((OffsetNumber) 0) #define FirstOffsetNumber ((OffsetNumber) 1) diff --git a/src/include/storage/pagenum.h b/src/include/storage/pagenum.h index edd0dc116b..95e2b4beb4 100644 --- a/src/include/storage/pagenum.h +++ b/src/include/storage/pagenum.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pagenum.h,v 1.4 1997/09/07 05:01:32 momjian Exp $ + * $Id: pagenum.h,v 1.5 1997/09/08 02:39:06 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -14,9 +14,9 @@ #define PAGENUM_H -typedef uint16 PageNumber; +typedef uint16 PageNumber; -typedef uint32 LogicalPageNumber; +typedef uint32 LogicalPageNumber; #define InvalidLogicalPageNumber 0 diff --git a/src/include/storage/pos.h b/src/include/storage/pos.h index c5611ba0c1..46965b9fbd 100644 --- a/src/include/storage/pos.h +++ b/src/include/storage/pos.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pos.h,v 1.3 1997/09/07 05:01:33 momjian Exp $ + * $Id: pos.h,v 1.4 1997/09/08 02:39:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,7 +23,7 @@ * pointer array contained on every page that store (heap or index) * tuples. */ -typedef bits16 PositionIdData; +typedef bits16 PositionIdData; typedef PositionIdData *PositionId; /* ---------------- diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index 9282973271..d8ea70918a 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: proc.h,v 1.6 1997/09/07 05:01:34 momjian Exp $ + * $Id: proc.h,v 1.7 1997/09/08 02:39:07 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,11 +17,11 @@ typedef struct { - int sleeplock; - int semNum; - IpcSemaphoreId semId; + int sleeplock; + int semNum; + IpcSemaphoreId semId; IpcSemaphoreKey semKey; -} SEMA; +} SEMA; /* * Each backend has: @@ -31,30 +31,30 @@ typedef struct proc /* proc->links MUST BE THE FIRST ELEMENT OF STRUCT (see ProcWakeup()) */ - SHM_QUEUE links; /* proc can be waiting for one event(lock) */ - SEMA sem; /* ONE semaphore to sleep on */ - int errType; /* error code tells why we woke up */ + SHM_QUEUE links; /* proc can be waiting for one event(lock) */ + SEMA sem; /* ONE semaphore to sleep on */ + int errType; /* error code tells why we woke up */ - int procId; /* unique number for this structure NOT + int procId; /* unique number for this structure NOT * unique per backend, these things are * reused after the backend dies. */ - int critSects; /* If critSects > 0, we are in sensitive + int critSects; /* If critSects > 0, we are in sensitive * routines that cannot be recovered when * the process fails. */ - int prio; /* priority for sleep queue */ + int prio; /* priority for sleep queue */ - TransactionId xid; /* transaction currently being executed by + TransactionId xid; /* transaction currently being executed by * this proc */ - LOCK *waitLock; /* Lock we're sleeping on */ - int token; /* info for proc wakeup routines */ - int pid; /* This procs process id */ - short sLocks[MAX_SPINS]; /* Spin lock stats */ - SHM_QUEUE lockQueue; /* locks associated with current + LOCK *waitLock; /* Lock we're sleeping on */ + int token; /* info for proc wakeup routines */ + int pid; /* This procs process id */ + short sLocks[MAX_SPINS]; /* Spin lock stats */ + SHM_QUEUE lockQueue; /* locks associated with current * transaction */ -} PROC; +} PROC; /* @@ -68,13 +68,13 @@ typedef struct proc typedef struct procglobal { - SHMEM_OFFSET freeProcs; - int numProcs; - IPCKey currKey; - int32 freeSemMap[MAX_PROC_SEMS / PROC_NSEMS_PER_SET]; -} PROC_HDR; + SHMEM_OFFSET freeProcs; + int numProcs; + IPCKey currKey; + int32 freeSemMap[MAX_PROC_SEMS / PROC_NSEMS_PER_SET]; +} PROC_HDR; -extern PROC *MyProc; +extern PROC *MyProc; #define PROC_INCR_SLOCK(lock) if (MyProc) (MyProc->sLocks[(lock)])++ #define PROC_DECR_SLOCK(lock) if (MyProc) (MyProc->sLocks[(lock)])-- @@ -94,20 +94,20 @@ extern SPINLOCK ProcStructLock; /* * Function Prototypes */ -extern void InitProcess(IPCKey key); -extern void ProcReleaseLocks(void); -extern bool ProcRemove(int pid); +extern void InitProcess(IPCKey key); +extern void ProcReleaseLocks(void); +extern bool ProcRemove(int pid); /* extern bool ProcKill(int exitStatus, int pid); */ /* make static in storage/lmgr/proc.c -- jolly */ -extern void ProcQueueInit(PROC_QUEUE * queue); +extern void ProcQueueInit(PROC_QUEUE * queue); extern int ProcSleep(PROC_QUEUE * queue, SPINLOCK spinlock, int token, int prio, LOCK * lock); -extern int ProcLockWakeup(PROC_QUEUE * queue, char *ltable, char *lock); -extern void ProcAddLock(SHM_QUEUE * elem); -extern void ProcReleaseSpins(PROC * proc); -extern void ProcFreeAllSemaphores(void); +extern int ProcLockWakeup(PROC_QUEUE * queue, char *ltable, char *lock); +extern void ProcAddLock(SHM_QUEUE * elem); +extern void ProcReleaseSpins(PROC * proc); +extern void ProcFreeAllSemaphores(void); #endif /* PROC_H */ diff --git a/src/include/storage/shmem.h b/src/include/storage/shmem.h index 5812a71871..997c8c1c5e 100644 --- a/src/include/storage/shmem.h +++ b/src/include/storage/shmem.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: shmem.h,v 1.6 1997/09/07 05:01:35 momjian Exp $ + * $Id: shmem.h,v 1.7 1997/09/08 02:39:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -54,28 +54,28 @@ extern SPINLOCK BindingLock; /* shmemqueue.c */ typedef struct SHM_QUEUE { - SHMEM_OFFSET prev; - SHMEM_OFFSET next; -} SHM_QUEUE; + SHMEM_OFFSET prev; + SHMEM_OFFSET next; +} SHM_QUEUE; /* shmem.c */ -extern void ShmemBindingTabReset(void); -extern void ShmemCreate(unsigned int key, unsigned int size); -extern int InitShmem(unsigned int key, unsigned int size); -extern long *ShmemAlloc(unsigned long size); -extern int ShmemIsValid(unsigned long addr); -extern HTAB * +extern void ShmemBindingTabReset(void); +extern void ShmemCreate(unsigned int key, unsigned int size); +extern int InitShmem(unsigned int key, unsigned int size); +extern long *ShmemAlloc(unsigned long size); +extern int ShmemIsValid(unsigned long addr); +extern HTAB * ShmemInitHash(char *name, long init_size, long max_size, HASHCTL * infoP, int hash_flags); -extern bool ShmemPIDLookup(int pid, SHMEM_OFFSET * locationPtr); +extern bool ShmemPIDLookup(int pid, SHMEM_OFFSET * locationPtr); extern SHMEM_OFFSET ShmemPIDDestroy(int pid); -extern long * +extern long * ShmemInitStruct(char *name, unsigned long size, bool * foundPtr); -extern bool TransactionIdIsInProgress(TransactionId xid); +extern bool TransactionIdIsInProgress(TransactionId xid); -typedef int TableID; +typedef int TableID; /* size constants for the binding table */ /* max size of data structure string name */ @@ -88,21 +88,21 @@ typedef int TableID; /* this is a hash bucket in the binding table */ typedef struct { - char key[BTABLE_KEYSIZE]; /* string name */ - unsigned long location; /* location in shared mem */ - unsigned long size; /* numbytes allocated for the structure */ -} BindingEnt; + char key[BTABLE_KEYSIZE]; /* string name */ + unsigned long location; /* location in shared mem */ + unsigned long size; /* numbytes allocated for the structure */ +} BindingEnt; /* * prototypes for functions in shmqueue.c */ -extern void SHMQueueInit(SHM_QUEUE * queue); -extern void SHMQueueElemInit(SHM_QUEUE * queue); -extern void SHMQueueDelete(SHM_QUEUE * queue); -extern void SHMQueueInsertTL(SHM_QUEUE * queue, SHM_QUEUE * elem); +extern void SHMQueueInit(SHM_QUEUE * queue); +extern void SHMQueueElemInit(SHM_QUEUE * queue); +extern void SHMQueueDelete(SHM_QUEUE * queue); +extern void SHMQueueInsertTL(SHM_QUEUE * queue, SHM_QUEUE * elem); extern void SHMQueueFirst(SHM_QUEUE * queue, Pointer * nextPtrPtr, SHM_QUEUE * nextQueue); -extern bool SHMQueueEmpty(SHM_QUEUE * queue); +extern bool SHMQueueEmpty(SHM_QUEUE * queue); #endif /* SHMEM_H */ diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h index fd9025e875..55f6b6bd60 100644 --- a/src/include/storage/sinval.h +++ b/src/include/storage/sinval.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: sinval.h,v 1.5 1997/09/07 05:01:36 momjian Exp $ + * $Id: sinval.h,v 1.6 1997/09/08 02:39:09 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -18,14 +18,14 @@ extern SPINLOCK SInvalLock; -extern void CreateSharedInvalidationState(IPCKey key); -extern void AttachSharedInvalidationState(IPCKey key); -extern void InitSharedInvalidationState(void); +extern void CreateSharedInvalidationState(IPCKey key); +extern void AttachSharedInvalidationState(IPCKey key); +extern void InitSharedInvalidationState(void); extern void RegisterSharedInvalid(int cacheId, Index hashIndex, ItemPointer pointer); -extern void InvalidateSharedInvalid(void (*invalFunction) (), - void (*resetFunction) ()); +extern void InvalidateSharedInvalid(void (*invalFunction) (), + void (*resetFunction) ()); #endif /* SINVAL_H */ diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h index 12efeb2c8b..1862cda616 100644 --- a/src/include/storage/sinvaladt.h +++ b/src/include/storage/sinvaladt.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: sinvaladt.h,v 1.4 1997/09/07 05:01:37 momjian Exp $ + * $Id: sinvaladt.h,v 1.5 1997/09/08 02:39:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -53,37 +53,37 @@ C----------------End shared segment ------- typedef struct ProcState { - int limit; /* the number of read messages */ - bool resetState; /* true, if backend has to reset its state */ - int tag; /* special tag, recieved from the + int limit; /* the number of read messages */ + bool resetState; /* true, if backend has to reset its state */ + int tag; /* special tag, recieved from the * postmaster */ -} ProcState; +} ProcState; typedef struct SISeg { - IpcSemaphoreId criticalSectionSemaphoreId; /* semaphore id */ - IpcSemaphoreId generalSemaphoreId; /* semaphore id */ - Offset startEntrySection; /* (offset a) */ - Offset endEntrySection; /* (offset a + b) */ - Offset startFreeSpace; /* (offset relative to B) */ - Offset startEntryChain; /* (offset relative to B) */ - Offset endEntryChain; /* (offset relative to B) */ - int numEntries; - int maxNumEntries; - ProcState procState[MaxBackendId]; /* reflects the + IpcSemaphoreId criticalSectionSemaphoreId; /* semaphore id */ + IpcSemaphoreId generalSemaphoreId; /* semaphore id */ + Offset startEntrySection; /* (offset a) */ + Offset endEntrySection;/* (offset a + b) */ + Offset startFreeSpace; /* (offset relative to B) */ + Offset startEntryChain;/* (offset relative to B) */ + Offset endEntryChain; /* (offset relative to B) */ + int numEntries; + int maxNumEntries; + ProcState procState[MaxBackendId]; /* reflects the * invalidation state */ /* here starts the entry section, controlled by offsets */ -} SISeg; +} SISeg; #define SizeSISeg sizeof(SISeg) typedef struct SharedInvalidData { - int cacheId; /* XXX */ - Index hashIndex; + int cacheId; /* XXX */ + Index hashIndex; ItemPointerData pointerData; -} SharedInvalidData; +} SharedInvalidData; typedef SharedInvalidData *SharedInvalid; @@ -91,18 +91,18 @@ typedef SharedInvalidData *SharedInvalid; typedef struct SISegEntry { SharedInvalidData entryData;/* the message data */ - bool isfree; /* entry free? */ - Offset next; /* offset to next entry */ -} SISegEntry; + bool isfree; /* entry free? */ + Offset next; /* offset to next entry */ +} SISegEntry; #define SizeOfOneSISegEntry sizeof(SISegEntry) typedef struct SISegOffsets { - Offset startSegment; /* always 0 (for now) */ - Offset offsetToFirstEntry; /* A + a = B */ - Offset offsetToEndOfSegemnt; /* A + a + b */ -} SISegOffsets; + Offset startSegment; /* always 0 (for now) */ + Offset offsetToFirstEntry; /* A + a = B */ + Offset offsetToEndOfSegemnt; /* A + a + b */ +} SISegOffsets; /****************************************************************************/ @@ -114,20 +114,20 @@ typedef struct SISegOffsets #define SI_SharedLock (-1) #define SI_ExclusiveLock (-255) -extern SISeg *shmInvalBuffer; +extern SISeg *shmInvalBuffer; /* * prototypes for functions in sinvaladt.c */ -extern int SIBackendInit(SISeg * segInOutP); -extern int SISegmentInit(bool killExistingSegment, IPCKey key); +extern int SIBackendInit(SISeg * segInOutP); +extern int SISegmentInit(bool killExistingSegment, IPCKey key); -extern bool SISetDataEntry(SISeg * segP, SharedInvalidData * data); -extern void SISetProcStateInvalid(SISeg * segP); -extern bool SIDelDataEntry(SISeg * segP); +extern bool SISetDataEntry(SISeg * segP, SharedInvalidData * data); +extern void SISetProcStateInvalid(SISeg * segP); +extern bool SIDelDataEntry(SISeg * segP); extern void SIReadEntryData(SISeg * segP, int backendId, void (*invalFunction) (), void (*resetFunction) ()); -extern void SIDelExpiredDataEntries(SISeg * segP); +extern void SIDelExpiredDataEntries(SISeg * segP); #endif /* SINVALADT_H */ diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h index 38c2164f89..08ada1ae30 100644 --- a/src/include/storage/smgr.h +++ b/src/include/storage/smgr.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: smgr.h,v 1.8 1997/09/07 05:01:38 momjian Exp $ + * $Id: smgr.h,v 1.9 1997/09/08 02:39:13 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -22,12 +22,12 @@ #define DEFAULT_SMGR 0 -extern int smgrinit(void); -extern int smgrcreate(int16 which, Relation reln); -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 smgrinit(void); +extern int smgrcreate(int16 which, Relation reln); +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); @@ -40,58 +40,58 @@ smgrflush(int16 which, Relation reln, BlockNumber blocknum, extern int smgrblindwrt(int16 which, char *dbname, char *relname, Oid dbid, Oid relid, BlockNumber blkno, char *buffer); -extern int smgrnblocks(int16 which, Relation reln); -extern int smgrtruncate(int16 which, Relation reln, int nblocks); -extern int smgrcommit(void); -extern bool smgriswo(int16 smgrno); +extern int smgrnblocks(int16 which, Relation reln); +extern int smgrtruncate(int16 which, Relation reln, int nblocks); +extern int smgrcommit(void); +extern bool smgriswo(int16 smgrno); /* internals: move me elsewhere -- ay 7/94 */ /* in md.c */ -extern int mdinit(void); -extern int mdcreate(Relation reln); -extern int mdunlink(Relation reln); -extern int mdextend(Relation reln, char *buffer); -extern int mdopen(Relation reln); -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 mdinit(void); +extern int mdcreate(Relation reln); +extern int mdunlink(Relation reln); +extern int mdextend(Relation reln, char *buffer); +extern int mdopen(Relation reln); +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 *dbstr, char *relstr, Oid dbid, Oid relid, BlockNumber blkno, char *buffer); -extern int mdnblocks(Relation reln); -extern int mdtruncate(Relation reln, int nblocks); -extern int mdcommit(void); -extern int mdabort(void); +extern int mdnblocks(Relation reln); +extern int mdtruncate(Relation reln, int nblocks); +extern int mdcommit(void); +extern int mdabort(void); /* mm.c */ extern SPINLOCK MMCacheLock; -extern int mminit(void); -extern int mmshutdown(void); -extern int mmcreate(Relation reln); -extern int mmunlink(Relation reln); -extern int mmextend(Relation reln, char *buffer); -extern int mmopen(Relation reln); -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 mminit(void); +extern int mmshutdown(void); +extern int mmcreate(Relation reln); +extern int mmunlink(Relation reln); +extern int mmextend(Relation reln, char *buffer); +extern int mmopen(Relation reln); +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 *dbstr, char *relstr, Oid dbid, Oid relid, BlockNumber blkno, char *buffer); -extern int mmnblocks(Relation reln); -extern int mmcommit(void); -extern int mmabort(void); -extern int MMShmemSize(void); +extern int mmnblocks(Relation reln); +extern int mmcommit(void); +extern int mmabort(void); +extern int MMShmemSize(void); /* smgrtype.c */ -extern char *smgrout(int2 i); -extern int2 smgrin(char *s); -extern bool smgreq(int2 a, int2 b); -extern bool smgrne(int2 a, int2 b); +extern char *smgrout(int2 i); +extern int2 smgrin(char *s); +extern bool smgreq(int2 a, int2 b); +extern bool smgrne(int2 a, int2 b); #endif /* SMGR_H */ diff --git a/src/include/storage/spin.h b/src/include/storage/spin.h index 0ee24b5ab4..d41768039e 100644 --- a/src/include/storage/spin.h +++ b/src/include/storage/spin.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: spin.h,v 1.4 1997/09/07 05:01:39 momjian Exp $ + * $Id: spin.h,v 1.5 1997/09/08 02:39:14 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,11 +25,11 @@ * */ -typedef int SPINLOCK; +typedef int SPINLOCK; -extern bool CreateSpinlocks(IPCKey key); -extern bool InitSpinLocks(int init, IPCKey key); -extern void SpinAcquire(SPINLOCK lock); -extern void SpinRelease(SPINLOCK lock); +extern bool CreateSpinlocks(IPCKey key); +extern bool InitSpinLocks(int init, IPCKey key); +extern void SpinAcquire(SPINLOCK lock); +extern void SpinRelease(SPINLOCK lock); #endif /* SPIN_H */ |
