#include "fat.h"
#include "../../vfs/vfs.h"
#include <errno.h>
#include <str.h>
#include <adt/hash_table.h>
#include <adt/list.h>
#include <assert.h>
#include <fibril_synch.h>
#include <malloc.h>
Go to the source code of this file.
Data Structures | |
struct | freed_t |
Each instance of this type describes one interval of freed VFS indices. More... | |
struct | unused_t |
Each instance of this type describes state of all VFS indices that are currently unused. More... | |
Defines | |
#define | UIH_BUCKETS (1 << UIH_BUCKETS_LOG) |
#define | UIH_BUCKETS_LOG 12 |
#define | UIH_DH_KEY 0 |
#define | UIH_INDEX_KEY 1 |
#define | UPH_BUCKETS (1 << UPH_BUCKETS_LOG) |
#define | UPH_BUCKETS_LOG 12 |
#define | UPH_DH_KEY 0 |
#define | UPH_PDI_KEY 2 |
#define | UPH_PFC_KEY 1 |
Functions | |
static int | fat_idx_create (fat_idx_t **fidxp, devmap_handle_t devmap_handle) |
void | fat_idx_destroy (fat_idx_t *idx) |
Destroy the index structure. | |
void | fat_idx_fini (void) |
void | fat_idx_fini_by_devmap_handle (devmap_handle_t) |
fat_idx_t * | fat_idx_get_by_index (devmap_handle_t, fs_index_t) |
fat_idx_t * | fat_idx_get_by_pos (devmap_handle_t, fat_cluster_t, unsigned) |
int | fat_idx_get_new (fat_idx_t **, devmap_handle_t) |
void | fat_idx_hashin (fat_idx_t *) |
void | fat_idx_hashout (fat_idx_t *) |
int | fat_idx_init (void) |
int | fat_idx_init_by_devmap_handle (devmap_handle_t) |
static bool | fat_index_alloc (devmap_handle_t devmap_handle, fs_index_t *index) |
Allocate a VFS index which is not currently in use. | |
static void | fat_index_free (devmap_handle_t devmap_handle, fs_index_t index) |
Free a VFS index, which is no longer in use. | |
static | FIBRIL_MUTEX_INITIALIZE (used_lock) |
Mutex protecting the up_hash and ui_hash. | |
static | FIBRIL_MUTEX_INITIALIZE (unused_lock) |
Mutex protecting the list of unused structures. | |
static int | idx_compare (unsigned long key[], hash_count_t keys, link_t *item) |
static hash_index_t | idx_hash (unsigned long key[]) |
static void | idx_remove_callback (link_t *item) |
static | LIST_INITIALIZE (unused_head) |
List of unused structures. | |
static int | pos_compare (unsigned long key[], hash_count_t keys, link_t *item) |
static hash_index_t | pos_hash (unsigned long key[]) |
static void | pos_remove_callback (link_t *item) |
static void | try_coalesce_intervals (link_t *l, link_t *r, link_t *cur) |
If possible, coalesce two intervals of freed indices. | |
static unused_t * | unused_find (devmap_handle_t devmap_handle, bool lock) |
static void | unused_initialize (unused_t *u, devmap_handle_t devmap_handle) |
Variables | |
static hash_table_t | ui_hash |
Global hash table of all used fat_idx_t structures. | |
static hash_table_operations_t | uih_ops |
static hash_table_t | up_hash |
Global hash table of all used fat_idx_t structures. | |
static hash_table_operations_t | uph_ops |
Definition in file fat_idx.c.