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


1.6
date     92.03.05.00.39.41;  author hong;  state Exp;
branches ;
next     1.5;

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

1.4
date     89.09.05.17.03.25;  author mao;  state Version_2;
branches ;
next     1.3;

1.3
date     89.08.25.10.15.29;  author mao;  state Exp;
branches ;
next     1.2;

1.2
date     89.08.10.10.48.09;  author mao;  state Exp;
branches ;
next     1.1;

1.1
date     89.08.10.08.18.17;  author mao;  state Exp;
branches ;
next     ;


desc
@access method utility support for rtrees -- this file can go away
soon.
@


1.6
log
@clean up
@
text
@/*
 *  amutil.h -- utility headers for rtree code
 *
 *	$Header: RCS/amutil.h,v 1.5 90/08/17 08:50:36 cimarron Exp Locker: hong $
 */

/* DISK I/O IS ALL DONE FROM BUFMGR.C */


#include "storage/bufmgr.h"
#include "storage/itemptr.h"

/* utilities for writing and retrieving data from postgres buffers */

/*#define  GET_HEAP_TID(ITUP)		(&(ITUP)->t_tid)*/
/*ItemPointerData   temp2 = {3,56,456}*/
#define  GET_HEAP_TID(ITUP)		(temp2)


	
#define FillTid(itup, tid)	ItemPointerCopy(tid, &(itup)->t_tid)

/*---------------------*/

struct nodetid {
	int	blocknum,
		pageoff;
	};

typedef	struct nodetid	NodeTid;

struct	logical_page_struct{	/* the info. that getting a page returns */
	NodeTid	tid;
	char   *bs;
	int		pinned;
	int		locked;
	char	*pt;	/* pointer to start of page if pinned */
	};

typedef struct logical_page_struct	*LPage;

char	*LPage_Pin_Data();
void 	LPage_UnPin_Data();

#define	PIN_PAGE_DATA(page)		(LPage_Pin_Data(page))
#define	UNPIN_PAGE_DATA(page)		(LPage_UnPin_Data(page))
#define	PAGE_TID(page)		((page)->tid)

typedef	int	freespace; /* the offset to start of freespace in a buffer, */
			        /* stored at the head of the buffer.	*/

/* Definition of the root nodetid of a tree */
static	NodeTid	Root_Tid = {0, sizeof(freespace)};

#define	ROOT_TID	Root_Tid

#define ABOVEROOT	((int)0x00ffffff)


#define ABOVE_ROOT(tid)	(tid.pageoff == ABOVEROOT)

#define	max(a,b)	((a) < (b) ? (b) : (a))
#define	min(a,b)	((b) < (a) ? (b) : (a))

	
LPage GetPage();
LPage GetNewPage();
void FlushBuffers();
void InitBuffers();
@


1.5
log
@added pathnames to #include statements
@
text
@d4 1
a4 1
 *	$Header: RCS/amutil.h,v 1.4 89/09/05 17:03:25 mao Version_2 Locker: cimarron $
a21 31


/*******************************************************************
 *		PAGE MANAGEMENT:
 ******************************************************************/

/*	int				
 *	NUMFILEBLOCKS (rdesc)		-return the # of blocks in a rel. fileo */
#define NUMFILEBLOCKS(rdesc)		(RelationGetNumberOfBlocks (rdesc))

/*	int
 *	GETBUFFER (rdesc, blocknum, locklevel) -return buffer number for
 *						blocknum block of the rel file.
 *	locklevel: L_EX for new page and when you go to modify it.
 *		   L_SH for read only
 *		   L_UP for update    
 */
#define GETBUFFER(rdesc, blocknum, locklevel)\
		  (RelationGetBuffer (rdesc, blocknum, locklevel))

/*	Block *
 *	GETBUFPT (bufnum)	-return pointer to start of buffer #bufnum
 *	int bufnum
 */
#define GETBUFPT(bufnum)	(BufferGetBlock (bufnum))

/*	status (?)
 *	WRITEBUF (bufnum, locklevel)
 * 	
 */
#define	WRITEBUF(bufnum, locklevel)	(BufferPut (bufnum, locklevel))
@


1.4
log
@Working version of C-only demo
@
text
@d4 1
a4 1
 *	$Header: RCS/amutil.h,v 1.3 89/08/25 10:15:29 mao Exp $
d10 2
a11 2
#include "bufmgr.h"
#include "itemptr.h"
@


1.3
log
@add rcs header line
@
text
@d4 1
a4 1
 *	$Header$
@


1.2
log
@no longer collect statistics on rtrees
@
text
@d1 5
@


1.1
log
@Initial revision
@
text
@a95 2

#include "stats.h"
@
