head	1.10;
access;
symbols
	release_4_2:1.10
	aix_ok:1.10
	Version_2_1:1.7
	Version_2:1.6
	C_Demo_1:1.4;
locks; strict;
comment	@ * @;


1.10
date	93.09.27.04.55.21;	author aoki;	state Exp;
branches;
next	1.9;

1.9
date	91.07.22.14.23.57;	author mer;	state Exp;
branches;
next	1.8;

1.8
date	91.05.01.02.50.17;	author cimarron;	state Exp;
branches;
next	1.7;

1.7
date	90.08.17.08.53.10;	author cimarron;	state Exp;
branches;
next	1.6;

1.6
date	89.09.25.11.27.17;	author cimarron;	state Version_2;
branches;
next	1.5;

1.5
date	89.09.21.19.12.09;	author hirohama;	state Exp;
branches;
next	1.4;

1.4
date	89.09.05.17.03.48;	author mao;	state C_Demo_1;
branches;
next	1.3;

1.3
date	89.04.12.19.52.49;	author dillon;	state Exp;
branches;
next	1.2;

1.2
date	89.03.22.17.32.18;	author muir;	state Stab;
branches;
next	1.1;

1.1
date	89.01.17.05.53.47;	author cimarron;	state Exp;
branches;
next	;


desc
@@


1.10
log
@changed Assert(false) -> Assert(0)
(aix compiler doesn't like !enum)
@
text
@/* ----------------------------------------------------------------
 *   FILE
 *	block.h
 *
 *   DESCRIPTION
 *	POSTGRES disk block definitions.
 *
 *   NOTES
 *
 *   IDENTIFICATION
 *	$Header: /data/01/postgres/src/backend/storage/RCS/block.h,v 1.9 1991/07/22 14:23:57 mer Exp $
 * ----------------------------------------------------------------
 */

#ifndef	BlockIncluded		/* Include this file only once */
#define BlockIncluded	1

#define BLOCK_H	"$Header: /data/01/postgres/src/backend/storage/RCS/block.h,v 1.9 1991/07/22 14:23:57 mer Exp $"

#include "tmp/c.h"

/* XXX this should be called BlockIndex -hirohama */

typedef uint32	BlockNumber;	/* page number */
typedef uint16	BlockSize;

#define InvalidBlockNumber	(-1)

typedef struct BlockIdData {
	int16	data[2];
} BlockIdData;

typedef BlockIdData	*BlockId;	/* block identifier */

/* ----------------
 *	support macros
 * ----------------
 */
/*
 * BlockSizeIsValid --
 *	True iff size is valid.
 *	should check that this is a power of 2
 *
 * XXX currently any block size is valid
 */
#define BlockSizeIsValid(blockSize) 1

/*
 * BlockNumberIsValid --
 *	True iff blockNumber is valid.
 */
#define BlockNumberIsValid(blockNumber) \
    ((bool) \
     (((blockNumber) >= 0) && ((int32) (blockNumber) != InvalidBlockNumber)))

/*
 * BlockIdIsValid --
 *	True iff the block identifier is valid.
 */
#define BlockIdIsValid(blockId) \
    ((bool) \
     (PointerIsValid(blockId) && ((blockId)->data[0] >= 0)))

/*
 * BlockIdSet --
 *	Sets a block identifier to the specified value.
 */
#define BlockIdSet(blockId, blockNumber) \
    Assert(PointerIsValid(blockId)); \
    (blockId)->data[0] = (blockNumber) >> 16; \
    (blockId)->data[1] = (blockNumber) & 0xffff

/*
 * BlockIdCopy --
 *	Copy a block identifier.
 */
#define BlockIdCopy(toBlockId, fromBlockId) \
    Assert(PointerIsValid(toBlockId)); \
    Assert(PointerIsValid(fromBlockId)); \
    (toBlockId)->data[0] = (fromBlockId)->data[0]; \
    (toBlockId)->data[1] = (fromBlockId)->data[1]

/*
 * BlockIdEquals --
 *	Check for block number equality.
 */
#define BlockIdEquals(blockId1, blockId2) \
    ((blockId1)->data[0] == (blockId2)->data[0] && \
     (blockId1)->data[1] == (blockId2)->data[1])

/*
 * BlockIdGetBlockNumber --
 *	Retrieve the block number from a block identifier.
 */
#define BlockIdGetBlockNumber(blockId) \
    (AssertMacro(BlockIdIsValid(blockId)) ? \
     (BlockNumber) \
     (((blockId)->data[0] << 16) + ((uint16) (blockId)->data[1])) : \
     (BlockNumber) InvalidBlockNumber)

#endif	/* !defined(BlockIncluded) */
@


1.9
log
@couple of macros for new lock manager use of tids
@
text
@d8 2
d11 1
a11 1
 *	$Header: lib/H/storage/RCS/block.h,v 1.8 91/05/01 02:50:17 cimarron Exp Locker: mer $
d18 1
a18 1
#define BLOCK_H	"$Header: lib/H/storage/RCS/block.h,v 1.8 91/05/01 02:50:17 cimarron Exp Locker: mer $"
d46 1
a46 2
#define BlockSizeIsValid(blockSize) \
    (true)
@


1.8
log
@round II of converting simple functions to macros + code cleaning in general
@
text
@d9 1
a9 1
 *	$Header$
d16 1
a16 1
#define BLOCK_H	"$Header: RCS/block.h,v 1.7 90/08/17 08:53:10 cimarron Exp Locker: cimarron $"
d71 18
@


1.7
log
@added pathnames to #include statements
@
text
@d1 5
a5 2
/*
 * block.h --
d7 4
d16 1
a16 4
/*
 * Identification:
 */
#define BLOCK_H	"$Header: RCS/block.h,v 1.6 89/09/25 11:27:17 cimarron Version_2 Locker: cimarron $"
d21 1
d33 4
d40 3
d44 2
a45 5
extern
bool
BlockSizeIsValid ARGS((
	BlockSize	size
));
d51 3
a53 5
extern
bool
BlockNumberIsValid ARGS((
	BlockNumber	blockNumber
));
d59 3
a61 5
extern
bool
BlockIdIsValid ARGS((
	BlockId		pageId
));
d67 4
a70 6
extern
void
BlockIdSet ARGS((
	BlockId		blockId,
	BlockNumber	blockNumber
));
d76 5
a80 5
extern
BlockNumber
BlockIdGetBlockNumber ARGS((
	PageId		pageId
));
@


1.6
log
@moved dynamic symbol stuff to syms.h
@
text
@d12 1
a12 1
#define BLOCK_H	"$Header: RCS/block.h,v 1.5 89/09/21 19:12:09 hirohama Exp $"
d14 1
a14 3
#ifndef C_H
#include "c.h"
#endif
@


1.5
log
@added ...SYMBOLS declarations
miscellaneous cleanup
@
text
@d12 1
a12 1
#define BLOCK_H	"$Header: RCS/block.h,v 1.4 89/09/05 17:03:48 mao C_Demo_1 Locker: hirohama $"
a79 7

#define BLOCK_SYMBOLS \
	SymbolDecl(BlockSizeIsValid, "_BlockSizeIsValid"), \
	SymbolDecl(BlockNumberIsValid, "_BlockNumberIsValid"), \
	SymbolDecl(BlockIdIsValid, "_BlockIdIsValid"), \
	SymbolDecl(BlockIdSet, "_BlockIdSet"), \
	SymbolDecl(BlockIdGetBlockNumber, "_BlockIdGetBlockNumber")
@


1.4
log
@Working version of C-only demo
@
text
@a3 3
 *
 * Identification:
 *	$Header: /usr6/postgres/mao/postgres/src/lib/H/RCS/block.h,v 1.3 89/04/12 19:52:49 dillon Exp $
d6 1
a6 1
#ifndef	BlockIncluded	/* Include this file only once */
d9 5
d31 10
d42 1
a42 1
 *	True iff the block number is valid.
d80 7
@


1.3
log
@c.h
@
text
@d6 1
a6 1
 *	$Header: /usr6/postgres/dillon/ptree/src/lib/H/RCS/block.h,v 1.2 89/03/22 17:32:18 muir Stab $
@


1.2
log
@copyright removal
@
text
@d6 1
a6 1
 *	$Header: /usr6/postgres/muir/postgres/src/lib/H/RCS/block.h,v 1.1 89/01/17 05:53:47 cimarron Exp $
d12 1
d14 1
@


1.1
log
@Initial revision
@
text
@a0 27

; /*
; * 
; * POSTGRES Data Base Management System
; * 
; * Copyright (c) 1988 Regents of the University of California
; * 
; * Permission to use, copy, modify, and distribute this software and its
; * documentation for educational, research, and non-profit purposes and
; * without fee is hereby granted, provided that the above copyright
; * notice appear in all copies and that both that copyright notice and
; * this permission notice appear in supporting documentation, and that
; * the name of the University of California not be used in advertising
; * or publicity pertaining to distribution of the software without
; * specific, written prior permission.  Permission to incorporate this
; * software into commercial products can be obtained from the Campus
; * Software Office, 295 Evans Hall, University of California, Berkeley,
; * Ca., 94720 provided only that the the requestor give the University
; * of California a free licence to any derived software for educational
; * and research purposes.  The University of California makes no
; * representations about the suitability of this software for any
; * purpose.  It is provided "as is" without express or implied warranty.
; * 
; */



d6 1
a6 1
 *	$Header: block.h,v 1.1 88/11/11 16:36:54 postgres Exp $
@
