disk-io.h 971 B

123456789101112131415161718192021222324252627282930
  1. #ifndef __DISKIO__
  2. #define __DISKIO__
  3. #include "list.h"
  4. struct tree_buffer {
  5. u64 blocknr;
  6. int count;
  7. union {
  8. struct node node;
  9. struct leaf leaf;
  10. };
  11. struct list_head dirty;
  12. struct list_head cache;
  13. };
  14. struct tree_buffer *read_tree_block(struct ctree_root *root, u64 blocknr);
  15. struct tree_buffer *find_tree_block(struct ctree_root *root, u64 blocknr);
  16. int write_tree_block(struct ctree_root *root, struct tree_buffer *buf);
  17. int dirty_tree_block(struct ctree_root *root, struct tree_buffer *buf);
  18. int clean_tree_block(struct ctree_root *root, struct tree_buffer *buf);
  19. int commit_transaction(struct ctree_root *root);
  20. struct ctree_root *open_ctree(char *filename, struct ctree_super_block *s);
  21. int close_ctree(struct ctree_root *root);
  22. void tree_block_release(struct ctree_root *root, struct tree_buffer *buf);
  23. int write_ctree_super(struct ctree_root *root, struct ctree_super_block *s);
  24. int mkfs(int fd);
  25. #define CTREE_SUPER_INFO_OFFSET(bs) (16 * (bs))
  26. #endif