mirror of
https://github.com/flipperdevices/flipperzero-firmware.git
synced 2025-12-12 20:59:50 +04:00
[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:
@@ -2,7 +2,36 @@
|
||||
|
||||
#include <toolbox/tar/tar_archive.h>
|
||||
|
||||
#define LFS_BACKUP_DEFAULT_LOCATION "/ext/" LFS_BACKUP_DEFAULT_FILENAME
|
||||
#include <bt/bt_settings_filename.h>
|
||||
#include <bt/bt_service/bt_keys_filename.h>
|
||||
#include <dolphin/helpers/dolphin_state_filename.h>
|
||||
#include <desktop/helpers/slideshow_filename.h>
|
||||
#include <desktop/desktop_settings/desktop_settings_filename.h>
|
||||
#include <notification/notification_settings_filename.h>
|
||||
|
||||
#define LFS_BACKUP_DEFAULT_LOCATION EXT_PATH(LFS_BACKUP_DEFAULT_FILENAME)
|
||||
|
||||
static void backup_name_converter(string_t filename) {
|
||||
if(string_empty_p(filename) || (string_get_char(filename, 0) == '.')) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Filenames are already prefixed with '.' */
|
||||
const char* const names[] = {
|
||||
BT_SETTINGS_FILE_NAME,
|
||||
BT_KEYS_STORAGE_FILE_NAME,
|
||||
DESKTOP_SETTINGS_FILE_NAME,
|
||||
NOTIFICATION_SETTINGS_FILE_NAME,
|
||||
SLIDESHOW_FILE_NAME,
|
||||
};
|
||||
|
||||
for(size_t i = 0; i < COUNT_OF(names); i++) {
|
||||
if(string_equal_str_p(filename, &names[i][1])) {
|
||||
string_set_str(filename, names[i]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool lfs_backup_create(Storage* storage, const char* destination) {
|
||||
const char* final_destination =
|
||||
@@ -18,5 +47,5 @@ bool lfs_backup_exists(Storage* storage, const char* source) {
|
||||
|
||||
bool lfs_backup_unpack(Storage* storage, const char* source) {
|
||||
const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION;
|
||||
return storage_int_restore(storage, final_source) == FSE_OK;
|
||||
return storage_int_restore(storage, final_source, backup_name_converter) == FSE_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user