lfs.h 587 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * The little filesystem
  3. *
  4. * Copyright (c) 2017 Christopher Haster
  5. * Distributed under the MIT license
  6. */
  7. #ifndef LFS_H
  8. #define LFS_H
  9. #include "lfs_config.h"
  10. #include "lfs_bd.h"
  11. struct lfs_free_list {
  12. lfs_word_t rev[2];
  13. lfs_ino_t phead;
  14. lfs_ino_t head;
  15. lfs_ino_t tip;
  16. lfs_off_t off;
  17. };
  18. typedef struct lfs {
  19. lfs_bd_t *bd;
  20. const struct lfs_bd_ops *ops;
  21. struct lfs_free_list free;
  22. struct lfs_bd_info info;
  23. } lfs_t;
  24. lfs_error_t lfs_create(lfs_t *lfs, lfs_bd_t *bd, const struct lfs_bd_ops *bd_ops);
  25. lfs_error_t lfs_format(lfs_t *lfs);
  26. #endif