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