Flipper Zero Firmware
Loading...
Searching...
No Matches
filesystem_api_internal.h
1#pragma once
2#include <furi.h>
3#include "filesystem_api_defines.h"
4
5#ifdef __cplusplus
6extern "C" {
7#endif
8
10typedef enum {
11 FileTypeClosed,
12 FileTypeOpenDir,
13 FileTypeOpenFile,
14} FileType;
15
17struct File {
18 uint32_t file_id;
19 FileType type;
20 FS_Error error_id;
22 void* storage;
23};
24
85typedef struct {
86 bool (*const open)(
87 void* context,
88 File* file,
89 const char* path,
90 FS_AccessMode access_mode,
91 FS_OpenMode open_mode);
92 bool (*const close)(void* context, File* file);
93 uint16_t (*read)(void* context, File* file, void* buff, uint16_t bytes_to_read);
94 uint16_t (*write)(void* context, File* file, const void* buff, uint16_t bytes_to_write);
95 bool (*const seek)(void* context, File* file, uint32_t offset, bool from_start);
96 uint64_t (*tell)(void* context, File* file);
97 bool (*const truncate)(void* context, File* file);
98 uint64_t (*size)(void* context, File* file);
99 bool (*const sync)(void* context, File* file);
100 bool (*const eof)(void* context, File* file);
102
128typedef struct {
129 bool (*const open)(void* context, File* file, const char* path);
130 bool (*const close)(void* context, File* file);
131 bool (*const read)(
132 void* context,
133 File* file,
134 FileInfo* fileinfo,
135 char* name,
136 uint16_t name_length);
137 bool (*const rewind)(void* context, File* file);
138} FS_Dir_Api;
139
176typedef struct {
177 FS_Error (*const stat)(void* context, const char* path, FileInfo* fileinfo);
178 FS_Error (*const remove)(void* context, const char* path);
179 FS_Error (*const mkdir)(void* context, const char* path);
180 FS_Error (*const fs_info)(
181 void* context,
182 const char* fs_path,
183 uint64_t* total_space,
184 uint64_t* free_space);
185 bool (*const equivalent_path)(const char* path1, const char* path2);
187
189typedef struct {
190 const FS_File_Api file;
191 const FS_Dir_Api dir;
192 const FS_Common_Api common;
193} FS_Api;
194
195#ifdef __cplusplus
196}
197#endif
Full filesystem api structure.
Definition filesystem_api_internal.h:189
Definition filesystem_api_internal.h:176
Definition filesystem_api_internal.h:128
Definition filesystem_api_internal.h:85
Structure that hold file index and returned api errors.
Definition filesystem_api_internal.h:17
FS_Error error_id
Standard API error from FS_Error enum.
Definition filesystem_api_internal.h:20
int32_t internal_error_id
Internal API error value.
Definition filesystem_api_internal.h:21
uint32_t file_id
File ID for internal references.
Definition filesystem_api_internal.h:18
Structure that hold file info.
Definition filesystem_api_defines.h:48