Subversion Repositories HelenOS

Rev

Rev 3561 | Rev 3598 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3561 Rev 3588
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
typedef unsigned bn_t;  /**< Block number type. */
-
 
48
 
47
typedef struct block {
49
typedef struct block {
48
    /** Futex protecting the reference count. */
50
    /** Futex protecting the reference count. */
49
    futex_t lock;
51
    futex_t lock;
50
    /** Number of references to the block_t structure. */
52
    /** Number of references to the block_t structure. */
51
    unsigned refcnt;
53
    unsigned refcnt;
Line 54... Line 56...
54
    /** Readers / Writer lock protecting the contents of the block. */
56
    /** Readers / Writer lock protecting the contents of the block. */
55
    rwlock_t contents_lock;
57
    rwlock_t contents_lock;
56
    /** Handle of the device where the block resides. */
58
    /** Handle of the device where the block resides. */
57
    dev_handle_t dev_handle;
59
    dev_handle_t dev_handle;
58
    /** Block offset on the block device. Counted in 'size'-byte blocks. */
60
    /** Block offset on the block device. Counted in 'size'-byte blocks. */
59
    off_t boff;
61
    bn_t boff;
60
    /** Size of the block. */
62
    /** Size of the block. */
61
    size_t size;
63
    size_t size;
62
    /** Link for placing the block into the free block list. */
64
    /** Link for placing the block into the free block list. */
63
    link_t free_link;
65
    link_t free_link;
64
    /** Link for placing the block into the block hash table. */
66
    /** Link for placing the block into the block hash table. */
Line 73... Line 75...
73
extern int block_bb_read(dev_handle_t, off_t, size_t);
75
extern int block_bb_read(dev_handle_t, off_t, size_t);
74
extern void *block_bb_get(dev_handle_t);
76
extern void *block_bb_get(dev_handle_t);
75
 
77
 
76
extern int block_cache_init(dev_handle_t, size_t, unsigned);
78
extern int block_cache_init(dev_handle_t, size_t, unsigned);
77
 
79
 
78
extern block_t *block_get(dev_handle_t, off_t);
80
extern block_t *block_get(dev_handle_t, bn_t);
79
extern void block_put(block_t *);
81
extern void block_put(block_t *);
80
 
82
 
81
extern int block_read(int, off_t *, size_t *, off_t *, void *, size_t, size_t);
83
extern int block_read(int, off_t *, size_t *, off_t *, void *, size_t, size_t);
82
 
84
 
83
#endif
85
#endif