CUBRID Engine  latest
file_hash.c File Reference
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stddef.h>
#include "utility.h"
#include "error_manager.h"
#include "file_hash.h"
#include "filesys_temp.hpp"
#include "memory_alloc.h"
#include "object_representation.h"
#include "message_catalog.h"
Include dependency graph for file_hash.c:

Go to the source code of this file.

Macros

#define ISPOWER2(x)   (((x) & (x-1)) == 0)
 
#define NPRIMES   100
 

Functions

static int fh_calculate_htsize (int htsize)
 
static FH_PAGE_HDRfh_fetch_page (FH_TABLE *ht, int page)
 
static FH_PAGE_HDRfh_read_page (FH_TABLE *ht, int page)
 
static FH_PAGE_HDRfh_write_page (FH_TABLE *ht, FH_PAGE_HDR *pg_hdr)
 
static void fh_bitset (FH_TABLE *ht, int page)
 
static int fh_bittest (FH_TABLE *ht, int page)
 
FH_TABLEfh_create (const char *name, int est_size, int page_size, int cached_pages, const char *hash_filename, FH_KEY_TYPE key_type, int data_size, HASH_FUNC hfun, CMP_FUNC cmpfun)
 
void fh_destroy (FH_TABLE *ht)
 
int fh_get (FH_TABLE *ht, FH_KEY key, FH_DATA *data)
 
int fh_put (FH_TABLE *ht, FH_KEY key, FH_DATA data)
 
void fh_dump (FH_TABLE *ht)
 

Variables

static OID null_oid
 
static int null_int
 
static int fh_Primes [NPRIMES]
 

Macro Definition Documentation

#define ISPOWER2 (   x)    (((x) & (x-1)) == 0)

Definition at line 48 of file file_hash.c.

Referenced by fh_calculate_htsize().

#define NPRIMES   100

Definition at line 66 of file file_hash.c.

Referenced by fh_calculate_htsize().

Function Documentation

static void fh_bitset ( FH_TABLE ht,
int  page 
)
static

Definition at line 786 of file file_hash.c.

References fh_table::bitmap.

Referenced by fh_write_page().

Here is the caller graph for this function:

static int fh_bittest ( FH_TABLE ht,
int  page 
)
static

Definition at line 804 of file file_hash.c.

References fh_table::bitmap, fh_table::bitmap_size, and NULL.

Referenced by fh_read_page().

Here is the caller graph for this function:

static int fh_calculate_htsize ( int  htsize)
static

Definition at line 101 of file file_hash.c.

References CEIL_PTVDIV, fh_Primes, ISPOWER2, and NPRIMES.

Referenced by fh_create().

Here is the caller graph for this function:

void fh_destroy ( FH_TABLE ht)

Definition at line 310 of file file_hash.c.

References fh_table::bitmap, fh_table::fd, fh_page_hdr::fh_entries, free_and_init, fh_table::hash_filename, fh_page_hdr::next, fh_table::pg_hdr, and fh_table::pg_hdr_alloc.

Referenced by extractobjects_cleanup(), and fh_create().

Here is the caller graph for this function:

static FH_PAGE_HDR * fh_fetch_page ( FH_TABLE ht,
int  page 
)
static
static FH_PAGE_HDR * fh_write_page ( FH_TABLE ht,
FH_PAGE_HDR pg_hdr 
)
static

Variable Documentation

int fh_Primes[NPRIMES]
static
Initial value:
= {
11, 23, 37, 53, 67, 79, 97, 109, 127, 149,
167, 191, 211, 227, 251, 269, 293, 311, 331, 349,
367, 389, 409, 431, 449, 467, 487, 509, 541, 563,
587, 607, 631, 653, 673, 521, 541, 557, 569, 587,
599, 613, 641, 673, 701, 727, 751, 787, 821, 853,
881, 907, 941, 977, 1039, 1087, 1129, 1171, 1212, 1259,
1301, 1361, 1409, 1471, 1523, 1579, 1637, 1693, 1747, 1777,
1823, 1867, 1913, 1973, 2017, 2129, 2237, 2339, 2441, 2543,
2647, 2749, 2851, 2953, 3061, 3163, 3271, 3373, 3491, 3593,
3697, 3803, 3907, 4013, 4177, 4337, 4493, 4649, 4801, 4957
}

Definition at line 68 of file file_hash.c.

Referenced by fh_calculate_htsize().

int null_int
static

Definition at line 51 of file file_hash.c.

Referenced by fh_create(), fh_get(), fh_put(), and fh_read_page().

OID null_oid
static

Definition at line 50 of file file_hash.c.

Referenced by fh_get(), fh_put(), heap_create_internal(), and pt_fold_const_expr().