xref: /minix/minix/fs/mfs/proto.h (revision 83133719)
1 #ifndef __MFS_PROTO_H__
2 #define __MFS_PROTO_H__
3 
4 /* Some shortcuts to functions in -lminixfs */
5 #define get_block(d, b, t) lmfs_get_block(d, b, t)
6 #define put_block(b, t) lmfs_put_block(b, t)
7 
8 /* Function prototypes. */
9 
10 /* Structs used in prototypes must be declared as such first. */
11 struct buf;
12 struct filp;
13 struct inode;
14 struct super_block;
15 
16 /* cache.c */
17 zone_t alloc_zone(dev_t dev, zone_t z);
18 void free_zone(dev_t dev, zone_t numb);
19 
20 /* inode.c */
21 struct inode *alloc_inode(dev_t dev, mode_t bits, uid_t uid, gid_t gid);
22 void dup_inode(struct inode *ip);
23 struct inode *find_inode(dev_t dev, ino_t numb);
24 int fs_putnode(ino_t ino_nr, unsigned int count);
25 void init_inode_cache(void);
26 struct inode *get_inode(dev_t dev, ino_t numb);
27 void put_inode(struct inode *rip);
28 void update_times(struct inode *rip);
29 void rw_inode(struct inode *rip, int rw_flag);
30 
31 /* link.c */
32 int fs_trunc(ino_t ino_nr, off_t start, off_t end);
33 int fs_link(ino_t dir_nr, char *name, ino_t ino_nr);
34 ssize_t fs_rdlink(ino_t ino_nr, struct fsdriver_data *data, size_t bytes);
35 int fs_rename(ino_t old_dir_nr, char *old_name, ino_t new_dir_nr,
36 	char *new_name);
37 int fs_unlink(ino_t dir_nr, char *name, int call);
38 int truncate_inode(struct inode *rip, off_t len);
39 
40 /* misc.c */
41 void fs_sync(void);
42 
43 /* mount.c */
44 int fs_mount(dev_t dev, unsigned int flags, struct fsdriver_node *root_node,
45 	unsigned int *res_flags);
46 void fs_unmount(void);
47 int fs_mountpt(ino_t ino_nr);
48 
49 /* open.c */
50 int fs_create(ino_t dir_nr, char *name, mode_t mode, uid_t uid, gid_t gid,
51 	struct fsdriver_node *node);
52 int fs_mkdir(ino_t dir_nr, char *name, mode_t mode, uid_t uid, gid_t gid);
53 int fs_mknod(ino_t dir_nr, char *name, mode_t mode, uid_t uid, gid_t gid,
54 	dev_t dev);
55 int fs_slink(ino_t dir_nr, char *name, uid_t uid, gid_t gid,
56 	struct fsdriver_data *data, size_t bytes);
57 void fs_seek(ino_t ino_nr);
58 
59 /* path.c */
60 int fs_lookup(ino_t dir_nr, char *name, struct fsdriver_node *node,
61 	int *is_mountpt);
62 struct inode *advance(struct inode *dirp, const char *string);
63 int search_dir(struct inode *ldir_ptr, const char *string, ino_t *numb,
64 	int flag);
65 
66 /* protect.c */
67 int fs_chmod(ino_t ino, mode_t *mode);
68 int fs_chown(ino_t ino, uid_t uid, gid_t gid, mode_t *mode);
69 
70 /* read.c */
71 ssize_t fs_readwrite(ino_t ino_nr, struct fsdriver_data *data, size_t bytes,
72 	off_t pos, int call);
73 block_t read_map(struct inode *rip, off_t pos, int opportunistic);
74 struct buf *get_block_map(register struct inode *rip, u64_t position);
75 zone_t rd_indir(struct buf *bp, int index);
76 ssize_t fs_getdents(ino_t ino_nr, struct fsdriver_data *data, size_t bytes,
77 	off_t *posp);
78 
79 /* stadir.c */
80 int fs_stat(ino_t ino_nr, struct stat *statbuf);
81 int fs_statvfs(struct statvfs *st);
82 
83 /* super.c */
84 bit_t alloc_bit(struct super_block *sp, int map, bit_t origin);
85 void free_bit(struct super_block *sp, int map, bit_t bit_returned);
86 unsigned int get_block_size(dev_t dev);
87 struct super_block *get_super(dev_t dev);
88 int read_super(struct super_block *sp);
89 int write_super(struct super_block *sp);
90 u32_t get_used_blocks(struct super_block *sp);
91 
92 /* stats.c */
93 bit_t count_free_bits(struct super_block *sp, int map);
94 
95 /* time.c */
96 int fs_utime(ino_t ino_t, struct timespec *atime, struct timespec *mtime);
97 
98 /* utility.c */
99 unsigned conv2(int norm, int w);
100 long conv4(int norm, long x);
101 
102 /* write.c */
103 void clear_zone(struct inode *rip, off_t pos, int flag);
104 struct buf *new_block(struct inode *rip, off_t position);
105 void zero_block(struct buf *bp);
106 int write_map(struct inode *, off_t, zone_t, int);
107 
108 #endif
109 
110