[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:
@@ -137,9 +137,9 @@ void animation_manager_check_blocking_process(AnimationManager* animation_manage
|
||||
bool blocked = animation_manager_check_blocking(animation_manager);
|
||||
|
||||
if(!blocked) {
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
const StorageAnimationManifestInfo* manifest_info =
|
||||
animation_storage_get_meta(animation_manager->current_animation);
|
||||
@@ -170,9 +170,9 @@ bool animation_manager_interact_process(AnimationManager* animation_manager) {
|
||||
animation_manager->levelup_pending = false;
|
||||
animation_manager->levelup_active = true;
|
||||
animation_manager_switch_to_one_shot_view(animation_manager);
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
dolphin_upgrade_level(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
} else if(animation_manager->levelup_active) {
|
||||
animation_manager->levelup_active = false;
|
||||
animation_manager_start_new_idle(animation_manager);
|
||||
@@ -205,7 +205,7 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
|
||||
furi_assert(animation_manager);
|
||||
|
||||
StorageAnimation* blocking_animation = NULL;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FS_Error sd_status = storage_sd_status(storage);
|
||||
|
||||
if(sd_status == FSE_INTERNAL) {
|
||||
@@ -220,7 +220,7 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
|
||||
furi_assert(blocking_animation);
|
||||
animation_manager->sd_shown_sd_ok = true;
|
||||
} else if(!animation_manager->sd_shown_no_db) {
|
||||
bool db_exists = storage_common_stat(storage, "/ext/Manifest", NULL) == FSE_OK;
|
||||
bool db_exists = storage_common_stat(storage, EXT_PATH("Manifest"), NULL) == FSE_OK;
|
||||
if(!db_exists) {
|
||||
blocking_animation = animation_storage_find_animation(NO_DB_ANIMATION_NAME);
|
||||
furi_assert(blocking_animation);
|
||||
@@ -234,9 +234,9 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
|
||||
}
|
||||
}
|
||||
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
if(!blocking_animation && stats.level_up_is_pending) {
|
||||
blocking_animation = animation_storage_find_animation(NEW_MAIL_ANIMATION_NAME);
|
||||
furi_assert(blocking_animation);
|
||||
@@ -252,7 +252,7 @@ static bool animation_manager_check_blocking(AnimationManager* animation_manager
|
||||
animation_manager->state = AnimationManagerStateBlocked;
|
||||
}
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return !!blocking_animation;
|
||||
}
|
||||
@@ -287,15 +287,15 @@ AnimationManager* animation_manager_alloc(void) {
|
||||
bubble_animation_view_set_interact_callback(
|
||||
animation_manager->animation_view, animation_manager_interact_callback, animation_manager);
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
animation_manager->pubsub_subscription_storage = furi_pubsub_subscribe(
|
||||
storage_get_pubsub(storage), animation_manager_check_blocking_callback, animation_manager);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
animation_manager->pubsub_subscription_dolphin = furi_pubsub_subscribe(
|
||||
dolphin_get_pubsub(dolphin), animation_manager_check_blocking_callback, animation_manager);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
animation_manager->sd_shown_sd_ok = true;
|
||||
if(!animation_manager_check_blocking(animation_manager)) {
|
||||
@@ -308,15 +308,15 @@ AnimationManager* animation_manager_alloc(void) {
|
||||
void animation_manager_free(AnimationManager* animation_manager) {
|
||||
furi_assert(animation_manager);
|
||||
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
furi_pubsub_unsubscribe(
|
||||
dolphin_get_pubsub(dolphin), animation_manager->pubsub_subscription_dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
furi_pubsub_unsubscribe(
|
||||
storage_get_pubsub(storage), animation_manager->pubsub_subscription_storage);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
string_clear(animation_manager->freezed_animation_name);
|
||||
View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
|
||||
@@ -340,16 +340,16 @@ static bool animation_manager_is_valid_idle_animation(
|
||||
bool result = true;
|
||||
|
||||
if(!strcmp(info->name, BAD_BATTERY_ANIMATION_NAME)) {
|
||||
Power* power = furi_record_open("power");
|
||||
Power* power = furi_record_open(RECORD_POWER);
|
||||
bool battery_is_well = power_is_battery_healthy(power);
|
||||
furi_record_close("power");
|
||||
furi_record_close(RECORD_POWER);
|
||||
|
||||
result = !battery_is_well;
|
||||
}
|
||||
if(!strcmp(info->name, NO_SD_ANIMATION_NAME)) {
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FS_Error sd_status = storage_sd_status(storage);
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
result = (sd_status == FSE_NOT_READY);
|
||||
}
|
||||
@@ -370,9 +370,9 @@ static StorageAnimation*
|
||||
StorageAnimationList_init(animation_list);
|
||||
animation_storage_fill_animation_list(&animation_list);
|
||||
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
uint32_t whole_weight = 0;
|
||||
|
||||
StorageAnimationList_it_t it;
|
||||
@@ -492,9 +492,9 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
||||
StorageAnimation* restore_animation = animation_storage_find_animation(
|
||||
string_get_cstr(animation_manager->freezed_animation_name));
|
||||
if(restore_animation) {
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
const StorageAnimationManifestInfo* manifest_info =
|
||||
animation_storage_get_meta(restore_animation);
|
||||
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
|
||||
@@ -543,9 +543,9 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
||||
static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager) {
|
||||
furi_assert(animation_manager);
|
||||
furi_assert(!animation_manager->one_shot_view);
|
||||
Dolphin* dolphin = furi_record_open("dolphin");
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
furi_record_close("dolphin");
|
||||
furi_record_close(RECORD_DOLPHIN);
|
||||
|
||||
animation_manager->one_shot_view = one_shot_view_alloc();
|
||||
one_shot_view_set_interact_callback(
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#include <assets_dolphin_blocking.h>
|
||||
|
||||
#define ANIMATION_META_FILE "meta.txt"
|
||||
#define ANIMATION_DIR "/ext/dolphin"
|
||||
#define ANIMATION_DIR EXT_PATH("dolphin")
|
||||
#define ANIMATION_MANIFEST_FILE ANIMATION_DIR "/manifest.txt"
|
||||
#define TAG "AnimationStorage"
|
||||
|
||||
@@ -29,7 +29,7 @@ static bool animation_storage_load_single_manifest_info(
|
||||
furi_assert(manifest_info);
|
||||
|
||||
bool result = false;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
flipper_format_set_strict_mode(file, true);
|
||||
string_t read_string;
|
||||
@@ -75,7 +75,7 @@ static bool animation_storage_load_single_manifest_info(
|
||||
string_clear(read_string);
|
||||
flipper_format_free(file);
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
|
||||
furi_assert(sizeof(StorageAnimationList_t) == sizeof(void*));
|
||||
furi_assert(!StorageAnimationList_size(*animation_list));
|
||||
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* file = flipper_format_file_alloc(storage);
|
||||
/* Forbid skipping fields */
|
||||
flipper_format_set_strict_mode(file, true);
|
||||
@@ -134,7 +134,7 @@ void animation_storage_fill_animation_list(StorageAnimationList_t* animation_lis
|
||||
StorageAnimationList_push_back(*animation_list, (StorageAnimation*)&dolphin_internal[i]);
|
||||
}
|
||||
|
||||
furi_record_close("storage");
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
}
|
||||
|
||||
StorageAnimation* animation_storage_find_animation(const char* name) {
|
||||
@@ -434,7 +434,7 @@ static BubbleAnimation* animation_storage_load_animation(const char* name) {
|
||||
uint32_t height = 0;
|
||||
uint32_t width = 0;
|
||||
uint32_t* u32array = NULL;
|
||||
Storage* storage = furi_record_open("storage");
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
FlipperFormat* ff = flipper_format_file_alloc(storage);
|
||||
/* Forbid skipping fields */
|
||||
flipper_format_set_strict_mode(ff, true);
|
||||
|
Reference in New Issue
Block a user