xref: /minix3/minix/fs/mfs/proto.h (revision 4472b590c74fed661146a925d8dff2ed1b04256e)
1433d6423SLionel Sambuc #ifndef __MFS_PROTO_H__
2433d6423SLionel Sambuc #define __MFS_PROTO_H__
3433d6423SLionel Sambuc 
4433d6423SLionel Sambuc /* Some shortcuts to functions in -lminixfs */
50314acfbSDavid van Moolenbroek #define put_block(b) lmfs_put_block(b)
6433d6423SLionel Sambuc 
7433d6423SLionel Sambuc /* Function prototypes. */
8433d6423SLionel Sambuc 
9433d6423SLionel Sambuc /* Structs used in prototypes must be declared as such first. */
10433d6423SLionel Sambuc struct buf;
11433d6423SLionel Sambuc struct filp;
12433d6423SLionel Sambuc struct inode;
13433d6423SLionel Sambuc struct super_block;
14433d6423SLionel Sambuc 
15433d6423SLionel Sambuc /* cache.c */
16433d6423SLionel Sambuc zone_t alloc_zone(dev_t dev, zone_t z);
17433d6423SLionel Sambuc void free_zone(dev_t dev, zone_t numb);
18*6c46a77dSDavid van Moolenbroek struct buf *get_block(dev_t dev, block_t block, int how);
19433d6423SLionel Sambuc 
20433d6423SLionel Sambuc /* inode.c */
21ccaeedb2SDavid van Moolenbroek struct inode *alloc_inode(dev_t dev, mode_t bits, uid_t uid, gid_t gid);
22433d6423SLionel Sambuc void dup_inode(struct inode *ip);
23433d6423SLionel Sambuc struct inode *find_inode(dev_t dev, ino_t numb);
24ccaeedb2SDavid van Moolenbroek int fs_putnode(ino_t ino_nr, unsigned int count);
25433d6423SLionel Sambuc void init_inode_cache(void);
26433d6423SLionel Sambuc struct inode *get_inode(dev_t dev, ino_t numb);
27433d6423SLionel Sambuc void put_inode(struct inode *rip);
28433d6423SLionel Sambuc void update_times(struct inode *rip);
29433d6423SLionel Sambuc void rw_inode(struct inode *rip, int rw_flag);
30433d6423SLionel Sambuc 
31433d6423SLionel Sambuc /* link.c */
32ccaeedb2SDavid van Moolenbroek int fs_trunc(ino_t ino_nr, off_t start, off_t end);
33ccaeedb2SDavid van Moolenbroek int fs_link(ino_t dir_nr, char *name, ino_t ino_nr);
34ccaeedb2SDavid van Moolenbroek ssize_t fs_rdlink(ino_t ino_nr, struct fsdriver_data *data, size_t bytes);
35ccaeedb2SDavid van Moolenbroek int fs_rename(ino_t old_dir_nr, char *old_name, ino_t new_dir_nr,
36ccaeedb2SDavid van Moolenbroek 	char *new_name);
37ccaeedb2SDavid van Moolenbroek int fs_unlink(ino_t dir_nr, char *name, int call);
38433d6423SLionel Sambuc int truncate_inode(struct inode *rip, off_t len);
39433d6423SLionel Sambuc 
40433d6423SLionel Sambuc /* misc.c */
41ccaeedb2SDavid van Moolenbroek void fs_sync(void);
42433d6423SLionel Sambuc 
43433d6423SLionel Sambuc /* mount.c */
44ccaeedb2SDavid van Moolenbroek int fs_mount(dev_t dev, unsigned int flags, struct fsdriver_node *root_node,
45ccaeedb2SDavid van Moolenbroek 	unsigned int *res_flags);
46ccaeedb2SDavid van Moolenbroek void fs_unmount(void);
47ccaeedb2SDavid van Moolenbroek int fs_mountpt(ino_t ino_nr);
48433d6423SLionel Sambuc 
49433d6423SLionel Sambuc /* open.c */
50ccaeedb2SDavid van Moolenbroek int fs_create(ino_t dir_nr, char *name, mode_t mode, uid_t uid, gid_t gid,
51ccaeedb2SDavid van Moolenbroek 	struct fsdriver_node *node);
52ccaeedb2SDavid van Moolenbroek int fs_mkdir(ino_t dir_nr, char *name, mode_t mode, uid_t uid, gid_t gid);
53ccaeedb2SDavid van Moolenbroek int fs_mknod(ino_t dir_nr, char *name, mode_t mode, uid_t uid, gid_t gid,
54ccaeedb2SDavid van Moolenbroek 	dev_t dev);
55ccaeedb2SDavid van Moolenbroek int fs_slink(ino_t dir_nr, char *name, uid_t uid, gid_t gid,
56ccaeedb2SDavid van Moolenbroek 	struct fsdriver_data *data, size_t bytes);
57ccaeedb2SDavid van Moolenbroek void fs_seek(ino_t ino_nr);
58433d6423SLionel Sambuc 
59433d6423SLionel Sambuc /* path.c */
60ccaeedb2SDavid van Moolenbroek int fs_lookup(ino_t dir_nr, char *name, struct fsdriver_node *node,
61ccaeedb2SDavid van Moolenbroek 	int *is_mountpt);
62ccaeedb2SDavid van Moolenbroek struct inode *advance(struct inode *dirp, const char *string);
63ccaeedb2SDavid van Moolenbroek int search_dir(struct inode *ldir_ptr, const char *string, ino_t *numb,
64ccaeedb2SDavid van Moolenbroek 	int flag);
65433d6423SLionel Sambuc 
66433d6423SLionel Sambuc /* protect.c */
67ccaeedb2SDavid van Moolenbroek int fs_chmod(ino_t ino, mode_t *mode);
68ccaeedb2SDavid van Moolenbroek int fs_chown(ino_t ino, uid_t uid, gid_t gid, mode_t *mode);
69433d6423SLionel Sambuc 
70433d6423SLionel Sambuc /* read.c */
71ccaeedb2SDavid van Moolenbroek ssize_t fs_readwrite(ino_t ino_nr, struct fsdriver_data *data, size_t bytes,
72ccaeedb2SDavid van Moolenbroek 	off_t pos, int call);
73433d6423SLionel Sambuc block_t read_map(struct inode *rip, off_t pos, int opportunistic);
74433d6423SLionel Sambuc struct buf *get_block_map(register struct inode *rip, u64_t position);
75433d6423SLionel Sambuc zone_t rd_indir(struct buf *bp, int index);
76ccaeedb2SDavid van Moolenbroek ssize_t fs_getdents(ino_t ino_nr, struct fsdriver_data *data, size_t bytes,
77ccaeedb2SDavid van Moolenbroek 	off_t *posp);
78433d6423SLionel Sambuc 
79433d6423SLionel Sambuc /* stadir.c */
80ccaeedb2SDavid van Moolenbroek int fs_stat(ino_t ino_nr, struct stat *statbuf);
81ccaeedb2SDavid van Moolenbroek int fs_statvfs(struct statvfs *st);
82433d6423SLionel Sambuc 
83433d6423SLionel Sambuc /* super.c */
84433d6423SLionel Sambuc bit_t alloc_bit(struct super_block *sp, int map, bit_t origin);
85433d6423SLionel Sambuc void free_bit(struct super_block *sp, int map, bit_t bit_returned);
86433d6423SLionel Sambuc unsigned int get_block_size(dev_t dev);
87433d6423SLionel Sambuc int read_super(struct super_block *sp);
88433d6423SLionel Sambuc int write_super(struct super_block *sp);
89433d6423SLionel Sambuc 
90433d6423SLionel Sambuc /* stats.c */
91433d6423SLionel Sambuc bit_t count_free_bits(struct super_block *sp, int map);
92433d6423SLionel Sambuc 
93433d6423SLionel Sambuc /* time.c */
94ccaeedb2SDavid van Moolenbroek int fs_utime(ino_t ino_t, struct timespec *atime, struct timespec *mtime);
95433d6423SLionel Sambuc 
96433d6423SLionel Sambuc /* utility.c */
97433d6423SLionel Sambuc unsigned conv2(int norm, int w);
98433d6423SLionel Sambuc long conv4(int norm, long x);
99433d6423SLionel Sambuc 
100433d6423SLionel Sambuc /* write.c */
101433d6423SLionel Sambuc void clear_zone(struct inode *rip, off_t pos, int flag);
102433d6423SLionel Sambuc struct buf *new_block(struct inode *rip, off_t position);
103433d6423SLionel Sambuc void zero_block(struct buf *bp);
104433d6423SLionel Sambuc int write_map(struct inode *, off_t, zone_t, int);
105433d6423SLionel Sambuc 
106433d6423SLionel Sambuc #endif
107433d6423SLionel Sambuc 
108