Rev 3588 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3588 | Rev 3598 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | #include <futex.h> |
42 | #include <futex.h> |
43 | #include <rwlock.h> |
43 | #include <rwlock.h> |
44 | #include <libadt/hash_table.h> |
44 | #include <libadt/hash_table.h> |
45 | #include <libadt/list.h> |
45 | #include <libadt/list.h> |
46 | 46 | ||
- | 47 | /* |
|
- | 48 | * Flags that can be used with block_get(). |
|
- | 49 | */ |
|
- | 50 | ||
- | 51 | /** |
|
- | 52 | * This macro is a symbolic value for situations where no special flags are |
|
- | 53 | * needed. |
|
- | 54 | */ |
|
- | 55 | #define BLOCK_FLAGS_NONE 0 |
|
- | 56 | ||
- | 57 | /** |
|
- | 58 | * When the client of block_get() intends to overwrite the current contents of |
|
- | 59 | * the block, this flag is used to avoid the unnecessary read. |
|
- | 60 | */ |
|
- | 61 | #define BLOCK_FLAGS_NOREAD 1 |
|
- | 62 | ||
47 | typedef unsigned bn_t; /**< Block number type. */ |
63 | typedef unsigned bn_t; /**< Block number type. */ |
48 | 64 | ||
49 | typedef struct block { |
65 | typedef struct block { |
50 | /** Futex protecting the reference count. */ |
66 | /** Futex protecting the reference count. */ |
51 | futex_t lock; |
67 | futex_t lock; |
Line 75... | Line 91... | ||
75 | extern int block_bb_read(dev_handle_t, off_t, size_t); |
91 | extern int block_bb_read(dev_handle_t, off_t, size_t); |
76 | extern void *block_bb_get(dev_handle_t); |
92 | extern void *block_bb_get(dev_handle_t); |
77 | 93 | ||
78 | extern int block_cache_init(dev_handle_t, size_t, unsigned); |
94 | extern int block_cache_init(dev_handle_t, size_t, unsigned); |
79 | 95 | ||
80 | extern block_t *block_get(dev_handle_t, bn_t); |
96 | extern block_t *block_get(dev_handle_t, bn_t, int flags); |
81 | extern void block_put(block_t *); |
97 | extern void block_put(block_t *); |
82 | 98 | ||
83 | extern int block_read(int, off_t *, size_t *, off_t *, void *, size_t, size_t); |
99 | extern int block_read(int, off_t *, size_t *, off_t *, void *, size_t, size_t); |
84 | 100 | ||
85 | #endif |
101 | #endif |