libdragon
Loading...
Searching...
No Matches
dragonfs.h
Go to the documentation of this file.
1
8#ifndef __LIBDRAGON_DRAGONFS_H
9#define __LIBDRAGON_DRAGONFS_H
10
50#ifdef N64
51
52#include "ioctl.h"
53
54#endif
55
62#define DFS_DEFAULT_LOCATION 0
63
69#define MAX_FILENAME_LEN 243
70
74#define MAX_DIRECTORY_DEPTH 100
75
79#define IODFS_GET_ROM_BASE _IO('D', 0)
80
81
87#define DFS_ESUCCESS 0
89#define DFS_EBADINPUT -1
91#define DFS_ENOFILE -2
93#define DFS_EBADFS -3
95#define DFS_ENFILE -4
97#define DFS_EBADHANDLE -5
101// Deprecated naming
102#define DFS_ENOMEM -4
114#define FILETYPE(x) ((x) & 3)
115
121#define FLAGS_FILE 0x0
123#define FLAGS_DIR 0x1
125#define FLAGS_EOF 0x2
130#ifdef __cplusplus
131extern "C" {
132#endif
133
158int dfs_init(uint32_t base_fs_loc);
159
160
173int dfs_open(const char * const path);
174
193int dfs_read(void * const buf, int size, int count, uint32_t handle);
194
207int dfs_seek(uint32_t handle, int offset, int origin);
208
217int dfs_tell(uint32_t handle);
218
227int dfs_close(uint32_t handle);
228
237int dfs_eof(uint32_t handle);
238
247int dfs_size(uint32_t handle);
248
268uint32_t dfs_rom_addr(const char *path);
269
284int dfs_rom_size(const char *path);
285
289const char *dfs_strerror(int error);
290
291__attribute__((deprecated("relative paths support is deprecated; please use only absolute paths when interacting with DragonFS")))
292int dfs_chdir(const char * const path);
293
294__attribute__((deprecated("use dir_findfirst instead")))
295int dfs_dir_findfirst(const char * const path, char *buf);
296
297__attribute__((deprecated("use dir_findnext instead")))
298int dfs_dir_findnext(char *buf);
299
300#ifdef __cplusplus
301}
302#endif
303
304#endif
int dfs_seek(uint32_t handle, int offset, int origin)
Seek to an offset in the file.
Definition dragonfs.c:846
int dfs_size(uint32_t handle)
Return the file size of an open file.
Definition dragonfs.c:1006
int dfs_rom_size(const char *path)
Return the size of a file (in ROM data)
Definition dragonfs.c:1053
int dfs_dir_findfirst(const char *const path, char *buf)
Find the first file or directory in a directory listing.
Definition dragonfs.c:690
int dfs_chdir(const char *const path)
Change directories to the specified path.
Definition dragonfs.c:620
int dfs_open(const char *const path)
Open a file given a path.
Definition dragonfs.c:776
int dfs_read(void *const buf, int size, int count, uint32_t handle)
Read data from a file.
Definition dragonfs.c:924
int dfs_init(uint32_t base_fs_loc)
Initialize the filesystem.
Definition dragonfs.c:1347
uint32_t dfs_rom_addr(const char *path)
Return the physical address of a file (in ROM space)
Definition dragonfs.c:1019
int dfs_dir_findnext(char *buf)
Find the next file or directory in a directory listing.
Definition dragonfs.c:705
int dfs_tell(uint32_t handle)
Return the current offset into a file.
Definition dragonfs.c:911
const char * dfs_strerror(int error)
Convert DFS error code into an error string.
Definition dragonfs.c:1382
int dfs_close(uint32_t handle)
Close an already open file handle.
Definition dragonfs.c:831
int dfs_eof(uint32_t handle)
Return whether the end of file has been reached.
Definition dragonfs.c:1092
ioctl Implementation