file.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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[MINIFFS_FILENAME_LENGTH];
  16. char ext[MINIFFS_EXTENSION_LENGTH];
  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. void *memoryOffset;
  27. #ifdef BUILD_HOST_TOOLS
  28. uint32_t file_count; /***< Number of valid files in the list */
  29. uint32_t file_list_count; /***< Number of items in the list */
  30. uint32_t file_list_size; /***< Size of the list */
  31. fs_fent_t *files; /***< File entry list */
  32. #endif
  33. } miniffs_t;
  34. miniffs_t *miniffs_openfs(char *host_file); /***< Open a MiniFFS filesystem */
  35. #ifdef __miniffs_internal
  36. size_t host_map_file(char *filename, char **dest);
  37. void host_unmap_file(char **dest, size_t length);
  38. #endif
  39. #endif /* MINIFFS_PLATFORM_FILE_H */