/*
* Copyright (c) 1997-2000 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _KRB5_DB2_PAGE_H
#define _KRB5_DB2_PAGE_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*-
* Copyright (c) 1990, 1993, 1994
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Margo Seltzer.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)page.h 8.4 (Berkeley) 11/7/95
*/
/* Constants for big key page overhead information. */
#define NUMSHORTS 0
/*
* Hash pages store meta-data beginning at the top of the page (offset 0)
* Fields are always accessed via macros so that we can change the page
* format without too much pain. The only changes that will require massive
* other (since we use that fact to compute key lengths). In the accessor
* macros below, P means a pointer to the page, I means an index of the
* particular entry being accessed.
*
* Hash base page format
* BYTE ITEM NBYTES TYPE ACCESSOR MACRO
* ---- ------------------ ------ -------- --------------
* 0 previous page number 4 db_pgno_t PREV_PGNO(P)
* 4 next page number 4 db_pgno_t NEXT_PGNO(P)
* 8 # pairs on page 2 indx_t NUM_ENT(P)
* 10 page type 1 u_int8_t TYPE(P)
* 11 padding 1 u_int8_t none
* 12 highest free byte 2 indx_t OFFSET(P)
* 14 key offset 0 2 indx_t KEY_OFF(P, I)
* 16 data offset 0 2 indx_t DATA_OFF(P, I)
* 18 key offset 1 2 indx_t KEY_OFF(P, I)
* 20 data offset 1 2 indx_t DATA_OFF(P, I)
* ...etc...
*/
/* Indices (in bytes) of the beginning of each of these entries */
#define I_PREV_PGNO 0
/* To allocate a pair, we need room for one key offset and one data offset. */
/* Use this macro to extract a value of type T from page P at offset O. */
/*
* Use these macros to access fields on a page; P is a PAGE16 *.
*/
/*
* We need to store a page's own address on each page (unlike the Btree
* access method which needs the previous page). We use the PREV_PGNO
* field to store our own page number.
*/
#define DATA_OFF(P, N) \
#define KEY_OFF(P, N) \
/*
* Macros used to compute various sizes on a page.
*/
/*
* of offsets.
*/
#define BIGDATA(P) \
#define OVFLPAGE 0
#define BIGPAIR 0
typedef unsigned short PAGE16;
typedef unsigned char PAGE8;
#define A_BUCKET 0
/*
* Since these are all unsigned, we need to guarantee that we never go
* negative. Offset values are 0-based and overheads are one based (i.e.
* one byte of overhead is 1, not 0), so we need to convert OFFSETs to
* 1-based counting before subtraction.
*/
#define FREESPACE(P) \
/*
* Overhead on header pages is just one word -- the length of the
* header info stored on that page.
*/
#ifdef __cplusplus
}
#endif
#endif /* !_KRB5_DB2_PAGE_H */