Skip to content

Commit 99e80f8

Browse files
authored
[dfs] Add DFS v2.0 (#7606)
1 parent c33a215 commit 99e80f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+5373
-11490
lines changed

components/dfs/Kconfig

Lines changed: 141 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ if RT_USING_DFS
1616
bool "Using working directory"
1717
default y
1818

19+
if RT_USING_DFS_V1
1920
config RT_USING_DFS_MNTTABLE
2021
bool "Using mount table for file system"
2122
default n
@@ -27,6 +28,7 @@ if RT_USING_DFS
2728
{0}
2829
};
2930
The mount_table must be terminated with NULL.
31+
endif
3032

3133
config DFS_FD_MAX
3234
int "The maximal number of opened files"
@@ -44,8 +46,145 @@ if RT_USING_DFS
4446
bool "DFS v2.0"
4547
endchoice
4648

47-
source "$RTT_DIR/components/dfs/dfs_v1/Kconfig"
48-
source "$RTT_DIR/components/dfs/dfs_v2/Kconfig"
49+
if RT_USING_DFS_V1
50+
config DFS_FILESYSTEMS_MAX
51+
int "The maximal number of mounted file system"
52+
default 4
53+
54+
config DFS_FILESYSTEM_TYPES_MAX
55+
int "The maximal number of file system type"
56+
default 4
57+
endif
58+
59+
config RT_USING_DFS_ELMFAT
60+
bool "Enable elm-chan fatfs"
61+
default n
62+
help
63+
FatFs is a generic FAT/exFAT file system module for small embedded systems.
64+
65+
if RT_USING_DFS_ELMFAT
66+
menu "elm-chan's FatFs, Generic FAT Filesystem Module"
67+
config RT_DFS_ELM_CODE_PAGE
68+
int "OEM code page"
69+
default 437
70+
71+
config RT_DFS_ELM_WORD_ACCESS
72+
bool "Using RT_DFS_ELM_WORD_ACCESS"
73+
default y
74+
75+
choice
76+
prompt "Support long file name"
77+
default RT_DFS_ELM_USE_LFN_3
78+
79+
config RT_DFS_ELM_USE_LFN_0
80+
bool "0: LFN disable"
81+
82+
config RT_DFS_ELM_USE_LFN_1
83+
bool "1: LFN with static LFN working buffer"
84+
85+
config RT_DFS_ELM_USE_LFN_2
86+
bool "2: LFN with dynamic LFN working buffer on the stack"
87+
88+
config RT_DFS_ELM_USE_LFN_3
89+
bool "3: LFN with dynamic LFN working buffer on the heap"
90+
endchoice
91+
92+
config RT_DFS_ELM_USE_LFN
93+
int
94+
default 0 if RT_DFS_ELM_USE_LFN_0
95+
default 1 if RT_DFS_ELM_USE_LFN_1
96+
default 2 if RT_DFS_ELM_USE_LFN_2
97+
default 3 if RT_DFS_ELM_USE_LFN_3
98+
99+
choice
100+
prompt "Support unicode for long file name"
101+
default RT_DFS_ELM_LFN_UNICODE_0
102+
103+
config RT_DFS_ELM_LFN_UNICODE_0
104+
bool "0: ANSI/OEM in current CP (TCHAR = char)"
105+
106+
config RT_DFS_ELM_LFN_UNICODE_1
107+
bool "1: Unicode in UTF-16 (TCHAR = WCHAR)"
108+
109+
config RT_DFS_ELM_LFN_UNICODE_2
110+
bool "2: Unicode in UTF-8 (TCHAR = char)"
111+
112+
config RT_DFS_ELM_LFN_UNICODE_3
113+
bool "3: Unicode in UTF-32 (TCHAR = DWORD)"
114+
endchoice
115+
116+
config RT_DFS_ELM_LFN_UNICODE
117+
int
118+
default 0 if RT_DFS_ELM_LFN_UNICODE_0
119+
default 1 if RT_DFS_ELM_LFN_UNICODE_1
120+
default 2 if RT_DFS_ELM_LFN_UNICODE_2
121+
default 3 if RT_DFS_ELM_LFN_UNICODE_3
122+
123+
config RT_DFS_ELM_MAX_LFN
124+
int "Maximal size of file name length"
125+
range 12 255
126+
default 255
127+
128+
config RT_DFS_ELM_DRIVES
129+
int "Number of volumes (logical drives) to be used."
130+
default 2
131+
132+
config RT_DFS_ELM_MAX_SECTOR_SIZE
133+
int "Maximum sector size to be handled."
134+
default 512
135+
help
136+
If you use some spi nor flash for fatfs, please set this the erase sector size, for example 4096.
137+
138+
config RT_DFS_ELM_USE_ERASE
139+
bool "Enable sector erase feature"
140+
default n
141+
142+
config RT_DFS_ELM_REENTRANT
143+
bool "Enable the reentrancy (thread safe) of the FatFs module"
144+
default y
145+
146+
config RT_DFS_ELM_MUTEX_TIMEOUT
147+
int "Timeout of thread-safe protection mutex"
148+
range 0 1000000
149+
default 3000
150+
depends on RT_DFS_ELM_REENTRANT
151+
endmenu
152+
endif
153+
154+
config RT_USING_DFS_DEVFS
155+
bool "Using devfs for device objects"
156+
default y
157+
158+
config RT_USING_DFS_ROMFS
159+
bool "Enable ReadOnly file system on flash"
160+
default n
161+
if RT_USING_DFS_V1
162+
config RT_USING_DFS_CROMFS
163+
bool "Enable ReadOnly compressed file system on flash"
164+
default n
165+
# select PKG_USING_ZLIB
166+
167+
config RT_USING_DFS_RAMFS
168+
bool "Enable RAM file system"
169+
select RT_USING_MEMHEAP
170+
default n
171+
endif
172+
config RT_USING_DFS_TMPFS
173+
bool "Enable TMP file system"
174+
default n
175+
176+
if RT_USING_DFS_V1
177+
config RT_USING_DFS_NFS
178+
bool "Using NFS v3 client file system"
179+
depends on RT_USING_LWIP
180+
default n
181+
182+
if RT_USING_DFS_NFS
183+
config RT_NFS_HOST_EXPORT
184+
string "NFSv3 host export"
185+
default "192.168.1.5:/"
186+
endif
187+
endif
49188

50189
endif
51190

components/dfs/dfs_v1/Kconfig

Lines changed: 0 additions & 138 deletions
This file was deleted.

components/dfs/dfs_v1/include/dfs_file.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ struct dfs_mmap2_args
7676
};
7777

7878
void dfs_vnode_mgr_init(void);
79+
int dfs_vnode_init(struct dfs_vnode *vnode, int type, const struct dfs_file_ops *fops);
80+
7981
int dfs_file_is_open(const char *pathname);
8082
int dfs_file_open(struct dfs_file *fd, const char *path, int flags);
8183
int dfs_file_close(struct dfs_file *fd);

components/dfs/dfs_v1/src/dfs_file.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,20 @@ void dfs_vnode_mgr_init(void)
4747
}
4848
}
4949

50+
int dfs_vnode_init(struct dfs_vnode *vnode, int type, const struct dfs_file_ops *fops)
51+
{
52+
if (vnode)
53+
{
54+
rt_memset(vnode, 0, sizeof(struct dfs_vnode));
55+
vnode->type = type;
56+
vnode->fops = fops;
57+
58+
rt_list_init(&(vnode->list));
59+
vnode->ref_count = 1;
60+
}
61+
return 0;
62+
}
63+
5064
/* BKDR Hash Function */
5165
static unsigned int bkdr_hash(const char *str)
5266
{

components/dfs/dfs_v2/Kconfig

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)