@@ -86,7 +86,7 @@ static void make_sample_code_file(FATFS *fatfs) {
86
86
87
87
// we don't make this function static because it needs a lot of stack and we
88
88
// want it to be executed without using stack within main() function
89
- void filesystem_init (bool create_allowed , bool force_create ) {
89
+ bool filesystem_init (bool create_allowed , bool force_create ) {
90
90
// init the vfs object
91
91
fs_user_mount_t * vfs_fat = & _internal_vfs ;
92
92
vfs_fat -> blockdev .flags = 0 ;
@@ -102,11 +102,11 @@ void filesystem_init(bool create_allowed, bool force_create) {
102
102
formats |= FM_EXFAT | FM_FAT32 ;
103
103
#endif
104
104
res = f_mkfs (& vfs_fat -> fatfs , formats , 0 , working_buf , sizeof (working_buf ));
105
- // Flush the new file system to make sure it's repaired immediately.
106
- supervisor_flash_flush ();
107
105
if (res != FR_OK ) {
108
- return ;
106
+ return false ;
109
107
}
108
+ // Flush the new file system to make sure it's repaired immediately.
109
+ supervisor_flash_flush ();
110
110
111
111
// set label
112
112
#ifdef CIRCUITPY_DRIVE_LABEL
@@ -115,13 +115,13 @@ void filesystem_init(bool create_allowed, bool force_create) {
115
115
res = f_setlabel (& vfs_fat -> fatfs , "CIRCUITPY" );
116
116
#endif
117
117
if (res != FR_OK ) {
118
- return ;
118
+ return false ;
119
119
}
120
120
121
121
// inhibit file indexing on MacOS
122
122
res = f_mkdir (& vfs_fat -> fatfs , "/.fseventsd" );
123
123
if (res != FR_OK ) {
124
- return ;
124
+ return false ;
125
125
}
126
126
make_empty_file (& vfs_fat -> fatfs , "/.metadata_never_index" );
127
127
make_empty_file (& vfs_fat -> fatfs , "/.Trashes" );
@@ -132,13 +132,13 @@ void filesystem_init(bool create_allowed, bool force_create) {
132
132
// create empty lib directory
133
133
res = f_mkdir (& vfs_fat -> fatfs , "/lib" );
134
134
if (res != FR_OK ) {
135
- return ;
135
+ return false ;
136
136
}
137
137
138
138
// and ensure everything is flushed
139
139
supervisor_flash_flush ();
140
140
} else if (res != FR_OK ) {
141
- return ;
141
+ return false ;
142
142
}
143
143
mp_vfs_mount_t * vfs = & _mp_vfs ;
144
144
vfs -> str = "/" ;
@@ -150,6 +150,8 @@ void filesystem_init(bool create_allowed, bool force_create) {
150
150
// The current directory is used as the boot up directory.
151
151
// It is set to the internal flash filesystem by default.
152
152
MP_STATE_PORT (vfs_cur ) = vfs ;
153
+
154
+ return true;
153
155
}
154
156
155
157
void filesystem_flush (void ) {
0 commit comments