head     1.4;
branch   ;
access   ;
symbols  Version_2_1:1.4 C_Demo_1:1.3;
locks    ; strict;
comment  @ * @;


1.4
date     90.09.25.16.45.45;  author kemnitz;  state Exp;
branches ;
next     1.3;

1.3
date     89.09.05.17.24.42;  author mao;  state C_Demo_1;
branches ;
next     1.2;

1.2
date     89.02.02.15.34.59;  author dillon;  state Stab;
branches ;
next     1.1;

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


desc
@@


1.4
log
@Updating from revision 1.3 to revision 1.4
@
text
@/*
 * block.c --
 *	POSTGRES disk block code.
 */

#include "tmp/c.h"

#include "storage/block.h"

RcsId("$Header: RCS/block.c,v 1.4 90/08/14 16:04:45 cimarron Exp $");

bool
BlockSizeIsValid(blockSize)
	BlockSize	blockSize;
{
	/* should check that this is a power of 2 */
	return (true);
}

bool
BlockNumberIsValid(blockNumber)
	BlockNumber	blockNumber;
{
	return ((bool)(blockNumber >= 0 &&
		(int32)blockNumber != InvalidBlockNumber));
}

bool
BlockIdIsValid(blockId)
	BlockId		blockId;
{
	return ((bool)(PointerIsValid(blockId) && blockId->data[0] >= 0));
}

void
BlockIdSet(blockId, blockNumber)
	BlockId		blockId;
	BlockNumber	blockNumber;
{
	Assert(PointerIsValid(blockId));
/*	Assert(BlockNumberIsValid(blockNumber));	should check >= 0 */

	blockId->data[0] = blockNumber >> 16;
	blockId->data[1] = blockNumber & 0xffff;
	/* *((BlockNumber *)blockId->data) = blockNumber; */
}

BlockNumber
BlockIdGetBlockNumber(blockId)
	BlockId	blockId;
{
	Assert(BlockIdIsValid(blockId));

	return ((blockId->data[0] << 16) + (uint16)blockId->data[1]);
	/* return (*((BlockNumber *)blockId->data)); */
}
@


1.3
log
@Working version of C-only demo
@
text
@d6 1
a6 1
#include "c.h"
d8 1
a8 1
#include "block.h"
d10 1
a10 1
RcsId("$Header: /usr6/postgres/mao/postgres/src/storage/page/RCS/block.c,v 1.2 89/02/02 15:34:59 dillon Stab $");
@


1.2
log
@Txfer From old tree
@
text
@d10 1
a10 1
RcsId("$Header: block.c,v 1.4 88/07/23 00:20:14 dillon Locked $");
@


1.1
log
@Initial revision
@
text
@a0 1

a1 26
 * 
 * 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.
 * 
 */



/*
d10 1
a10 1
RcsId("$Header: block.c,v 1.1 88/11/11 16:37:40 postgres Exp $");
@
