Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
#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 hash_fd | __P ((const DB *)) |
static int hash_get | __P ((const DB *, const DBT *, DBT *, u_int32_t)) |
static int hash_delete | __P ((const DB *, const DBT *, u_int32_t)) |
static int hash_seq | __P ((const DB *, DBT *, DBT *, u_int32_t)) |
static int hash_sync | __P ((const DB *, u_int32_t)) |
static int hash_close | __P ((DB *)) |
static void swap_header_copy | __P ((HASHHDR *, HASHHDR *)) |
static int flush_meta | __P ((HTAB *)) |
static int hash_access | __P ((HTAB *, ACTION, DBT *, DBT *)) |
static HTAB *init_hash | __P ((HTAB *, const char *, const HASHINFO *)) |
static int alloc_segs | __P ((HTAB *, int)) |
static void *hash_realloc | __P ((SEGMENT **, int, int)) |
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 OLDHASHVERSION 1 |
#define RETURN_ERROR | ( | ERR, | |
LOC | |||
) | { save_errno = ERR; goto LOC; } |
Definition at line 886 of file hash.c.
References len().
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, calloc, htab::cbucket, CHARKEY, DB_HASH, dbp, DEF_BUFSIZE, EFTYPE, errno, make_ari_stubs::file, 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(), sip_to_pjsip::info(), init_hash(), __db::internal, malloc(), htab::mapp, htab::new_file, htab::nmaps, htab::nsegs, NULL, OLDHASHVERSION, RETURN_ERROR, htab::save_file, swap_header(), and __db::type.
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 dbp, ERROR, free(), hdestroy(), __db::internal, and retval.
Referenced by __hash_open().
Definition at line 573 of file hash.c.
References dbp, 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 534 of file hash.c.
References dbp, 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 dbp, 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 725 of file hash.c.
References __big_keydata(), __get_buf(), ABNORMAL, htab::cbucket, htab::cndx, htab::cpage, DBT::data, dbp, 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(), dbp, 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, BYTE_ORDER, DEF_BUCKET_SHIFT, DEF_BUCKET_SIZE, DEF_DIRSIZE, DEF_FFACTOR, DEF_SEGSIZE, DEF_SEGSIZE_SHIFT, errno, make_ari_stubs::file, sip_to_pjsip::info(), init_htab(), LITTLE_ENDIAN, MAX_BSIZE, 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().