Skip to content

Commit

Permalink
AP_Filesystem: small littlefs cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per committed Jan 9, 2025
1 parent 956fea0 commit 659959d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,8 @@ struct dirent *AP_Filesystem_FlashMemory_LittleFS::readdir(void *ptr)
if (retval == 0) {
/* no more entries */
return nullptr;
} else if (retval < 0) {
}
if (retval < 0) {
// failure
errno = errno_from_lfs_error(retval);
return nullptr;
Expand Down Expand Up @@ -863,13 +864,12 @@ bool AP_Filesystem_FlashMemory_LittleFS::mount_filesystem() {
}
}

#ifdef HAL_BOARD_STORAGE_DIRECTORY
// try to create the root storage folder. Ignore the error code in case
// the filesystem is corrupted or it already exists.
if (strlen(HAL_BOARD_STORAGE_DIRECTORY) > 0) {
lfs_mkdir(&fs, HAL_BOARD_STORAGE_DIRECTORY);
}
#endif

// Force garbage collection to avoid expensive operations after boot
lfs_fs_gc(&fs);
GCS_SEND_TEXT(MAV_SEVERITY_NOTICE, "Mounted flash 0x%x as littlefs", unsigned(id));
Expand Down

0 comments on commit 659959d

Please sign in to comment.