bt_page.c File Reference

#include <sys/types.h>
#include <stdio.h>
#include "../include/db.h"
#include "btree.h"

Include dependency graph for bt_page.c:

Go to the source code of this file.

Functions

int __bt_free (BTREE *t, PAGE *h)
PAGE__bt_new (BTREE *t, pgno_t *npg)


Function Documentation

int __bt_free ( BTREE t,
PAGE h 
)

Definition at line 60 of file bt_page.c.

References B_METADIRTY, F_SET, MPOOL_DIRTY, mpool_put, _page::nextpg, P_INVALID, _page::pgno, and _page::prevpg.

Referenced by __bt_pdelete(), and __ovfl_delete().

00063 {
00064    /* Insert the page at the head of the free list. */
00065    h->prevpg = P_INVALID;
00066    h->nextpg = t->bt_free;
00067    t->bt_free = h->pgno;
00068    F_SET(t, B_METADIRTY);
00069 
00070    /* Make sure the page gets written back. */
00071    return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
00072 }

PAGE* __bt_new ( BTREE t,
pgno_t npg 
)

Definition at line 86 of file bt_page.c.

References B_METADIRTY, F_SET, h, mpool_get, mpool_new, _page::nextpg, NULL, and P_INVALID.

Referenced by __ovfl_put(), bt_page(), and bt_root().

00089 {
00090    PAGE *h;
00091 
00092    if (t->bt_free != P_INVALID &&
00093        (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
00094       *npg = t->bt_free;
00095       t->bt_free = h->nextpg;
00096       F_SET(t, B_METADIRTY);
00097       return (h);
00098    }
00099    return (mpool_new(t->bt_mp, npg));
00100 }


Generated on Thu Apr 16 06:29:15 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6