file.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /******************************************************************************
  2. * MiniFFS : Mini Flat File System
  3. * platform/file.h: Specific functions for the File backend
  4. *
  5. * Copyright (c) 2008-2022 986-Studio. All rights reserved.
  6. *
  7. ******************************************************************************/
  8. #ifndef MINIFFS_PLATFORM_FILE_H
  9. #define MINIFFS_PLATFORM_FILE_H
  10. #include <stdint.h>
  11. #include <stdbool.h>
  12. #ifdef BUILD_HOST_TOOLS
  13. typedef struct fs_fent_t
  14. {
  15. char name[8];
  16. char ext[3];
  17. bool deleted;
  18. bool mapped;
  19. uint32_t size;
  20. char *file_pointer;
  21. } fs_fent_t;
  22. #endif
  23. typedef struct miniffs_t
  24. {
  25. miniffs_header_t *header;
  26. #ifdef BUILD_HOST_TOOLS
  27. uint32_t file_count; /***< Number of valid files in the list */
  28. uint32_t file_list_count; /***< Number of items in the list */
  29. uint32_t file_list_size; /***< Size of the list */
  30. fs_fent_t *files; /***< File entry list */
  31. #endif
  32. } miniffs_t;
  33. size_t host_map_file(char *filename, char **dest);
  34. void host_unmap_file(char **dest, size_t length);
  35. miniffs_t *miniffs_openfs(char *host_file); /***< Open a MiniFFS filesystem */
  36. #endif /* MINIFFS_PLATFORM_FILE_H */