root / lab4 / .minix-src / include / minix / libminixfs.h @ 13
History | View | Annotate | Download (2.44 KB)
1 |
/* Prototypes for -lminixfs. */
|
---|---|
2 |
|
3 |
#ifndef _MINIX_FSLIB_H
|
4 |
#define _MINIX_FSLIB_H
|
5 |
|
6 |
#include <minix/fsdriver.h> |
7 |
|
8 |
/* Maximum number of blocks that will be considered by lmfs_prefetch() */
|
9 |
#define LMFS_MAX_PREFETCH NR_IOREQS
|
10 |
|
11 |
struct buf {
|
12 |
/* Data portion of the buffer. */
|
13 |
void *data;
|
14 |
|
15 |
/* Header portion of the buffer - internal to libminixfs. */
|
16 |
struct buf *lmfs_next; /* used to link all free bufs in a chain */ |
17 |
struct buf *lmfs_prev; /* used to link all free bufs the other way */ |
18 |
struct buf *lmfs_hash; /* used to link bufs on hash chains */ |
19 |
dev_t lmfs_dev; /* major | minor device where block resides */
|
20 |
block64_t lmfs_blocknr; /* block number of its (minor) device */
|
21 |
char lmfs_count; /* number of users of this buffer */ |
22 |
char lmfs_needsetcache; /* to be identified to VM */ |
23 |
size_t lmfs_bytes; /* size of this block (allocated and used) */
|
24 |
u32_t lmfs_flags; /* Flags shared between VM and FS */
|
25 |
|
26 |
/* If any, which inode & offset does this block correspond to?
|
27 |
* If none, VMC_NO_INODE
|
28 |
*/
|
29 |
ino_t lmfs_inode; |
30 |
u64_t lmfs_inode_offset; |
31 |
}; |
32 |
|
33 |
void lmfs_markdirty(struct buf *bp); |
34 |
void lmfs_markclean(struct buf *bp); |
35 |
int lmfs_isclean(struct buf *bp); |
36 |
void lmfs_flushall(void); |
37 |
void lmfs_flushdev(dev_t dev);
|
38 |
size_t lmfs_fs_block_size(void);
|
39 |
void lmfs_may_use_vmcache(int); |
40 |
void lmfs_set_blocksize(size_t blocksize);
|
41 |
void lmfs_buf_pool(int new_nr_bufs); |
42 |
int lmfs_get_block(struct buf **bpp, dev_t dev, block64_t block, int how); |
43 |
int lmfs_get_block_ino(struct buf **bpp, dev_t dev, block64_t block, int how, |
44 |
ino_t ino, u64_t off); |
45 |
void lmfs_put_block(struct buf *bp); |
46 |
void lmfs_free_block(dev_t dev, block64_t block);
|
47 |
void lmfs_zero_block_ino(dev_t dev, ino_t ino, u64_t off);
|
48 |
void lmfs_invalidate(dev_t device);
|
49 |
void lmfs_prefetch(dev_t dev, const block64_t *blockset, unsigned int nblocks); |
50 |
void lmfs_setquiet(int q); |
51 |
void lmfs_set_blockusage(fsblkcnt_t btotal, fsblkcnt_t bused);
|
52 |
void lmfs_change_blockusage(int delta); |
53 |
|
54 |
/* get_block arguments */
|
55 |
#define NORMAL 0 /* forces get_block to do disk read */ |
56 |
#define NO_READ 1 /* prevents get_block from doing disk read */ |
57 |
#define PEEK 2 /* returns ENOENT if not in cache */ |
58 |
|
59 |
/* Block I/O helper functions. */
|
60 |
void lmfs_driver(dev_t dev, char *label); |
61 |
ssize_t lmfs_bio(dev_t dev, struct fsdriver_data *data, size_t bytes,
|
62 |
off_t pos, int call);
|
63 |
void lmfs_bflush(dev_t dev);
|
64 |
|
65 |
#endif /* _MINIX_FSLIB_H */ |