44,6 → 44,24 |
#include <libadt/hash_table.h> |
#include <libadt/list.h> |
|
/* |
* Flags that can be used with block_get(). |
*/ |
|
/** |
* This macro is a symbolic value for situations where no special flags are |
* needed. |
*/ |
#define BLOCK_FLAGS_NONE 0 |
|
/** |
* When the client of block_get() intends to overwrite the current contents of |
* the block, this flag is used to avoid the unnecessary read. |
*/ |
#define BLOCK_FLAGS_NOREAD 1 |
|
typedef unsigned bn_t; /**< Block number type. */ |
|
typedef struct block { |
/** Futex protecting the reference count. */ |
futex_t lock; |
56,7 → 74,7 |
/** Handle of the device where the block resides. */ |
dev_handle_t dev_handle; |
/** Block offset on the block device. Counted in 'size'-byte blocks. */ |
off_t boff; |
bn_t boff; |
/** Size of the block. */ |
size_t size; |
/** Link for placing the block into the free block list. */ |
67,14 → 85,18 |
void *data; |
} block_t; |
|
extern int block_init(dev_handle_t, size_t, off_t, size_t); |
extern int block_init(dev_handle_t, size_t); |
extern void block_fini(dev_handle_t); |
|
extern int block_bb_read(dev_handle_t, off_t, size_t); |
extern void *block_bb_get(dev_handle_t); |
|
extern block_t *block_get(dev_handle_t, off_t, size_t); |
extern int block_cache_init(dev_handle_t, size_t, unsigned); |
|
extern block_t *block_get(dev_handle_t, bn_t, int flags); |
extern void block_put(block_t *); |
|
extern bool block_read(int, off_t *, size_t *, off_t *, void *, size_t, size_t); |
extern int block_read(int, off_t *, size_t *, off_t *, void *, size_t, size_t); |
|
#endif |
|