kernel: some boottime sanitychecks
[minix.git] / include / minix / libminixfs.h
blobd68ef5e7956057691b1aaf640e1e82dcffa75de4
1 /* Prototypes for -lminixfs. */
3 #ifndef _MINIX_FSLIB_H
4 #define _MINIX_FSLIB_H
6 #include <minix/safecopies.h>
7 #include <minix/sef.h>
8 #include <minix/vfsif.h>
10 struct buf {
11 /* Data portion of the buffer. */
12 void *data;
14 /* Header portion of the buffer - internal to libminixfs. */
15 struct buf *lmfs_next; /* used to link all free bufs in a chain */
16 struct buf *lmfs_prev; /* used to link all free bufs the other way */
17 struct buf *lmfs_hash; /* used to link bufs on hash chains */
18 block_t lmfs_blocknr; /* block number of its (minor) device */
19 dev_t lmfs_dev; /* major | minor device where block resides */
20 char lmfs_dirt; /* BP_CLEAN or BP_DIRTY */
21 char lmfs_count; /* number of users of this buffer */
22 unsigned int lmfs_bytes; /* Number of bytes allocated in bp */
25 int fs_lookup_credentials(vfs_ucred_t *credentials,
26 uid_t *caller_uid, gid_t *caller_gid, cp_grant_id_t grant2, size_t cred_size);
27 u32_t fs_bufs_heuristic(int minbufs, u32_t btotal, u32_t bfree,
28 int blocksize, dev_t majordev);
30 void lmfs_markdirty(struct buf *bp);
31 void lmfs_markclean(struct buf *bp);
32 int lmfs_isclean(struct buf *bp);
33 dev_t lmfs_dev(struct buf *bp);
34 int lmfs_bytes(struct buf *bp);
35 int lmfs_bufs_in_use(void);
36 int lmfs_nr_bufs(void);
37 void lmfs_flushall(void);
38 int lmfs_fs_block_size(void);
39 void lmfs_may_use_vmcache(int);
40 void lmfs_set_blocksize(int blocksize, int major);
41 void lmfs_reset_rdwt_err(void);
42 int lmfs_rdwt_err(void);
43 void lmfs_buf_pool(int new_nr_bufs);
44 struct buf *lmfs_get_block(dev_t dev, block_t block,int only_search);
45 void lmfs_invalidate(dev_t device);
46 void lmfs_put_block(struct buf *bp, int block_type);
47 void lmfs_rw_scattered(dev_t, struct buf **, int, int);
49 /* calls that libminixfs does into fs */
50 void fs_blockstats(u32_t *blocks, u32_t *free, u32_t *used);
51 int fs_sync(void);
53 /* get_block arguments */
54 #define NORMAL 0 /* forces get_block to do disk read */
55 #define NO_READ 1 /* prevents get_block from doing disk read */
56 #define PREFETCH 2 /* tells get_block not to read or mark dev */
58 /* When a block is released, the type of usage is passed to put_block(). */
59 #define ONE_SHOT 0200 /* set if block not likely to be needed soon */
61 #define INODE_BLOCK 0 /* inode block */
62 #define DIRECTORY_BLOCK 1 /* directory block */
63 #define INDIRECT_BLOCK 2 /* pointer block */
64 #define MAP_BLOCK 3 /* bit map */
65 #define FULL_DATA_BLOCK 5 /* data, fully used */
66 #define PARTIAL_DATA_BLOCK 6 /* data, partly used*/
68 #define END_OF_FILE (-104) /* eof detected */
70 #endif /* _MINIX_FSLIB_H */