Skip to content

Commit 3531fa7

Browse files
committed
romfs: declare the dummy entry as weak
1 parent 6281ab2 commit 3531fa7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

components/dfs/filesystems/romfs/dfs_romfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct romfs_dirent *dfs_romfs_lookup(struct romfs_dirent *root_dirent, const ch
5656
struct romfs_dirent *dirent;
5757
rt_size_t dirent_size;
5858

59-
if (path[0] == '/' && path[1] == '\0')
59+
if (path[0] == '/' && path[1] == '\0')
6060
{
6161
*size = root_dirent->size;
6262
return root_dirent;
@@ -78,7 +78,7 @@ struct romfs_dirent *dfs_romfs_lookup(struct romfs_dirent *root_dirent, const ch
7878
while (dirent != RT_NULL)
7979
{
8080
found = 0;
81-
81+
8282
/* search in folder */
8383
for (index = 0; index < dirent_size; index ++)
8484
{
@@ -106,12 +106,12 @@ struct romfs_dirent *dfs_romfs_lookup(struct romfs_dirent *root_dirent, const ch
106106
found = 1;
107107
break;
108108
}
109-
else
109+
else
110110
{
111111
/* return file dirent */
112112
if (subpath != RT_NULL)
113113
break; /* not the end of path */
114-
114+
115115
return &dirent[index];
116116
}
117117
}

components/dfs/filesystems/romfs/romfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Date Author Notes
2222
*/
2323

24+
#include <rtthread.h>
2425
#include <dfs_romfs.h>
2526

2627
const static unsigned char _dummy_dummy_txt[] =
@@ -38,13 +39,13 @@ const static unsigned char _dummy_txt[] =
3839
0x74,0x68,0x69,0x73,0x20,0x69,0x73,0x20,0x61,0x20,0x66,0x69,0x6c,0x65,0x21,0x0d,0x0a,
3940
};
4041

41-
const struct romfs_dirent _root_dirent[] =
42+
const struct romfs_dirent WEAK _root_dirent[] =
4243
{
4344
{ROMFS_DIRENT_DIR, "dummy", (rt_uint8_t *)_dummy, sizeof(_dummy)/sizeof(_dummy[0])},
4445
{ROMFS_DIRENT_FILE, "dummy.txt", _dummy_txt, sizeof(_dummy_txt)},
4546
};
4647

47-
const struct romfs_dirent romfs_root =
48+
const struct romfs_dirent WEAK romfs_root =
4849
{
4950
ROMFS_DIRENT_DIR, "/", (rt_uint8_t *)_root_dirent, sizeof(_root_dirent)/sizeof(_root_dirent[0])
5051
};

0 commit comments

Comments
 (0)