page.h (1573) | page.h (14272) |
---|---|
1/*- | 1/*- |
2 * Copyright (c) 1990, 1993 | 2 * Copyright (c) 1990, 1993, 1994 |
3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Margo Seltzer. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 17 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * | 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Margo Seltzer. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: --- 17 unchanged lines hidden (view full) --- 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * |
36 * @(#)page.h 8.1 (Berkeley) 6/6/93 | 36 * @(#)page.h 8.2 (Berkeley) 5/31/94 |
37 */ 38 39/* 40 * Definitions for hashing page file format. 41 */ 42 43/* 44 * routines dealing with a data page --- 23 unchanged lines hidden (view full) --- 68 * We prohibit entering a pair on a page unless there is also room to append 69 * an overflow page. The reason for this it that you can get in a situation 70 * where a single key/data pair fits on a page, but you can't append an 71 * overflow page and later you'd have to split the key/data and handle like 72 * a big pair. 73 * You might as well do this up front. 74 */ 75 | 37 */ 38 39/* 40 * Definitions for hashing page file format. 41 */ 42 43/* 44 * routines dealing with a data page --- 23 unchanged lines hidden (view full) --- 68 * We prohibit entering a pair on a page unless there is also room to append 69 * an overflow page. The reason for this it that you can get in a situation 70 * where a single key/data pair fits on a page, but you can't append an 71 * overflow page and later you'd have to split the key/data and handle like 72 * a big pair. 73 * You might as well do this up front. 74 */ 75 |
76#define PAIRSIZE(K,D) (2*sizeof(u_short) + (K)->size + (D)->size) 77#define BIGOVERHEAD (4*sizeof(u_short)) 78#define KEYSIZE(K) (4*sizeof(u_short) + (K)->size); 79#define OVFLSIZE (2*sizeof(u_short)) | 76#define PAIRSIZE(K,D) (2*sizeof(u_int16_t) + (K)->size + (D)->size) 77#define BIGOVERHEAD (4*sizeof(u_int16_t)) 78#define KEYSIZE(K) (4*sizeof(u_int16_t) + (K)->size); 79#define OVFLSIZE (2*sizeof(u_int16_t)) |
80#define FREESPACE(P) ((P)[(P)[0]+1]) 81#define OFFSET(P) ((P)[(P)[0]+2]) 82#define PAIRFITS(P,K,D) \ 83 (((P)[2] >= REAL_KEY) && \ 84 (PAIRSIZE((K),(D)) + OVFLSIZE) <= FREESPACE((P))) | 80#define FREESPACE(P) ((P)[(P)[0]+1]) 81#define OFFSET(P) ((P)[(P)[0]+2]) 82#define PAIRFITS(P,K,D) \ 83 (((P)[2] >= REAL_KEY) && \ 84 (PAIRSIZE((K),(D)) + OVFLSIZE) <= FREESPACE((P))) |
85#define PAGE_META(N) (((N)+3) * sizeof(u_short)) | 85#define PAGE_META(N) (((N)+3) * sizeof(u_int16_t)) |
86 87typedef struct { 88 BUFHEAD *newp; 89 BUFHEAD *oldp; 90 BUFHEAD *nextp; | 86 87typedef struct { 88 BUFHEAD *newp; 89 BUFHEAD *oldp; 90 BUFHEAD *nextp; |
91 u_short next_addr; | 91 u_int16_t next_addr; |
92} SPLIT_RETURN; | 92} SPLIT_RETURN; |