libdragon
Loading...
Searching...
No Matches
dragonfs.h
Go to the documentation of this file.
1
6#ifndef __LIBDRAGON_DRAGONFS_H
7#define __LIBDRAGON_DRAGONFS_H
8
54#define DFS_DEFAULT_LOCATION 0
55
61#define MAX_FILENAME_LEN 243
62
66#define MAX_DIRECTORY_DEPTH 100
67
73#define DFS_ESUCCESS 0
75#define DFS_EBADINPUT -1
77#define DFS_ENOFILE -2
79#define DFS_EBADFS -3
81#define DFS_ENFILE -4
83#define DFS_EBADHANDLE -5
87// Deprecated naming
88#define DFS_ENOMEM -4
100#define FILETYPE(x) ((x) & 3)
101
107#define FLAGS_FILE 0x0
109#define FLAGS_DIR 0x1
111#define FLAGS_EOF 0x2
116#ifdef __cplusplus
117extern "C" {
118#endif
119
144int dfs_init(uint32_t base_fs_loc);
145
156int dfs_chdir(const char * const path);
157
171int dfs_dir_findfirst(const char * const path, char *buf);
172
183int dfs_dir_findnext(char *buf);
184
185
198int dfs_open(const char * const path);
199
218int dfs_read(void * const buf, int size, int count, uint32_t handle);
219
232int dfs_seek(uint32_t handle, int offset, int origin);
233
242int dfs_tell(uint32_t handle);
243
252int dfs_close(uint32_t handle);
253
262int dfs_eof(uint32_t handle);
263
272int dfs_size(uint32_t handle);
273
292uint32_t dfs_rom_addr(const char *path);
293
297const char *dfs_strerror(int error);
298
299#ifdef __cplusplus
300}
301#endif
302
303#endif
int dfs_seek(uint32_t handle, int offset, int origin)
Seek to an offset in the file.
Definition dragonfs.c:723
int dfs_size(uint32_t handle)
Return the file size of an open file.
Definition dragonfs.c:917
int dfs_dir_findfirst(const char *const path, char *buf)
Find the first file or directory in a directory listing.
Definition dragonfs.c:592
int dfs_chdir(const char *const path)
Change directories to the specified path.
Definition dragonfs.c:578
int dfs_open(const char *const path)
Open a file given a path.
Definition dragonfs.c:656
int dfs_read(void *const buf, int size, int count, uint32_t handle)
Read data from a file.
Definition dragonfs.c:827
int dfs_init(uint32_t base_fs_loc)
Initialize the filesystem.
Definition dragonfs.c:1213
uint32_t dfs_rom_addr(const char *path)
Return the physical address of a file (in ROM space)
Definition dragonfs.c:948
int dfs_dir_findnext(char *buf)
Find the next file or directory in a directory listing.
Definition dragonfs.c:621
int dfs_tell(uint32_t handle)
Return the current offset into a file.
Definition dragonfs.c:796
const char * dfs_strerror(int error)
Convert DFS error code into an error string.
Definition dragonfs.c:1251
int dfs_close(uint32_t handle)
Close an already open file handle.
Definition dragonfs.c:696
int dfs_eof(uint32_t handle)
Return whether the end of file has been reached.
Definition dragonfs.c:976