48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
/******************************************************************************
|
|
* MiniFFS : Mini Flat File System
|
|
* platform/file.h: Specific functions for the File backend
|
|
*
|
|
* Copyright (c) 2008-2022 986-Studio. All rights reserved.
|
|
*
|
|
******************************************************************************/
|
|
|
|
#ifndef MINIFFS_PLATFORM_FILE_H
|
|
#define MINIFFS_PLATFORM_FILE_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#ifdef BUILD_HOST_TOOLS
|
|
typedef struct fs_fent_t
|
|
{
|
|
char name[MINIFFS_FILENAME_LENGTH];
|
|
char ext[MINIFFS_EXTENSION_LENGTH];
|
|
bool deleted;
|
|
bool mapped;
|
|
uint32_t size;
|
|
char *file_pointer;
|
|
} fs_fent_t;
|
|
#endif
|
|
|
|
typedef struct miniffs_t
|
|
{
|
|
miniffs_header_t *header;
|
|
|
|
void *memoryOffset;
|
|
#ifdef BUILD_HOST_TOOLS
|
|
uint32_t file_count; /***< Number of valid files in the list */
|
|
uint32_t file_list_count; /***< Number of items in the list */
|
|
uint32_t file_list_size; /***< Size of the list */
|
|
fs_fent_t *files; /***< File entry list */
|
|
#endif
|
|
} miniffs_t;
|
|
|
|
miniffs_t *miniffs_openfs(char *host_file); /***< Open a MiniFFS filesystem */
|
|
|
|
#ifdef __miniffs_internal
|
|
size_t host_map_file(char *filename, char **dest);
|
|
void host_unmap_file(char **dest, size_t length);
|
|
#endif
|
|
|
|
#endif /* MINIFFS_PLATFORM_FILE_H */
|