1N/A * See the file LICENSE for redistribution information. 1N/A * Copyright (c) 1996, 1997, 1998 1N/A * Sleepycat Software. All rights reserved. 1N/A * Copyright (c) 1990, 1993, 1994, 1995, 1996 1N/A * Keith Bostic. All rights reserved. 1N/A * Copyright (c) 1990, 1993, 1994, 1995 1N/A * The Regents of the University of California. All rights reserved. 1N/A * This code is derived from software contributed to Berkeley by 1N/A * Redistribution and use in source and binary forms, with or without 1N/A * modification, are permitted provided that the following conditions 1N/A * 1. Redistributions of source code must retain the above copyright 1N/A * notice, this list of conditions and the following disclaimer. 1N/A * 2. Redistributions in binary form must reproduce the above copyright 1N/A * notice, this list of conditions and the following disclaimer in the 1N/A * documentation and/or other materials provided with the distribution. 1N/A * 3. All advertising materials mentioning features or use of this software 1N/A * must display the following acknowledgement: 1N/A * This product includes software developed by the University of 1N/A * California, Berkeley and its contributors. 1N/A * 4. Neither the name of the University nor the names of its contributors 1N/A * may be used to endorse or promote products derived from this software 1N/A * without specific prior written permission. 1N/A * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1N/A * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1N/A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1N/A * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 1N/A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1N/A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1N/A * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1N/A * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 1N/A * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 1N/A * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1N/A#
endif /* not lint */ 1N/A * Big key and data entries are stored on linked lists of pages. The initial 1N/A * reference is a structure with the total length of the item and the page 1N/A * number where it begins. Each entry in the linked list contains a pointer 1N/A * to the next page of data, and so on. 1N/A * Get an offpage item. 1N/A * PUBLIC: int __db_goff __P((DB *, DBT *, 1N/A * PUBLIC: u_int32_t, db_pgno_t, void **, u_int32_t *)); 1N/A * Check if the buffer is big enough; if it is not and we are 1N/A * allowed to malloc space, then we'll malloc it. If we are 1N/A * not (DB_DBT_USERMEM), then we'll set the dbt and return 1N/A /* Allocate any necessary memory. */ 1N/A * Step through the linked list of pages, copying the data on each 1N/A * one into the buffer. Never copy more than the total data length. 1N/A /* Check if we need any bytes from this page. */ 1N/A * Put an offpage item. 1N/A * PUBLIC: int __db_poff __P((DBC *, const DBT *, db_pgno_t *, 1N/A * PUBLIC: int (*)(DBC *, u_int32_t, PAGE **))); 1N/A * Allocate pages and copy the key/data item into them. Calculate the 1N/A * number of bytes we get for pages we fill completely with a single 1N/A * Reduce pagespace so we terminate the loop correctly and 1N/A * don't copy too much data. 1N/A * Allocate and initialize a new page and copy all or part of 1N/A * the item onto the page. If sz is less than pagespace, we 1N/A * have a partial record. 1N/A /* Move lsn onto page. */ 1N/A * If this is the first entry, update the user's info. 1N/A * Otherwise, update the entry on the last page filled 1N/A * in and release that page. 1N/A * PUBLIC: int __db_ovref __P((DBC *, db_pgno_t, int32_t)); 1N/A * Delete an offpage chain of overflow pages. 1N/A * PUBLIC: int __db_doff __P((DBC *, db_pgno_t, int (*)(DBC *, PAGE *))); 1N/A * If it's an overflow page and it's referenced by more than 1N/A * one key/data item, decrement the reference count and return. 1N/A * Match on overflow pages. 1N/A * Given a starting page number and a key, return <0, 0, >0 to indicate if the 1N/A * key on the page is less than, equal to or greater than the key specified. 1N/A * We optimize this by doing chunk at a time comparison unless the user has 1N/A * specified a comparison function. In this case, we need to materialize 1N/A * the entire object and call their comparison routine. 1N/A * PUBLIC: int __db_moff __P((DB *, const DBT *, db_pgno_t, u_int32_t, 1N/A * PUBLIC: int (*)(const DBT *, const DBT *), int *)); 1N/A * If there is a user-specified comparison function, build a 1N/A * contiguous copy of the key, and call it. 1N/A /* While there are both keys to compare. */