Pyrogenesis
trunk
|
#include "precompiled.h"
#include "h_mgr.h"
#include <boost/unordered_map.hpp>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <new>
#include "lib/fnv_hash.h"
#include "lib/allocators/overrun_protector.h"
#include "lib/allocators/pool.h"
#include "lib/module_init.h"
#include "lib/posix/posix_pthread.h"
Classes | |
struct | HDATA |
struct | H_ScopedLock |
Namespaces | |
ERR | |
Introduction | |
Macros | |
#define | IDX_BITS 16 |
#define | TAG_BITS 48 |
Typedefs | |
typedef i64 | Tag |
typedef boost::unordered_multimap< uintptr_t, ssize_t > | Key2Idx |
typedef Key2Idx::iterator | It |
Enumerations | |
enum | KeyRemoveFlag { KEY_NOREMOVE, KEY_REMOVE } |
Functions | |
STATUS_ADD_DEFINITIONS (hStatusDefinitions) | |
cassert (IDX_BITS+TAG_BITS<=sizeof(Handle)*CHAR_BIT) | |
static size_t | h_idx (const Handle h) |
static Tag | h_tag (Handle h) |
static Handle | handle (size_t idx, u64 tag) |
static Status | h_data_from_idx (ssize_t idx, HDATA *&hd) |
static ssize_t | h_idx_from_data (HDATA *hd) |
static Status | h_data_no_tag (const Handle h, HDATA *&hd) |
static Status | h_data_tag (Handle h, HDATA *&hd) |
static Status | h_data_tag_type (const Handle h, const H_Type type, HDATA *&hd) |
static Handle | key_find (uintptr_t key, H_Type type, KeyRemoveFlag remove_option=KEY_NOREMOVE) |
static void | key_add (uintptr_t key, Handle h) |
static void | key_remove (uintptr_t key, H_Type type) |
static void | warn_if_invalid (HDATA *hd) |
static Status | type_validate (H_Type type) |
static Tag | gen_tag () |
static Handle | reuse_existing_handle (uintptr_t key, H_Type type, size_t flags) |
static Status | call_init_and_reload (Handle h, H_Type type, HDATA *hd, const PIVFS &vfs, const VfsPath &pathname, va_list *init_args) |
static Handle | alloc_new_handle (H_Type type, const PIVFS &vfs, const VfsPath &pathname, uintptr_t key, size_t flags, va_list *init_args) |
Handle | h_alloc (H_Type type, const PIVFS &vfs, const VfsPath &pathname, size_t flags,...) |
static void | h_free_hd (HDATA *hd) |
Status | h_free (Handle &h, H_Type type) |
void * | h_user_data (const Handle h, const H_Type type) |
VfsPath | h_filename (const Handle h) |
Status | h_reload (const PIVFS &vfs, const VfsPath &pathname) |
Handle | h_find (H_Type type, uintptr_t key) |
Status | h_force_free (Handle h, H_Type type) |
void | h_add_ref (Handle h) |
intptr_t | h_get_refcnt (Handle h) |
static Status | Init () |
static void | Shutdown () |
void | h_mgr_free_type (const H_Type type) |
void | h_mgr_init () |
void | h_mgr_shutdown () |
Variables | |
static const Status | ERR::H_IDX_INVALID = -120000 |
static const Status | ERR::H_IDX_UNUSED = -120001 |
static const Status | ERR::H_TAG_MISMATCH = -120003 |
static const Status | ERR::H_TYPE_MISMATCH = -120004 |
static const Status | ERR::H_ALREADY_FREED = -120005 |
static const StatusDefinition | hStatusDefinitions [] |
static const u64 | IDX_MASK = (1l << IDX_BITS) - 1 |
static const u64 | TAG_MASK = 0xFFFFFFFF |
static const size_t | HDATA_USER_SIZE = 104 |
static const ssize_t | hdata_cap = (1ul << IDX_BITS)/4 |
static Pool | hpool |
static bool | ignoreDoubleFree = false |
static OverrunProtector< Key2Idx > | key2idx_wrapper |
static pthread_mutex_t | h_mutex |
static ModuleInitState | initState |
#define IDX_BITS 16 |
#define TAG_BITS 48 |
typedef Key2Idx::iterator It |
enum KeyRemoveFlag |
|
static |
|
static |
|
static |
void h_add_ref | ( | Handle | h | ) |
|
static |
intptr_t h_get_refcnt | ( | Handle | h | ) |
|
inlinestatic |
void h_mgr_free_type | ( | const H_Type | type | ) |
void h_mgr_init | ( | ) |
void h_mgr_shutdown | ( | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
STATUS_ADD_DEFINITIONS | ( | hStatusDefinitions | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |