Asterisk - The Open Source Telephony Project
18.5.0
|
#include <sys/param.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../include/db.h"
#include "hash.h"
#include "page.h"
#include "extern.h"
Go to the source code of this file.
Macros | |
#define | ABNORMAL (1) |
#define | ERROR (-1) |
#define | MOD(x, y) ((x) & ((y) - 1)) |
#define | OLDHASHVERSION 1 |
#define | RETURN_ERROR(ERR, LOC) { save_errno = ERR; goto LOC; } |
#define | SUCCESS (0) |
Functions | |
u_int32_t | __call_hash (HTAB *hashp, char *k, int len) |
int | __expand_table (HTAB *hashp) |
DB * | __hash_open (char *file, int flags, int mode, const HASHINFO *info, int dflags) const |
static int alloc_segs | __P ((HTAB *, int)) |
static int flush_meta | __P ((HTAB *)) |
static int hash_access | __P ((HTAB *, ACTION, DBT *, DBT *)) |
static int hash_close | __P ((DB *)) |
static int hash_delete | __P ((const DB *, const DBT *, u_int32_t)) |
static int hash_fd | __P ((const DB *)) |
static int hash_get | __P ((const DB *, const DBT *, DBT *, u_int32_t)) |
static void *hash_realloc | __P ((SEGMENT **, int, int)) |
static int hash_seq | __P ((const DB *, DBT *, DBT *, u_int32_t)) |
static int hash_sync | __P ((const DB *, u_int32_t)) |
static HTAB *init_hash | __P ((HTAB *, const char *, const HASHINFO *)) |
static void swap_header_copy | __P ((HASHHDR *, HASHHDR *)) |
static int | alloc_segs (HTAB *hashp, int nsegs) |
static int | flush_meta (HTAB *hashp) |
static int | hash_access (HTAB *hashp, ACTION action, DBT *key, DBT *val) |
static int | hash_close (DB *dbp) |
static int | hash_delete (DB *dbp, const DBT *key, u_int32_t flag) const |
static int | hash_fd (DB *dbp) const |
static int | hash_get (DB *dbp, const DBT *key, DBT *data, u_int32_t flag) const |
static int | hash_put (DB *dbp, DBT *key, const DBT *data, u_int32_t flag) const |
static void * | hash_realloc (SEGMENT **p_ptr, int oldsize, int newsize) |
static int | hash_seq (DB *dbp, DBT *key, DBT *data, u_int32_t flag) const |
static int | hash_sync (DB *dbp, u_int32_t flags) const |
static int | hdestroy (HTAB *hashp) |
static HTAB * | init_hash (HTAB *hashp, const char *file, const HASHINFO *info) |
static int | init_htab (HTAB *hashp, int nelem) |
static void | swap_header (HTAB *hashp) |
static void | swap_header_copy (HASHHDR *srcp, HASHHDR *destp) |
#define ABNORMAL (1) |
Definition at line 86 of file hash.c.
Referenced by hash_access(), and hash_seq().
#define ERROR (-1) |
Definition at line 85 of file hash.c.
Referenced by hash_access(), hash_close(), hash_delete(), hash_fd(), hash_get(), hash_put(), hash_seq(), hash_sync(), hdestroy(), and vm_allocate_dh().
#define OLDHASHVERSION 1 |
Referenced by __hash_open().
#define RETURN_ERROR | ( | ERR, | |
LOC | |||
) | { save_errno = ERR; goto LOC; } |
Definition at line 81 of file hash.c.
Referenced by __hash_open().
#define SUCCESS (0) |
Definition at line 84 of file hash.c.
Referenced by hash_access(), hash_seq(), and hdestroy().
Definition at line 886 of file hash.c.
Referenced by __big_split(), __split_page(), hash_access(), and ugly_split().
int __expand_table | ( | HTAB * | hashp | ) |
Definition at line 815 of file hash.c.
References __hash_log2(), __split_page(), calloc, htab::dir, htab::exsegs, hash_realloc(), htab::nsegs, and NULL.
Referenced by __addel().
Definition at line 96 of file hash.c.
References __buf_init(), alloc_segs(), BYTE_SHIFT, HASHINFO::cachesize, calloc, htab::cbucket, CHARKEY, DB_HASH, dbp, DEF_BUFSIZE, EFTYPE, errno, htab::flags, htab::fp, free(), hash_close(), hash_delete(), hash_fd(), hash_get(), hash_put(), hash_seq(), hash_sync(), HASHMAGIC, HASHVERSION, hdestroy(), htab::hdr, if(), init_hash(), malloc(), htab::mapp, htab::new_file, htab::nmaps, htab::nsegs, NULL, OLDHASHVERSION, RETURN_ERROR, htab::save_file, and swap_header().
Referenced by dbm_open(), dbopen(), and hcreate().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Definition at line 906 of file hash.c.
References calloc, htab::dir, errno, hdestroy(), htab::nsegs, and NULL.
Referenced by __hash_open(), and init_htab().
|
static |
Definition at line 486 of file hash.c.
References __put_page(), CHARKEY, EFTYPE, errno, htab::errnum, htab::fp, HASHMAGIC, HASHVERSION, htab::hdr, htab::mapp, NCACHED, htab::save_file, and swap_header_copy().
Referenced by hash_sync(), and hdestroy().
Definition at line 596 of file hash.c.
References __addel(), __big_return(), __call_hash(), __delpair(), __find_bigpair(), __find_last_page(), __get_buf(), ABNORMAL, BUF_PIN, DBT::data, ERROR, _bufhead::flags, HASH_DELETE, HASH_GET, HASH_PUT, HASH_PUTNEW, if(), NULL, OVFLPAGE, _bufhead::page, REAL_KEY, DBT::size, and SUCCESS.
Referenced by hash_delete(), hash_get(), and hash_put().
|
static |
Definition at line 246 of file hash.c.
References ERROR, free(), hdestroy(), __db::internal, and retval.
Referenced by __hash_open().
Definition at line 573 of file hash.c.
References errno, htab::errnum, ERROR, htab::flags, hash_access(), HASH_DELETE, if(), __db::internal, NULL, and R_CURSOR.
Referenced by __hash_open().
|
static |
Definition at line 262 of file hash.c.
References errno, ERROR, htab::fp, if(), and __db::internal.
Referenced by __hash_open().
Definition at line 534 of file hash.c.
References errno, htab::errnum, ERROR, hash_access(), HASH_GET, if(), and __db::internal.
Referenced by __hash_open().
Definition at line 551 of file hash.c.
References errno, htab::errnum, ERROR, htab::flags, hash_access(), HASH_PUT, HASH_PUTNEW, if(), __db::internal, and R_NOOVERWRITE.
Referenced by __hash_open().
|
static |
Definition at line 870 of file hash.c.
References free(), and malloc().
Referenced by __expand_table().
Definition at line 725 of file hash.c.
References __big_keydata(), __get_buf(), ABNORMAL, htab::cbucket, htab::cndx, htab::cpage, DBT::data, DEBUG, errno, htab::errnum, ERROR, if(), __db::internal, NULL, OVFLPAGE, _bufhead::page, R_FIRST, R_NEXT, REAL_KEY, DBT::size, and SUCCESS.
Referenced by __hash_open().
Definition at line 457 of file hash.c.
References __buf_free(), errno, ERROR, flush_meta(), if(), __db::internal, htab::new_file, and htab::save_file.
Referenced by __hash_open().
|
static |
Definition at line 397 of file hash.c.
References __buf_free(), htab::dir, errno, ERROR, htab::exsegs, flush_meta(), htab::fp, free(), htab::mapp, NCACHED, htab::nmaps, htab::nsegs, htab::save_file, and SUCCESS.
Referenced by __hash_open(), alloc_segs(), and hash_close().
Definition at line 280 of file hash.c.
References __hash_log2(), BIG_ENDIAN, HASHINFO::bsize, BYTE_ORDER, DEF_BUCKET_SHIFT, DEF_BUCKET_SIZE, DEF_DIRSIZE, DEF_FFACTOR, DEF_SEGSIZE, DEF_SEGSIZE_SHIFT, errno, HASHINFO::ffactor, init_htab(), LITTLE_ENDIAN, HASHINFO::lorder, MAX_BSIZE, HASHINFO::nelem, and NULL.
Referenced by __hash_open().
|
static |
Definition at line 351 of file hash.c.
References __hash_log2(), __ibitmap(), alloc_segs(), MAX, MINHDRSIZE, and OADDR_OF.
Referenced by init_hash().
|
static |
Definition at line 969 of file hash.c.
References hashhdr::bitmaps, hashhdr::bshift, hashhdr::bsize, hashhdr::dsize, hashhdr::ffactor, hashhdr::h_charkey, htab::hdr, hashhdr::hdrpages, hashhdr::high_mask, hashhdr::last_freed, hashhdr::lorder, hashhdr::low_mask, hashhdr::magic, hashhdr::max_bucket, NCACHED, hashhdr::nkeys, hashhdr::ovfl_point, hashhdr::spares, hashhdr::sshift, hashhdr::ssize, and hashhdr::version.
Referenced by __hash_open().
Definition at line 940 of file hash.c.
References hashhdr::bitmaps, hashhdr::bshift, hashhdr::bsize, hashhdr::dsize, hashhdr::ffactor, hashhdr::h_charkey, hashhdr::hdrpages, hashhdr::high_mask, hashhdr::last_freed, hashhdr::lorder, hashhdr::low_mask, hashhdr::magic, hashhdr::max_bucket, NCACHED, hashhdr::nkeys, hashhdr::ovfl_point, hashhdr::spares, hashhdr::sshift, hashhdr::ssize, and hashhdr::version.
Referenced by flush_meta().