proto.h 3.4 KB

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