[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

@@ -39,12 +39,12 @@ Picopass* picopass_alloc() {
picopass->dev = picopass_device_alloc();
// Open GUI record
picopass->gui = furi_record_open("gui");
picopass->gui = furi_record_open(RECORD_GUI);
view_dispatcher_attach_to_gui(
picopass->view_dispatcher, picopass->gui, ViewDispatcherTypeFullscreen);
// Open Notification record
picopass->notifications = furi_record_open("notification");
picopass->notifications = furi_record_open(RECORD_NOTIFICATION);
// Submenu
picopass->submenu = submenu_alloc();
@@ -105,11 +105,11 @@ void picopass_free(Picopass* picopass) {
scene_manager_free(picopass->scene_manager);
// GUI
furi_record_close("gui");
furi_record_close(RECORD_GUI);
picopass->gui = NULL;
// Notifications
furi_record_close("notification");
furi_record_close(RECORD_NOTIFICATION);
picopass->notifications = NULL;
free(picopass);

View File

@@ -13,8 +13,8 @@ PicopassDevice* picopass_device_alloc() {
picopass_dev->dev_data.pacs.legacy = false;
picopass_dev->dev_data.pacs.se_enabled = false;
picopass_dev->dev_data.pacs.pin_length = 0;
picopass_dev->storage = furi_record_open("storage");
picopass_dev->dialogs = furi_record_open("dialogs");
picopass_dev->storage = furi_record_open(RECORD_STORAGE);
picopass_dev->dialogs = furi_record_open(RECORD_DIALOGS);
return picopass_dev;
}
@@ -123,7 +123,7 @@ bool picopass_device_save(PicopassDevice* dev, const char* dev_name) {
return picopass_device_save_file(
dev, dev_name, PICOPASS_APP_FOLDER, PICOPASS_APP_EXTENSION, true);
} else if(dev->format == PicopassDeviceSaveFormatLF) {
return picopass_device_save_file(dev, dev_name, "/any/lfrfid", ".rfid", true);
return picopass_device_save_file(dev, dev_name, ANY_PATH("lfrfid"), ".rfid", true);
}
return false;
}
@@ -138,8 +138,8 @@ void picopass_device_clear(PicopassDevice* dev) {
void picopass_device_free(PicopassDevice* picopass_dev) {
furi_assert(picopass_dev);
picopass_device_clear(picopass_dev);
furi_record_close("storage");
furi_record_close("dialogs");
furi_record_close(RECORD_STORAGE);
furi_record_close(RECORD_DIALOGS);
string_clear(picopass_dev->load_path);
free(picopass_dev);
}

View File

@@ -16,7 +16,7 @@
#define PICOPASS_CONFIG_BLOCK_INDEX 1
#define PICOPASS_AIA_BLOCK_INDEX 5
#define PICOPASS_APP_FOLDER "/any/picopass"
#define PICOPASS_APP_FOLDER ANY_PATH("picopass")
#define PICOPASS_APP_EXTENSION ".picopass"
#define PICOPASS_APP_SHADOW_EXTENSION ".pas"

View File

@@ -83,7 +83,7 @@ PicopassWorker* picopass_worker_alloc() {
picopass_worker->callback = NULL;
picopass_worker->context = NULL;
picopass_worker->storage = furi_record_open("storage");
picopass_worker->storage = furi_record_open(RECORD_STORAGE);
picopass_worker_change_state(picopass_worker, PicopassWorkerStateReady);
@@ -95,7 +95,7 @@ void picopass_worker_free(PicopassWorker* picopass_worker) {
furi_thread_free(picopass_worker->thread);
furi_record_close("storage");
furi_record_close(RECORD_STORAGE);
free(picopass_worker);
}