libdragon
Loading...
Searching...
No Matches
dfsinternal.h
Go to the documentation of this file.
1
8#ifndef __LIBDRAGON_DFSINTERNAL_H
9#define __LIBDRAGON_DFSINTERNAL_H
10
17#define ROOT_FLAGS 0xFFFFFFFF
19#define ROOT_NEXT_ENTRY 0xDEADBEEF
21#define ROOT_PATH "DragonFS 2.0"
22
24#define SECTOR_SIZE 256
26#define SECTOR_PAYLOAD 252
27
29#define DFS_LOOKUP_PRIME 31
30
33{
35 uint32_t next_entry;
37 uint32_t flags;
41 uint32_t file_pointer;
42} __attribute__((__packed__));
43
44_Static_assert(sizeof(struct directory_entry) == SECTOR_SIZE, "invalid directory_entry size");
45
47typedef struct directory_entry directory_entry_t;
48
50typedef struct dfs_open_file_s
51{
53 uint32_t size;
55 uint32_t loc;
59
61typedef struct dfs_lookup_file_s {
63 uint32_t path_hash;
65 uint32_t path_ofs;
67 uint32_t data_ofs;
69 uint32_t data_len;
71
73typedef struct dfs_lookup_s {
75 uint32_t num_files;
77 uint32_t path_ofs;
81
/* dfs */
83
84#endif
uint32_t size
The size in bytes of this file.
Definition dfsinternal.h:53
uint32_t num_files
Number of files.
Definition dfsinternal.h:75
uint32_t cart_start_loc
The offset within the filesystem where the file is stored.
Definition dfsinternal.h:57
uint32_t path_hash
Hash of the path string.
Definition dfsinternal.h:63
uint32_t flags
File size and flags. See FLAGS_FILE, FLAGS_DIR and FLAGS_EOF.
Definition dfsinternal.h:37
uint32_t next_entry
Offset to next directory entry.
Definition dfsinternal.h:35
uint32_t file_pointer
Offset to start sector of the file.
Definition dfsinternal.h:41
uint32_t data_ofs
Data offset for file.
Definition dfsinternal.h:67
uint32_t loc
The offset of the current location in the file.
Definition dfsinternal.h:55
uint32_t path_ofs
Base offset for path data.
Definition dfsinternal.h:77
char path[MAX_FILENAME_LEN+1]
The file or directory name.
Definition dfsinternal.h:39
uint32_t path_ofs
Top 12 bits: length of the path string; lowest 20 bits: offset of the path string.
Definition dfsinternal.h:65
uint32_t data_len
Data length for file.
Definition dfsinternal.h:69
#define SECTOR_SIZE
The size of a sector.
Definition dfsinternal.h:24
#define MAX_FILENAME_LEN
Maximum filename length.
Definition dragonfs.h:63
Data for a single file in dfs_lookup_t.
Definition dfsinternal.h:61
Data for DFS file lookup used to speed up file open performance.
Definition dfsinternal.h:73
Open file handle structure.
Definition dfsinternal.h:51
Representation of a directory entry.
Definition dfsinternal.h:33