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


1.6
date     91.05.01.02.51.32;  author cimarron;  state Exp;
branches ;
next     1.5;

1.5
date     91.04.28.09.14.41;  author cimarron;  state Exp;
branches ;
next     1.4;

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

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

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

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


desc
@@


1.6
log
@round II of converting simple functions to macros + code cleaning in general
@
text
@/*
 * part.c --
 *	POSTGRES "partition" code.
 */

#include "tmp/c.h"

#include "storage/block.h"
#include "storage/bufpage.h"	/* XXX for PageSize */
#include "storage/off.h"
#include "storage/part.h"

RcsId("$Header: RCS/part.c,v 1.5 91/04/28 09:14:41 cimarron Exp Locker: cimarron $");

/*
 * PagePartitionIsValid is now a macro in part.h -cim 4/27/91
 */

PagePartition
CreatePagePartition(blockSize, pageSize)
	BlockSize	blockSize;
	PageSize	pageSize;
{
	Assert(BlockSizeIsValid(blockSize));
	Assert(PageSizeIsValid(pageSize));

	if (pageSize > blockSize || blockSize % pageSize != 0) {
		return (InvalidPagePartition);
	}
	{
		Count		numberOfPages = blockSize / pageSize;
		PagePartition	partition = 0;

		while (numberOfPages > 1) {
			partition += 1;
			numberOfPages /= 2;
		}
		return (partition);
	}
}

Count
PagePartitionGetPagesPerBlock(partition)
	PagePartition	partition;
{
	Count	numberOfPages = 1;

	while (partition > 0) {
		numberOfPages *= 2;
		partition -= 1;
	}
	return (numberOfPages);
}
@


1.5
log
@Converted IsValid code into macros and added an improved NodeIsType scheme
@
text
@d13 1
a13 3
#include "internal.h"

RcsId("$Header: RCS/part.c,v 1.4 90/09/25 16:46:45 kemnitz Exp Locker: cimarron $");
@


1.4
log
@Updating from revision 1.3 to revision 1.4
@
text
@d15 1
a15 1
RcsId("$Header: RCS/part.c,v 1.4 90/08/14 16:05:12 cimarron Exp $");
d17 3
a19 6
bool
PagePartitionIsValid(partition)
	PagePartition	partition;
{
	return ((bool)(partition != InvalidPagePartition));
}
@


1.3
log
@Working version of C-only demo
@
text
@d6 1
a6 1
#include "c.h"
d8 4
a11 3
#include "block.h"
#include "bufpage.h"	/* XXX for PageSize */
#include "off.h"
a12 1
#include "part.h"
d15 1
a15 1
RcsId("$Header: /usr6/postgres/mao/postgres/src/storage/page/RCS/part.c,v 1.2 89/02/02 15:35:20 dillon Stab $");
@


1.2
log
@Txfer From old tree
@
text
@d15 1
a15 1
RcsId("$Header: part.c,v 1.4 88/01/22 13:50:44 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.
 * 
 */



/*
d15 1
a15 1
RcsId("$Header: part.c,v 1.1 88/11/11 16:37:43 postgres Exp $");
@
