From 680d158f59ef199a2c62408c9dfade4d1bc6bd06 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Mon, 15 Aug 2022 17:22:48 +1000 Subject: [PATCH] AP_Filesystem: do not gate AP_CRASHDUMP_ENABLED on bootloader Also rename from HAL_CRASHDUMP_ENABLE Removes code based on define rather than creating empty functions. Makes it clearer what's going on in the callers. --- libraries/AP_Filesystem/AP_Filesystem_Sys.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/AP_Filesystem/AP_Filesystem_Sys.cpp b/libraries/AP_Filesystem/AP_Filesystem_Sys.cpp index 0d0550c8f77..dacd553f359 100644 --- a/libraries/AP_Filesystem/AP_Filesystem_Sys.cpp +++ b/libraries/AP_Filesystem/AP_Filesystem_Sys.cpp @@ -135,9 +135,11 @@ int AP_Filesystem_Sys::open(const char *fname, int flags, bool allow_absolute_pa if (strcmp(fname, "persistent.parm") == 0) { hal.util->load_persistent_params(*r.str); } +#if AP_CRASHDUMP_ENABLED if (strcmp(fname, "crash_dump.bin") == 0) { r.str->set_buffer((char*)hal.util->last_crash_dump_ptr(), hal.util->last_crash_dump_size(), hal.util->last_crash_dump_size()); - } else + } +#endif if (strcmp(fname, "storage.bin") == 0) { // we don't want to store the contents of storage.bin // we read directly from the storage driver @@ -270,8 +272,10 @@ int AP_Filesystem_Sys::stat(const char *pathname, struct stat *stbuf) // read every file for a directory listing if (strcmp(pathname_noslash, "storage.bin") == 0) { stbuf->st_size = HAL_STORAGE_SIZE; +#if AP_CRASHDUMP_ENABLED } else if (strcmp(pathname_noslash, "crash_dump.bin") == 0) { stbuf->st_size = hal.util->last_crash_dump_size(); +#endif } else { stbuf->st_size = 100000; }