#include "libblock.h"
#include "../../srv/vfs/vfs.h"
#include <ipc/devmap.h>
#include <ipc/bd.h>
#include <ipc/services.h>
#include <errno.h>
#include <sys/mman.h>
#include <async.h>
#include <as.h>
#include <assert.h>
#include <fibril_synch.h>
#include <adt/list.h>
#include <adt/hash_table.h>
#include <macros.h>
#include <mem.h>
#include <malloc.h>
#include <stdio.h>
#include <sys/typefmt.h>
#include <stacktrace.h>
Go to the source code of this file.
Data Structures | |
struct | cache_t |
struct | devcon_t |
Defines | |
#define | CACHE_BUCKETS (1 << CACHE_BUCKETS_LOG2) |
#define | CACHE_BUCKETS_LOG2 10 |
#define | CACHE_HI_WATERMARK 20 |
#define | CACHE_LO_WATERMARK 10 |
Functions | |
static aoff64_t | ba_ltop (devcon_t *devcon, aoff64_t lba) |
Convert logical block address to physical block address. | |
void * | block_bb_get (devmap_handle_t devmap_handle) |
int | block_bb_read (devmap_handle_t devmap_handle, aoff64_t ba) |
int | block_cache_fini (devmap_handle_t devmap_handle) |
int | block_cache_init (devmap_handle_t devmap_handle, size_t size, unsigned blocks, enum cache_mode mode) |
void | block_fini (devmap_handle_t devmap_handle) |
int | block_get (block_t **block, devmap_handle_t devmap_handle, aoff64_t ba, int flags) |
Instantiate a block in memory and get a reference to it. | |
int | block_get_bsize (devmap_handle_t devmap_handle, size_t *bsize) |
Get device block size. | |
int | block_get_nblocks (devmap_handle_t devmap_handle, aoff64_t *nblocks) |
Get number of blocks on device. | |
int | block_init (devmap_handle_t devmap_handle, size_t comm_size) |
static void | block_initialize (block_t *b) |
int | block_put (block_t *block) |
Release a reference to a block. | |
int | block_read_direct (devmap_handle_t devmap_handle, aoff64_t ba, size_t cnt, void *buf) |
Read blocks directly from device (bypass cache). | |
int | block_seqread (devmap_handle_t devmap_handle, size_t *bufpos, size_t *buflen, aoff64_t *pos, void *dst, size_t size) |
Read sequential data from a block device. | |
int | block_write_direct (devmap_handle_t devmap_handle, aoff64_t ba, size_t cnt, const void *data) |
Write blocks directly to device (bypass cache). | |
static bool | cache_can_grow (cache_t *cache) |
static int | cache_compare (unsigned long *key, hash_count_t keys, link_t *item) |
static hash_index_t | cache_hash (unsigned long *key) |
static void | cache_remove_callback (link_t *item) |
static int | devcon_add (devmap_handle_t devmap_handle, int dev_phone, size_t bsize, void *comm_area, size_t comm_size) |
static void | devcon_remove (devcon_t *devcon) |
static devcon_t * | devcon_search (devmap_handle_t devmap_handle) |
static | FIBRIL_MUTEX_INITIALIZE (dcl_lock) |
Lock protecting the device connection list. | |
static int | get_block_size (int dev_phone, size_t *bsize) |
Get block size used by the device. | |
static int | get_num_blocks (int dev_phone, aoff64_t *nblocks) |
Get total number of blocks on block device. | |
static | LIST_INITIALIZE (dcl_head) |
Device connection list head. | |
static int | read_blocks (devcon_t *devcon, aoff64_t ba, size_t cnt) |
Read blocks from block device. | |
static int | write_blocks (devcon_t *devcon, aoff64_t ba, size_t cnt) |
Write block to block device. | |
Variables | |
static hash_table_operations_t | cache_ops |
Definition in file libblock.c.