make vfs & filesystems use failable copying
[minix3.git] / include / minix / libminixfs.h
blob6ad6299d95e70bccf36d76616ec49dd1f729e35b
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_count; /* number of users of this buffer */
21 char lmfs_needsetcache; /* to be identified to VM */
22 unsigned int lmfs_bytes; /* Number of bytes allocated in bp */
23 u32_t lmfs_flags; /* Flags shared between VM and FS */
25 /* If any, which inode & offset does this block correspond to?
26 * If none, VMC_NO_INODE
28 ino_t lmfs_inode;
29 u64_t lmfs_inode_offset;
32 int fs_lookup_credentials(vfs_ucred_t *credentials,
33 uid_t *caller_uid, gid_t *caller_gid, cp_grant_id_t grant2, size_t cred_size);
35 void lmfs_markdirty(struct buf *bp);
36 void lmfs_markclean(struct buf *bp);
37 int lmfs_isclean(struct buf *bp);
38 dev_t lmfs_dev(struct buf *bp);
39 int lmfs_bytes(struct buf *bp);
40 int lmfs_bufs_in_use(void);
41 int lmfs_nr_bufs(void);
42 void lmfs_flushall(void);
43 int lmfs_fs_block_size(void);
44 void lmfs_may_use_vmcache(int);
45 void lmfs_set_blocksize(int blocksize, int major);
46 void lmfs_reset_rdwt_err(void);
47 int lmfs_rdwt_err(void);
48 void lmfs_buf_pool(int new_nr_bufs);
49 struct buf *lmfs_get_block(dev_t dev, block_t block,int only_search);
50 struct buf *lmfs_get_block_ino(dev_t dev, block_t block,int only_search,
51 ino_t ino, u64_t off);
52 void lmfs_invalidate(dev_t device);
53 void lmfs_put_block(struct buf *bp, int block_type);
54 void lmfs_rw_scattered(dev_t, struct buf **, int, int);
55 void lmfs_setquiet(int q);
56 int lmfs_do_bpeek(message *);
57 void lmfs_cache_reevaluate(dev_t dev);
58 void lmfs_blockschange(dev_t dev, int delta);
60 /* calls that libminixfs does into fs */
61 void fs_blockstats(u64_t *blocks, u64_t *free, u64_t *used);
62 int fs_sync(void);
64 /* get_block arguments */
65 #define NORMAL 0 /* forces get_block to do disk read */
66 #define NO_READ 1 /* prevents get_block from doing disk read */
67 #define PREFETCH 2 /* tells get_block not to read or mark dev */
69 /* When a block is released, the type of usage is passed to put_block(). */
70 #define ONE_SHOT 0200 /* set if block not likely to be needed soon */
72 #define INODE_BLOCK 0 /* inode block */
73 #define DIRECTORY_BLOCK 1 /* directory block */
74 #define INDIRECT_BLOCK 2 /* pointer block */
75 #define MAP_BLOCK 3 /* bit map */
76 #define FULL_DATA_BLOCK 5 /* data, fully used */
77 #define PARTIAL_DATA_BLOCK 6 /* data, partly used*/
79 #define END_OF_FILE (-104) /* eof detected */
81 #endif /* _MINIX_FSLIB_H */