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