[FL-2675] /int space reservation (#1448)

* storage: added global #defines for /int, /ext & /any
* storage: introduced PATH_EXT, PATH_INT& PATH_ANY macros
* core apps: moved hardcoded config files names to separate headers; prefixed them with "."; updater: added file name migration to new naming convention on backup extraction
* storage: fixed storage_merge_recursive handling of complex directory structures; storage_move_to_sd: changed data migration logic to all non-dot files & all folders
* core: added macro aliases for core record names
* Bumped protobuf commit pointer
* storage: reserved 5 pages in /int; denying write&creation of non-dot files when running out of free space

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
hedger
2022-07-26 15:21:51 +03:00
committed by GitHub
parent 52a83fc929
commit 056446dfed
171 changed files with 1111 additions and 910 deletions

View File

@@ -87,7 +87,7 @@ bool subghz_protocol_raw_save_to_file_init(
FuriHalSubGhzPreset preset) {
furi_assert(instance);
instance->storage = furi_record_open("storage");
instance->storage = furi_record_open(RECORD_STORAGE);
instance->flipper_file = flipper_format_file_alloc(instance->storage);
string_t temp_str;
@@ -181,7 +181,7 @@ void subghz_protocol_raw_save_to_file_stop(SubGhzProtocolDecoderRAW* instance) {
instance->upload_raw = NULL;
flipper_format_file_close(instance->flipper_file);
flipper_format_free(instance->flipper_file);
furi_record_close("storage");
furi_record_close(RECORD_STORAGE);
}
instance->file_is_open = RAWFileIsOpenClose;

View File

@@ -183,7 +183,7 @@ SubGhzFileEncoderWorker* subghz_file_encoder_worker_alloc() {
furi_thread_set_callback(instance->thread, subghz_file_encoder_worker_thread);
instance->stream = xStreamBufferCreate(sizeof(int32_t) * 2048, sizeof(int32_t));
instance->storage = furi_record_open("storage");
instance->storage = furi_record_open(RECORD_STORAGE);
instance->flipper_format = flipper_format_file_alloc(instance->storage);
string_init(instance->str_data);
@@ -204,7 +204,7 @@ void subghz_file_encoder_worker_free(SubGhzFileEncoderWorker* instance) {
string_clear(instance->file_path);
flipper_format_free(instance->flipper_format);
furi_record_close("storage");
furi_record_close(RECORD_STORAGE);
free(instance);
}

View File

@@ -189,7 +189,7 @@ bool subghz_keystore_load(SubGhzKeystore* instance, const char* file_name) {
FURI_LOG_I(TAG, "Loading keystore %s", file_name);
Storage* storage = furi_record_open("storage");
Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
do {
@@ -229,7 +229,7 @@ bool subghz_keystore_load(SubGhzKeystore* instance, const char* file_name) {
} while(0);
flipper_format_free(flipper_format);
furi_record_close("storage");
furi_record_close(RECORD_STORAGE);
string_clear(filetype);
@@ -240,7 +240,7 @@ bool subghz_keystore_save(SubGhzKeystore* instance, const char* file_name, uint8
furi_assert(instance);
bool result = false;
Storage* storage = furi_record_open("storage");
Storage* storage = furi_record_open(RECORD_STORAGE);
char* decrypted_line = malloc(SUBGHZ_KEYSTORE_FILE_DECRYPTED_LINE_SIZE);
char* encrypted_line = malloc(SUBGHZ_KEYSTORE_FILE_ENCRYPTED_LINE_SIZE);
@@ -326,7 +326,7 @@ bool subghz_keystore_save(SubGhzKeystore* instance, const char* file_name, uint8
free(encrypted_line);
free(decrypted_line);
furi_record_close("storage");
furi_record_close(RECORD_STORAGE);
return result;
}
@@ -346,7 +346,7 @@ bool subghz_keystore_raw_encrypted_save(
string_init(filetype);
SubGhzKeystoreEncryption encryption;
Storage* storage = furi_record_open("storage");
Storage* storage = furi_record_open(RECORD_STORAGE);
char* encrypted_line = malloc(SUBGHZ_KEYSTORE_FILE_ENCRYPTED_LINE_SIZE);
@@ -470,7 +470,7 @@ bool subghz_keystore_raw_encrypted_save(
free(encrypted_line);
furi_record_close("storage");
furi_record_close(RECORD_STORAGE);
return encrypted;
}
@@ -484,7 +484,7 @@ bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t*
string_t str_temp;
string_init(str_temp);
Storage* storage = furi_record_open("storage");
Storage* storage = furi_record_open(RECORD_STORAGE);
char* decrypted_line = malloc(SUBGHZ_KEYSTORE_FILE_DECRYPTED_LINE_SIZE);
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
@@ -594,7 +594,7 @@ bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t*
} while(0);
flipper_format_free(flipper_format);
furi_record_close("storage");
furi_record_close(RECORD_STORAGE);
free(decrypted_line);

View File

@@ -11,8 +11,8 @@
#include <furi.h>
#include <furi_hal.h>
#define SUBGHZ_APP_FOLDER "/any/subghz"
#define SUBGHZ_RAW_FOLDER "/ext/subghz"
#define SUBGHZ_APP_FOLDER ANY_PATH("subghz")
#define SUBGHZ_RAW_FOLDER EXT_PATH("subghz")
#define SUBGHZ_APP_EXTENSION ".sub"
#define SUBGHZ_KEY_FILE_VERSION 1