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