Subversion Repositories HelenOS

Rev

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

Rev 3521 Rev 3527
Line 37... Line 37...
37
#ifndef LIBBLOCK_LIBBLOCK_H_
37
#ifndef LIBBLOCK_LIBBLOCK_H_
38
#define LIBBLOCK_LIBBLOCK_H_ 
38
#define LIBBLOCK_LIBBLOCK_H_ 
39
 
39
 
40
#include <stdint.h>
40
#include <stdint.h>
41
#include "../../srv/vfs/vfs.h"
41
#include "../../srv/vfs/vfs.h"
-
 
42
#include <futex.h>
-
 
43
#include <rwlock.h>
-
 
44
#include <libadt/hash_table.h>
-
 
45
#include <libadt/list.h>
42
 
46
 
43
typedef struct block {
47
typedef struct block {
-
 
48
    /** Futex protecting the reference count. */
44
    void *data;
49
    futex_t lock;
-
 
50
    /** Number of references to the block_t structure. */
45
    size_t size;
51
    unsigned refcnt;
-
 
52
    /** If true, the block needs to be written back to the block device. */
46
    bool dirty;
53
    bool dirty;
-
 
54
    /** Readers / Writer lock protecting the contents of the block. */
-
 
55
    rwlock_t contents_lock;
-
 
56
    /** Handle of the device where the block resides. */
-
 
57
    dev_handle_t dev_handle;
-
 
58
    /** Block offset on the block device. Counted in 'size'-byte blocks. */
-
 
59
    off_t boff;
-
 
60
    /** Size of the block. */
-
 
61
    size_t size;
-
 
62
    /** Link for placing the block into the free block list. */
-
 
63
    link_t free_link;
-
 
64
    /** Link for placing the block into the block hash table. */
-
 
65
    link_t hash_link;
-
 
66
    /** Buffer with the block data. */
-
 
67
    void *data;
47
} block_t;
68
} block_t;
48
 
69
 
49
extern int dev_phone;       /* FIXME */
70
extern int dev_phone;       /* FIXME */
50
extern void *dev_buffer;    /* FIXME */
71
extern void *dev_buffer;    /* FIXME */
51
 
72