Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/flipperzero-firmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhedger <hedger@users.noreply.github.com>2022-07-26 15:21:51 +0300
committerGitHub <noreply@github.com>2022-07-26 15:21:51 +0300
commit056446dfed68931b9997cd3d7600f655809243c4 (patch)
treeb8f046bed79ee973388438fffc6272e5ecfe3213
parent52a83fc929f125d24136e017661c671d21caac17 (diff)
[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>
-rw-r--r--applications/about/about.c8
-rw-r--r--applications/archive/archive.c4
-rw-r--r--applications/archive/helpers/archive_apps.c17
-rw-r--r--applications/archive/helpers/archive_browser.c6
-rw-r--r--applications/archive/helpers/archive_browser.h15
-rw-r--r--applications/archive/helpers/archive_favorites.c28
-rw-r--r--applications/archive/helpers/archive_favorites.h4
-rw-r--r--applications/archive/helpers/archive_files.c8
-rw-r--r--applications/archive/scenes/archive_scene_browser.c16
-rw-r--r--applications/archive/scenes/archive_scene_rename.c4
-rw-r--r--applications/bad_usb/bad_usb_app.c12
-rw-r--r--applications/bad_usb/bad_usb_app_i.h2
-rw-r--r--applications/bad_usb/bad_usb_script.c2
-rw-r--r--applications/bt/bt_cli.c26
-rw-r--r--applications/bt/bt_debug_app/bt_debug_app.c6
-rwxr-xr-xapplications/bt/bt_hid_app/bt_hid.c12
-rw-r--r--applications/bt/bt_service/bt.c14
-rw-r--r--applications/bt/bt_service/bt.h2
-rw-r--r--applications/bt/bt_service/bt_keys_filename.h3
-rw-r--r--applications/bt/bt_service/bt_keys_storage.c3
-rw-r--r--applications/bt/bt_service/bt_keys_storage.h1
-rw-r--r--applications/bt/bt_settings.c3
-rw-r--r--applications/bt/bt_settings.h2
-rwxr-xr-xapplications/bt/bt_settings_app/bt_settings_app.c8
-rw-r--r--applications/bt/bt_settings_filename.h3
-rw-r--r--applications/cli/cli.c6
-rw-r--r--applications/cli/cli.h2
-rw-r--r--applications/cli/cli_commands.c12
-rw-r--r--applications/crypto/crypto_cli.c4
-rw-r--r--applications/debug_tools/blink_test.c8
-rw-r--r--applications/debug_tools/display_test/display_test.c4
-rw-r--r--applications/debug_tools/file_browser_test/file_browser_app.c10
-rw-r--r--applications/debug_tools/file_browser_test/scenes/file_browser_scene_start.c8
-rw-r--r--applications/debug_tools/keypad_test.c4
-rw-r--r--applications/debug_tools/text_box_test.c4
-rw-r--r--applications/debug_tools/uart_echo.c8
-rw-r--r--applications/debug_tools/usb_mouse.c2
-rw-r--r--applications/debug_tools/usb_test.c4
-rw-r--r--applications/debug_tools/vibro_test.c8
-rw-r--r--applications/desktop/animations/animation_manager.c54
-rw-r--r--applications/desktop/animations/animation_storage.c12
-rw-r--r--applications/desktop/desktop.c27
-rw-r--r--applications/desktop/desktop_settings/desktop_settings.h6
-rw-r--r--applications/desktop/desktop_settings/desktop_settings_app.c4
-rw-r--r--applications/desktop/desktop_settings/desktop_settings_filename.h3
-rw-r--r--applications/desktop/desktop_settings/scenes/desktop_settings_scene_pin_setup_done.c4
-rw-r--r--applications/desktop/helpers/pin_lock.c16
-rw-r--r--applications/desktop/helpers/slideshow.c4
-rw-r--r--applications/desktop/helpers/slideshow_filename.h3
-rw-r--r--applications/desktop/scenes/desktop_scene_debug.c4
-rw-r--r--applications/desktop/scenes/desktop_scene_locked.c4
-rw-r--r--applications/desktop/scenes/desktop_scene_pin_input.c4
-rw-r--r--applications/desktop/scenes/desktop_scene_slideshow.c6
-rw-r--r--applications/desktop/views/desktop_view_debug.c8
-rw-r--r--applications/desktop/views/desktop_view_slideshow.c3
-rw-r--r--applications/desktop/views/desktop_view_slideshow.h3
-rw-r--r--applications/dialogs/dialogs.c2
-rw-r--r--applications/dialogs/dialogs.h2
-rw-r--r--applications/dialogs/dialogs_module_file_browser.c4
-rw-r--r--applications/dialogs/dialogs_module_message.c4
-rw-r--r--applications/dolphin/dolphin.c2
-rw-r--r--applications/dolphin/dolphin.h2
-rw-r--r--applications/dolphin/helpers/dolphin_state.c5
-rw-r--r--applications/dolphin/helpers/dolphin_state_filename.h3
-rw-r--r--applications/dolphin/passport/passport.c8
-rw-r--r--applications/gpio/gpio_app.c8
-rw-r--r--applications/gpio/usb_uart_bridge.c16
-rw-r--r--applications/gui/gui.c4
-rw-r--r--applications/gui/gui.h2
-rw-r--r--applications/gui/modules/file_browser_worker.c18
-rw-r--r--applications/gui/modules/validators.c4
-rw-r--r--applications/ibutton/ibutton.c16
-rw-r--r--applications/ibutton/ibutton_cli.c4
-rw-r--r--applications/ibutton/ibutton_i.h2
-rw-r--r--applications/infrared/infrared.c24
-rw-r--r--applications/infrared/infrared_brute_force.c10
-rw-r--r--applications/infrared/infrared_cli.c4
-rw-r--r--applications/infrared/infrared_i.h2
-rw-r--r--applications/infrared/infrared_remote.c12
-rw-r--r--applications/infrared/scenes/infrared_scene_universal_tv.c2
-rw-r--r--applications/input/input.c4
-rw-r--r--applications/input/input.h2
-rw-r--r--applications/lfrfid/lfrfid_app.cpp2
-rw-r--r--applications/loader/loader.c15
-rw-r--r--applications/loader/loader.h2
-rw-r--r--applications/music_player/music_player.c19
-rw-r--r--applications/music_player/music_player_cli.c8
-rw-r--r--applications/music_player/music_player_worker.c8
-rw-r--r--applications/nfc/helpers/nfc_debug_pcap.c2
-rwxr-xr-xapplications/nfc/helpers/nfc_emv_parser.c7
-rw-r--r--applications/nfc/helpers/nfc_mf_classic_dict.c2
-rw-r--r--applications/nfc/nfc.c8
-rwxr-xr-xapplications/nfc/nfc_cli.c4
-rw-r--r--applications/nfc/nfc_device.c8
-rw-r--r--applications/nfc/nfc_device.h2
-rw-r--r--applications/nfc/nfc_worker.c4
-rw-r--r--applications/notification/notification.h2
-rw-r--r--applications/notification/notification_app.c12
-rw-r--r--applications/notification/notification_app.h3
-rw-r--r--applications/notification/notification_settings_app.c8
-rw-r--r--applications/notification/notification_settings_filename.h3
-rw-r--r--applications/picopass/picopass.c8
-rw-r--r--applications/picopass/picopass_device.c10
-rw-r--r--applications/picopass/picopass_device.h2
-rw-r--r--applications/picopass/picopass_worker.c4
-rwxr-xr-xapplications/power/battery_test_app/battery_test_app.c12
-rw-r--r--applications/power/power_cli.c6
-rw-r--r--applications/power/power_service/power.c10
-rw-r--r--applications/power/power_service/power.h2
-rw-r--r--applications/power/power_settings_app/power_settings_app.c8
-rw-r--r--applications/rpc/rpc.c4
-rw-r--r--applications/rpc/rpc.h2
-rw-r--r--applications/rpc/rpc_app.c8
-rw-r--r--applications/rpc/rpc_gui.c8
-rw-r--r--applications/rpc/rpc_storage.c46
-rw-r--r--applications/rpc/rpc_system.c4
-rw-r--r--applications/snake_game/snake_game.c4
-rw-r--r--applications/storage/storage.c8
-rw-r--r--applications/storage/storage.h15
-rw-r--r--applications/storage/storage_cli.c82
-rw-r--r--applications/storage/storage_external_api.c26
-rw-r--r--applications/storage/storage_internal_api.c9
-rw-r--r--applications/storage/storage_processing.c34
-rw-r--r--applications/storage/storage_test_app.c32
-rw-r--r--applications/storage/storages/storage_ext.c22
-rw-r--r--applications/storage/storages/storage_int.c41
-rw-r--r--applications/storage_move_to_sd/application.fam3
-rw-r--r--applications/storage_move_to_sd/storage_move_to_sd.c114
-rw-r--r--applications/storage_settings/scenes/storage_settings_scene_benchmark.c2
-rw-r--r--applications/storage_settings/scenes/storage_settings_scene_internal_info.c3
-rw-r--r--applications/storage_settings/storage_settings.c12
-rw-r--r--applications/subghz/subghz.c22
-rw-r--r--applications/subghz/subghz_cli.c31
-rw-r--r--applications/subghz/subghz_i.c20
-rw-r--r--applications/subghz/subghz_setting.c4
-rw-r--r--applications/subghz/views/subghz_test_static.c4
-rw-r--r--applications/system/system_settings.c4
-rw-r--r--applications/u2f/u2f_app.c8
-rw-r--r--applications/u2f/u2f_data.c38
-rw-r--r--applications/unit_tests/flipper_format/flipper_format_string_test.c6
-rw-r--r--applications/unit_tests/flipper_format/flipper_format_test.c50
-rw-r--r--applications/unit_tests/infrared/infrared_test.c6
-rw-r--r--applications/unit_tests/nfc/nfc_test.c6
-rw-r--r--applications/unit_tests/rpc/rpc_test.c77
-rw-r--r--applications/unit_tests/storage/dirwalk_test.c20
-rw-r--r--applications/unit_tests/storage/storage_test.c82
-rw-r--r--applications/unit_tests/stream/stream_test.c32
-rw-r--r--applications/unit_tests/subghz/subghz_test.c91
-rw-r--r--applications/unit_tests/test_index.c12
-rw-r--r--applications/updater/cli/updater_cli.c16
-rw-r--r--applications/updater/updater.c14
-rw-r--r--applications/updater/util/update_task.c4
-rw-r--r--applications/updater/util/update_task_worker_backup.c13
-rw-r--r--firmware/targets/f7/Src/update.c7
-rw-r--r--lib/flipper_format/flipper_format.h4
-rw-r--r--lib/infrared/worker/infrared_worker.c4
-rw-r--r--lib/subghz/protocols/raw.c4
-rw-r--r--lib/subghz/subghz_file_encoder_worker.c4
-rw-r--r--lib/subghz/subghz_keystore.c16
-rw-r--r--lib/subghz/types.h4
-rw-r--r--lib/toolbox/dir_walk.c2
-rw-r--r--lib/toolbox/path.c2
-rw-r--r--lib/toolbox/saved_struct.c8
-rw-r--r--lib/toolbox/stream/file_stream.c5
-rw-r--r--lib/toolbox/tar/tar_archive.c44
-rw-r--r--lib/toolbox/tar/tar_archive.h7
-rw-r--r--lib/update_util/lfs_backup.c33
-rw-r--r--lib/update_util/update_manifest.c4
-rw-r--r--lib/update_util/update_manifest.h3
-rw-r--r--lib/update_util/update_operation.c24
-rw-r--r--site_scons/site_tools/fbt_apps.py2
171 files changed, 1111 insertions, 910 deletions
diff --git a/applications/about/about.c b/applications/about/about.c
index 4d12ed02..26738fe0 100644
--- a/applications/about/about.c
+++ b/applications/about/about.c
@@ -156,10 +156,10 @@ const size_t about_screens_count = sizeof(about_screens) / sizeof(AboutDialogScr
int32_t about_settings_app(void* p) {
UNUSED(p);
- DialogsApp* dialogs = furi_record_open("dialogs");
+ DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
DialogMessage* message = dialog_message_alloc();
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
ViewDispatcher* view_dispatcher = view_dispatcher_alloc();
EmptyScreen* empty_screen = empty_screen_alloc();
const uint32_t empty_screen_index = 0;
@@ -198,12 +198,12 @@ int32_t about_settings_app(void* p) {
}
dialog_message_free(message);
- furi_record_close("dialogs");
+ furi_record_close(RECORD_DIALOGS);
view_dispatcher_remove_view(view_dispatcher, empty_screen_index);
view_dispatcher_free(view_dispatcher);
empty_screen_free(empty_screen);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
return 0;
} \ No newline at end of file
diff --git a/applications/archive/archive.c b/applications/archive/archive.c
index 99b9bb02..bbe532c8 100644
--- a/applications/archive/archive.c
+++ b/applications/archive/archive.c
@@ -16,7 +16,7 @@ bool archive_back_event_callback(void* context) {
ArchiveApp* archive_alloc() {
ArchiveApp* archive = malloc(sizeof(ArchiveApp));
- archive->gui = furi_record_open("gui");
+ archive->gui = furi_record_open(RECORD_GUI);
archive->text_input = text_input_alloc();
string_init(archive->fav_move_str);
@@ -62,7 +62,7 @@ void archive_free(ArchiveApp* archive) {
text_input_free(archive->text_input);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
archive->gui = NULL;
free(archive);
diff --git a/applications/archive/helpers/archive_apps.c b/applications/archive/helpers/archive_apps.c
index 3393993d..9a3f825f 100644
--- a/applications/archive/helpers/archive_apps.c
+++ b/applications/archive/helpers/archive_apps.c
@@ -29,21 +29,22 @@ bool archive_app_is_available(void* context, const char* path) {
if(app == ArchiveAppTypeU2f) {
bool file_exists = false;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
- file_exists = storage_file_open(file, "/any/u2f/key.u2f", FSAM_READ, FSOM_OPEN_EXISTING);
+ file_exists =
+ storage_file_open(file, ANY_PATH("u2f/key.u2f"), FSAM_READ, FSOM_OPEN_EXISTING);
if(file_exists) {
storage_file_close(file);
file_exists =
- storage_file_open(file, "/any/u2f/cnt.u2f", FSAM_READ, FSOM_OPEN_EXISTING);
+ storage_file_open(file, ANY_PATH("u2f/cnt.u2f"), FSAM_READ, FSOM_OPEN_EXISTING);
if(file_exists) {
storage_file_close(file);
}
}
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return file_exists;
} else {
@@ -77,10 +78,10 @@ void archive_app_delete_file(void* context, const char* path) {
bool res = false;
if(app == ArchiveAppTypeU2f) {
- Storage* fs_api = furi_record_open("storage");
- res = (storage_common_remove(fs_api, "/any/u2f/key.u2f") == FSE_OK);
- res |= (storage_common_remove(fs_api, "/any/u2f/cnt.u2f") == FSE_OK);
- furi_record_close("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
+ res = (storage_common_remove(fs_api, ANY_PATH("u2f/key.u2f")) == FSE_OK);
+ res |= (storage_common_remove(fs_api, ANY_PATH("u2f/cnt.u2f")) == FSE_OK);
+ furi_record_close(RECORD_STORAGE);
if(archive_is_favorite("/app:u2f/U2F Token")) {
archive_favorites_delete("/app:u2f/U2F Token");
diff --git a/applications/archive/helpers/archive_browser.c b/applications/archive/helpers/archive_browser.c
index 28284136..54759dad 100644
--- a/applications/archive/helpers/archive_browser.c
+++ b/applications/archive/helpers/archive_browser.c
@@ -391,18 +391,18 @@ void archive_favorites_move_mode(ArchiveBrowserView* browser, bool active) {
}
static bool archive_is_dir_exists(string_t path) {
- if(string_equal_str_p(path, "/any")) {
+ if(string_equal_str_p(path, STORAGE_ANY_PATH_PREFIX)) {
return true;
}
bool state = false;
FileInfo file_info;
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_common_stat(storage, string_get_cstr(path), &file_info) == FSE_OK) {
if(file_info.flags & FSF_DIRECTORY) {
state = true;
}
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return state;
}
diff --git a/applications/archive/helpers/archive_browser.h b/applications/archive/helpers/archive_browser.h
index c4283123..d6c79817 100644
--- a/applications/archive/helpers/archive_browser.h
+++ b/applications/archive/helpers/archive_browser.h
@@ -1,6 +1,7 @@
#pragma once
#include "../archive_i.h"
+#include <storage/storage.h>
#define TAB_RIGHT InputKeyRight // Default tab swith direction
#define TAB_DEFAULT ArchiveTabFavorites // Start tab
@@ -8,14 +9,14 @@
static const char* tab_default_paths[] = {
[ArchiveTabFavorites] = "/app:favorites",
- [ArchiveTabIButton] = "/any/ibutton",
- [ArchiveTabNFC] = "/any/nfc",
- [ArchiveTabSubGhz] = "/any/subghz",
- [ArchiveTabLFRFID] = "/any/lfrfid",
- [ArchiveTabInfrared] = "/any/infrared",
- [ArchiveTabBadUsb] = "/any/badusb",
+ [ArchiveTabIButton] = ANY_PATH("ibutton"),
+ [ArchiveTabNFC] = ANY_PATH("nfc"),
+ [ArchiveTabSubGhz] = ANY_PATH("subghz"),
+ [ArchiveTabLFRFID] = ANY_PATH("lfrfid"),
+ [ArchiveTabInfrared] = ANY_PATH("infrared"),
+ [ArchiveTabBadUsb] = ANY_PATH("badusb"),
[ArchiveTabU2f] = "/app:u2f",
- [ArchiveTabBrowser] = "/any",
+ [ArchiveTabBrowser] = STORAGE_ANY_PATH_PREFIX,
};
static const char* known_ext[] = {
diff --git a/applications/archive/helpers/archive_favorites.c b/applications/archive/helpers/archive_favorites.c
index af7927e9..fc0cad57 100644
--- a/applications/archive/helpers/archive_favorites.c
+++ b/applications/archive/helpers/archive_favorites.c
@@ -49,7 +49,7 @@ static bool archive_favorites_read_line(File* file, string_t str_result) {
uint16_t archive_favorites_count(void* context) {
furi_assert(context);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
string_t buffer;
@@ -74,7 +74,7 @@ uint16_t archive_favorites_count(void* context) {
string_clear(buffer);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return lines;
}
@@ -82,7 +82,7 @@ uint16_t archive_favorites_count(void* context) {
static bool archive_favourites_rescan() {
string_t buffer;
string_init(buffer);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
File* fav_item_file = storage_file_alloc(fs_api);
@@ -122,7 +122,7 @@ static bool archive_favourites_rescan() {
storage_file_free(file);
storage_file_free(fav_item_file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
@@ -131,7 +131,7 @@ bool archive_favorites_read(void* context) {
furi_assert(context);
ArchiveBrowserView* browser = context;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
File* fav_item_file = storage_file_alloc(fs_api);
@@ -184,7 +184,7 @@ bool archive_favorites_read(void* context) {
string_clear(buffer);
storage_file_free(file);
storage_file_free(fav_item_file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
archive_set_item_count(browser, file_count);
@@ -204,7 +204,7 @@ bool archive_favorites_delete(const char* format, ...) {
va_end(args);
string_init(buffer);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
bool result = storage_file_open(file, ARCHIVE_FAV_PATH, FSAM_READ, FSOM_OPEN_EXISTING);
@@ -233,7 +233,7 @@ bool archive_favorites_delete(const char* format, ...) {
storage_common_remove(fs_api, ARCHIVE_FAV_TEMP_PATH);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
@@ -247,7 +247,7 @@ bool archive_is_favorite(const char* format, ...) {
va_end(args);
string_init(buffer);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
bool found = false;
@@ -272,7 +272,7 @@ bool archive_is_favorite(const char* format, ...) {
string_clear(buffer);
string_clear(filename);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return found;
}
@@ -281,7 +281,7 @@ bool archive_favorites_rename(const char* src, const char* dst) {
furi_assert(src);
furi_assert(dst);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
string_t path;
@@ -318,7 +318,7 @@ bool archive_favorites_rename(const char* src, const char* dst) {
storage_common_remove(fs_api, ARCHIVE_FAV_TEMP_PATH);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
@@ -333,7 +333,7 @@ void archive_favorites_save(void* context) {
furi_assert(context);
ArchiveBrowserView* browser = context;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
for(size_t i = 0; i < archive_file_get_array_size(browser); i++) {
@@ -346,5 +346,5 @@ void archive_favorites_save(void* context) {
storage_common_remove(fs_api, ARCHIVE_FAV_TEMP_PATH);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
diff --git a/applications/archive/helpers/archive_favorites.h b/applications/archive/helpers/archive_favorites.h
index 681d0ec6..29eedcdb 100644
--- a/applications/archive/helpers/archive_favorites.h
+++ b/applications/archive/helpers/archive_favorites.h
@@ -2,8 +2,8 @@
#include <storage/storage.h>
-#define ARCHIVE_FAV_PATH "/any/favorites.txt"
-#define ARCHIVE_FAV_TEMP_PATH "/any/favorites.tmp"
+#define ARCHIVE_FAV_PATH ANY_PATH("favorites.txt")
+#define ARCHIVE_FAV_TEMP_PATH ANY_PATH("favorites.tmp")
uint16_t archive_favorites_count(void* context);
bool archive_favorites_read(void* context);
diff --git a/applications/archive/helpers/archive_files.c b/applications/archive/helpers/archive_files.c
index 7ff54fed..9f8b4ee1 100644
--- a/applications/archive/helpers/archive_files.c
+++ b/applications/archive/helpers/archive_files.c
@@ -60,7 +60,7 @@ void archive_file_append(const char* path, const char* format, ...) {
string_init_vprintf(string, format, args);
va_end(args);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
bool res = storage_file_open(file, path, FSAM_WRITE, FSOM_OPEN_APPEND);
@@ -71,7 +71,7 @@ void archive_file_append(const char* path, const char* format, ...) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
void archive_delete_file(void* context, const char* format, ...) {
@@ -84,7 +84,7 @@ void archive_delete_file(void* context, const char* format, ...) {
va_end(args);
ArchiveBrowserView* browser = context;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
FileInfo fileinfo;
storage_common_stat(fs_api, string_get_cstr(filename), &fileinfo);
@@ -97,7 +97,7 @@ void archive_delete_file(void* context, const char* format, ...) {
res = (storage_common_remove(fs_api, string_get_cstr(filename)) == FSE_OK);
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
if(archive_is_favorite("%s", string_get_cstr(filename))) {
archive_favorites_delete("%s", string_get_cstr(filename));
diff --git a/applications/archive/scenes/archive_scene_browser.c b/applications/archive/scenes/archive_scene_browser.c
index e3581538..74861bea 100644
--- a/applications/archive/scenes/archive_scene_browser.c
+++ b/applications/archive/scenes/archive_scene_browser.c
@@ -36,7 +36,7 @@ static void archive_loader_callback(const void* message, void* context) {
static void archive_run_in_app(ArchiveBrowserView* browser, ArchiveFile_t* selected) {
UNUSED(browser);
- Loader* loader = furi_record_open("loader");
+ Loader* loader = furi_record_open(RECORD_LOADER);
LoaderStatus status;
if(selected->is_app) {
@@ -54,7 +54,7 @@ static void archive_run_in_app(ArchiveBrowserView* browser, ArchiveFile_t* selec
FURI_LOG_E(TAG, "loader_start failed: %d", status);
}
- furi_record_close("loader");
+ furi_record_close(RECORD_LOADER);
}
void archive_scene_browser_callback(ArchiveBrowserEvent event, void* context) {
@@ -71,10 +71,10 @@ void archive_scene_browser_on_enter(void* context) {
archive_update_focus(browser, archive->text_store);
view_dispatcher_switch_to_view(archive->view_dispatcher, ArchiveViewBrowser);
- Loader* loader = furi_record_open("loader");
+ Loader* loader = furi_record_open(RECORD_LOADER);
archive->loader_stop_subscription =
furi_pubsub_subscribe(loader_get_pubsub(loader), archive_loader_callback, archive);
- furi_record_close("loader");
+ furi_record_close(RECORD_LOADER);
uint32_t state = scene_manager_get_scene_state(archive->scene_manager, ArchiveAppSceneBrowser);
@@ -196,10 +196,10 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
if(!archive_is_home(browser)) {
archive_leave_dir(browser);
} else {
- Loader* loader = furi_record_open("loader");
+ Loader* loader = furi_record_open(RECORD_LOADER);
furi_pubsub_unsubscribe(
loader_get_pubsub(loader), archive->loader_stop_subscription);
- furi_record_close("loader");
+ furi_record_close(RECORD_LOADER);
view_dispatcher_stop(archive->view_dispatcher);
}
@@ -216,7 +216,7 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
void archive_scene_browser_on_exit(void* context) {
ArchiveApp* archive = (ArchiveApp*)context;
- Loader* loader = furi_record_open("loader");
+ Loader* loader = furi_record_open(RECORD_LOADER);
furi_pubsub_unsubscribe(loader_get_pubsub(loader), archive->loader_stop_subscription);
- furi_record_close("loader");
+ furi_record_close(RECORD_LOADER);
}
diff --git a/applications/archive/scenes/archive_scene_rename.c b/applications/archive/scenes/archive_scene_rename.c
index d292dd60..2a85f3ce 100644
--- a/applications/archive/scenes/archive_scene_rename.c
+++ b/applications/archive/scenes/archive_scene_rename.c
@@ -51,7 +51,7 @@ bool archive_scene_rename_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SCENE_RENAME_CUSTOM_EVENT) {
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
const char* path_src = archive_get_name(archive->browser);
ArchiveFile_t* file = archive_get_current_file(archive->browser);
@@ -62,7 +62,7 @@ bool archive_scene_rename_on_event(void* context, SceneManagerEvent event) {
string_cat_printf(path_dst, "/%s%s", archive->text_store, known_ext[file->type]);
storage_common_rename(fs_api, path_src, string_get_cstr(path_dst));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
if(file->fav) {
archive_favorites_rename(path_src, string_get_cstr(path_dst));
diff --git a/applications/bad_usb/bad_usb_app.c b/applications/bad_usb/bad_usb_app.c
index 65ccc575..7eb86181 100644
--- a/applications/bad_usb/bad_usb_app.c
+++ b/applications/bad_usb/bad_usb_app.c
@@ -32,9 +32,9 @@ BadUsbApp* bad_usb_app_alloc(char* arg) {
string_set_str(app->file_path, arg);
}
- app->gui = furi_record_open("gui");
- app->notifications = furi_record_open("notification");
- app->dialogs = furi_record_open("dialogs");
+ app->gui = furi_record_open(RECORD_GUI);
+ app->notifications = furi_record_open(RECORD_NOTIFICATION);
+ app->dialogs = furi_record_open(RECORD_DIALOGS);
app->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(app->view_dispatcher);
@@ -92,9 +92,9 @@ void bad_usb_app_free(BadUsbApp* app) {
scene_manager_free(app->scene_manager);
// Close records
- furi_record_close("gui");
- furi_record_close("notification");
- furi_record_close("dialogs");
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_NOTIFICATION);
+ furi_record_close(RECORD_DIALOGS);
string_clear(app->file_path);
diff --git a/applications/bad_usb/bad_usb_app_i.h b/applications/bad_usb/bad_usb_app_i.h
index c82419e0..6b323d35 100644
--- a/applications/bad_usb/bad_usb_app_i.h
+++ b/applications/bad_usb/bad_usb_app_i.h
@@ -14,7 +14,7 @@
#include <gui/modules/widget.h>
#include "views/bad_usb_view.h"
-#define BAD_USB_APP_PATH_FOLDER "/any/badusb"
+#define BAD_USB_APP_PATH_FOLDER ANY_PATH("badusb")
#define BAD_USB_APP_EXTENSION ".txt"
typedef enum {
diff --git a/applications/bad_usb/bad_usb_script.c b/applications/bad_usb/bad_usb_script.c
index a06f6d59..9d9d3e39 100644
--- a/applications/bad_usb/bad_usb_script.c
+++ b/applications/bad_usb/bad_usb_script.c
@@ -455,7 +455,7 @@ static int32_t bad_usb_worker(void* context) {
FuriHalUsbInterface* usb_mode_prev = furi_hal_usb_get_config();
FURI_LOG_I(WORKER_TAG, "Init");
- File* script_file = storage_file_alloc(furi_record_open("storage"));
+ File* script_file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
string_init(bad_usb->line);
string_init(bad_usb->line_prev);
diff --git a/applications/bt/bt_cli.c b/applications/bt/bt_cli.c
index d12724d2..3aa1bc75 100644
--- a/applications/bt/bt_cli.c
+++ b/applications/bt/bt_cli.c
@@ -33,7 +33,7 @@ static void bt_cli_command_carrier_tx(Cli* cli, string_t args, void* context) {
break;
}
- Bt* bt = furi_record_open("bt");
+ Bt* bt = furi_record_open(RECORD_BT);
bt_disconnect(bt);
furi_hal_bt_reinit();
printf("Transmitting carrier at %d channel at %d dB power\r\n", channel, power);
@@ -46,7 +46,7 @@ static void bt_cli_command_carrier_tx(Cli* cli, string_t args, void* context) {
furi_hal_bt_stop_tone_tx();
bt_set_profile(bt, BtProfileSerial);
- furi_record_close("bt");
+ furi_record_close(RECORD_BT);
} while(false);
}
@@ -60,7 +60,7 @@ static void bt_cli_command_carrier_rx(Cli* cli, string_t args, void* context) {
break;
}
- Bt* bt = furi_record_open("bt");
+ Bt* bt = furi_record_open(RECORD_BT);
bt_disconnect(bt);
furi_hal_bt_reinit();
printf("Receiving carrier at %d channel\r\n", channel);
@@ -77,7 +77,7 @@ static void bt_cli_command_carrier_rx(Cli* cli, string_t args, void* context) {
furi_hal_bt_stop_packet_test();
bt_set_profile(bt, BtProfileSerial);
- furi_record_close("bt");
+ furi_record_close(RECORD_BT);
} while(false);
}
@@ -107,7 +107,7 @@ static void bt_cli_command_packet_tx(Cli* cli, string_t args, void* context) {
break;
}
- Bt* bt = furi_record_open("bt");
+ Bt* bt = furi_record_open(RECORD_BT);
bt_disconnect(bt);
furi_hal_bt_reinit();
printf(
@@ -125,7 +125,7 @@ static void bt_cli_command_packet_tx(Cli* cli, string_t args, void* context) {
printf("Transmitted %lu packets", furi_hal_bt_get_transmitted_packets());
bt_set_profile(bt, BtProfileSerial);
- furi_record_close("bt");
+ furi_record_close(RECORD_BT);
} while(false);
}
@@ -144,7 +144,7 @@ static void bt_cli_command_packet_rx(Cli* cli, string_t args, void* context) {
break;
}
- Bt* bt = furi_record_open("bt");
+ Bt* bt = furi_record_open(RECORD_BT);
bt_disconnect(bt);
furi_hal_bt_reinit();
printf("Receiving packets at %d channel at %d M datarate\r\n", channel, datarate);
@@ -160,7 +160,7 @@ static void bt_cli_command_packet_rx(Cli* cli, string_t args, void* context) {
printf("Received %hu packets", packets_received);
bt_set_profile(bt, BtProfileSerial);
- furi_record_close("bt");
+ furi_record_close(RECORD_BT);
} while(false);
}
@@ -180,7 +180,7 @@ static void bt_cli_print_usage() {
static void bt_cli(Cli* cli, string_t args, void* context) {
UNUSED(context);
- furi_record_open("bt");
+ furi_record_open(RECORD_BT);
string_t cmd;
string_init(cmd);
@@ -223,14 +223,14 @@ static void bt_cli(Cli* cli, string_t args, void* context) {
}
string_clear(cmd);
- furi_record_close("bt");
+ furi_record_close(RECORD_BT);
}
void bt_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = furi_record_open("cli");
- cli_add_command(cli, "bt", CliCommandFlagDefault, bt_cli, NULL);
- furi_record_close("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
+ cli_add_command(cli, RECORD_BT, CliCommandFlagDefault, bt_cli, NULL);
+ furi_record_close(RECORD_CLI);
#else
UNUSED(bt_cli);
#endif
diff --git a/applications/bt/bt_debug_app/bt_debug_app.c b/applications/bt/bt_debug_app/bt_debug_app.c
index 468f8a54..ac442de0 100644
--- a/applications/bt/bt_debug_app/bt_debug_app.c
+++ b/applications/bt/bt_debug_app/bt_debug_app.c
@@ -35,7 +35,7 @@ BtDebugApp* bt_debug_app_alloc() {
bt_settings_load(&app->settings);
// Gui
- app->gui = furi_record_open("gui");
+ app->gui = furi_record_open(RECORD_GUI);
// View dispatcher
app->view_dispatcher = view_dispatcher_alloc();
@@ -88,7 +88,7 @@ void bt_debug_app_free(BtDebugApp* app) {
view_dispatcher_free(app->view_dispatcher);
// Close gui record
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
app->gui = NULL;
// Free rest
@@ -99,7 +99,7 @@ int32_t bt_debug_app(void* p) {
UNUSED(p);
if(!furi_hal_bt_is_testing_supported()) {
FURI_LOG_E(TAG, "Incorrect radio stack: radio testing fetures are absent.");
- DialogsApp* dialogs = furi_record_open("dialogs");
+ DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
dialog_message_show_storage_error(dialogs, "Incorrect\nRadioStack");
return 255;
}
diff --git a/applications/bt/bt_hid_app/bt_hid.c b/applications/bt/bt_hid_app/bt_hid.c
index 47ee2268..29a25c86 100755
--- a/applications/bt/bt_hid_app/bt_hid.c
+++ b/applications/bt/bt_hid_app/bt_hid.c
@@ -70,13 +70,13 @@ BtHid* bt_hid_app_alloc() {
BtHid* app = malloc(sizeof(BtHid));
// Gui
- app->gui = furi_record_open("gui");
+ app->gui = furi_record_open(RECORD_GUI);
// Bt
- app->bt = furi_record_open("bt");
+ app->bt = furi_record_open(RECORD_BT);
// Notifications
- app->notifications = furi_record_open("notification");
+ app->notifications = furi_record_open(RECORD_NOTIFICATION);
// View dispatcher
app->view_dispatcher = view_dispatcher_alloc();
@@ -161,11 +161,11 @@ void bt_hid_app_free(BtHid* app) {
view_dispatcher_free(app->view_dispatcher);
// Close records
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
app->gui = NULL;
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
app->notifications = NULL;
- furi_record_close("bt");
+ furi_record_close(RECORD_BT);
app->bt = NULL;
// Free rest
diff --git a/applications/bt/bt_service/bt.c b/applications/bt/bt_service/bt.c
index d122aa17..6f0810dd 100644
--- a/applications/bt/bt_service/bt.c
+++ b/applications/bt/bt_service/bt.c
@@ -124,23 +124,23 @@ Bt* bt_alloc() {
// Pin code view port
bt->pin_code_view_port = bt_pin_code_view_port_alloc(bt);
// Notification
- bt->notification = furi_record_open("notification");
+ bt->notification = furi_record_open(RECORD_NOTIFICATION);
// Gui
- bt->gui = furi_record_open("gui");
+ bt->gui = furi_record_open(RECORD_GUI);
gui_add_view_port(bt->gui, bt->statusbar_view_port, GuiLayerStatusBarLeft);
gui_add_view_port(bt->gui, bt->pin_code_view_port, GuiLayerFullscreen);
// Dialogs
- bt->dialogs = furi_record_open("dialogs");
+ bt->dialogs = furi_record_open(RECORD_DIALOGS);
bt->dialog_message = dialog_message_alloc();
// Power
- bt->power = furi_record_open("power");
+ bt->power = furi_record_open(RECORD_POWER);
FuriPubSub* power_pubsub = power_get_pubsub(bt->power);
furi_pubsub_subscribe(power_pubsub, bt_battery_level_changed_callback, bt);
// RPC
- bt->rpc = furi_record_open("rpc");
+ bt->rpc = furi_record_open(RECORD_RPC);
bt->rpc_event = furi_event_flag_alloc();
// API evnent
@@ -353,7 +353,7 @@ int32_t bt_srv() {
if(furi_hal_rtc_get_boot_mode() != FuriHalRtcBootModeNormal) {
FURI_LOG_W(TAG, "Skipped BT init: device in special startup mode");
ble_glue_wait_for_c2_start(FURI_HAL_BT_C2_START_TIMEOUT);
- furi_record_create("bt", bt);
+ furi_record_create(RECORD_BT, bt);
return 0;
}
@@ -381,7 +381,7 @@ int32_t bt_srv() {
bt->status = BtStatusUnavailable;
}
- furi_record_create("bt", bt);
+ furi_record_create(RECORD_BT, bt);
BtMessage message;
while(1) {
diff --git a/applications/bt/bt_service/bt.h b/applications/bt/bt_service/bt.h
index 4ca6a32f..6e4e1b82 100644
--- a/applications/bt/bt_service/bt.h
+++ b/applications/bt/bt_service/bt.h
@@ -7,6 +7,8 @@
extern "C" {
#endif
+#define RECORD_BT "bt"
+
typedef struct Bt Bt;
typedef enum {
diff --git a/applications/bt/bt_service/bt_keys_filename.h b/applications/bt/bt_service/bt_keys_filename.h
new file mode 100644
index 00000000..da1d3f54
--- /dev/null
+++ b/applications/bt/bt_service/bt_keys_filename.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define BT_KEYS_STORAGE_FILE_NAME ".bt.keys"
diff --git a/applications/bt/bt_service/bt_keys_storage.c b/applications/bt/bt_service/bt_keys_storage.c
index e4f426c8..91d97d67 100644
--- a/applications/bt/bt_service/bt_keys_storage.c
+++ b/applications/bt/bt_service/bt_keys_storage.c
@@ -2,8 +2,9 @@
#include <furi.h>
#include <lib/toolbox/saved_struct.h>
+#include <storage/storage.h>
-#define BT_KEYS_STORAGE_PATH "/int/bt.keys"
+#define BT_KEYS_STORAGE_PATH INT_PATH(BT_KEYS_STORAGE_FILE_NAME)
#define BT_KEYS_STORAGE_VERSION (0)
#define BT_KEYS_STORAGE_MAGIC (0x18)
diff --git a/applications/bt/bt_service/bt_keys_storage.h b/applications/bt/bt_service/bt_keys_storage.h
index 68d4476a..b82b1035 100644
--- a/applications/bt/bt_service/bt_keys_storage.h
+++ b/applications/bt/bt_service/bt_keys_storage.h
@@ -1,6 +1,7 @@
#pragma once
#include "bt_i.h"
+#include "bt_keys_filename.h"
bool bt_keys_storage_load(Bt* bt);
diff --git a/applications/bt/bt_settings.c b/applications/bt/bt_settings.c
index dbb2fd05..1eaf6c7d 100644
--- a/applications/bt/bt_settings.c
+++ b/applications/bt/bt_settings.c
@@ -2,8 +2,9 @@
#include <furi.h>
#include <lib/toolbox/saved_struct.h>
+#include <storage/storage.h>
-#define BT_SETTINGS_PATH "/int/bt.settings"
+#define BT_SETTINGS_PATH INT_PATH(BT_SETTINGS_FILE_NAME)
#define BT_SETTINGS_VERSION (0)
#define BT_SETTINGS_MAGIC (0x19)
diff --git a/applications/bt/bt_settings.h b/applications/bt/bt_settings.h
index 1a98668a..260d9c0e 100644
--- a/applications/bt/bt_settings.h
+++ b/applications/bt/bt_settings.h
@@ -1,5 +1,7 @@
#pragma once
+#include "bt_settings_filename.h"
+
#include <stdint.h>
#include <stdbool.h>
diff --git a/applications/bt/bt_settings_app/bt_settings_app.c b/applications/bt/bt_settings_app/bt_settings_app.c
index cb55e931..f211c712 100755
--- a/applications/bt/bt_settings_app/bt_settings_app.c
+++ b/applications/bt/bt_settings_app/bt_settings_app.c
@@ -17,8 +17,8 @@ BtSettingsApp* bt_settings_app_alloc() {
// Load settings
bt_settings_load(&app->settings);
- app->gui = furi_record_open("gui");
- app->bt = furi_record_open("bt");
+ app->gui = furi_record_open(RECORD_GUI);
+ app->bt = furi_record_open(RECORD_BT);
// View Dispatcher and Scene Manager
app->view_dispatcher = view_dispatcher_alloc();
@@ -70,8 +70,8 @@ void bt_settings_app_free(BtSettingsApp* app) {
scene_manager_free(app->scene_manager);
// Records
- furi_record_close("gui");
- furi_record_close("bt");
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_BT);
free(app);
}
diff --git a/applications/bt/bt_settings_filename.h b/applications/bt/bt_settings_filename.h
new file mode 100644
index 00000000..e5fb7ec4
--- /dev/null
+++ b/applications/bt/bt_settings_filename.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define BT_SETTINGS_FILE_NAME ".bt.settings"
diff --git a/applications/cli/cli.c b/applications/cli/cli.c
index 7d0f8dab..4d9b8a5f 100644
--- a/applications/cli/cli.c
+++ b/applications/cli/cli.c
@@ -185,7 +185,7 @@ static void cli_execute_command(Cli* cli, CliCommand* command, string_t args) {
// Ensure that we running alone
if(!(command->flags & CliCommandFlagParallelSafe)) {
- Loader* loader = furi_record_open("loader");
+ Loader* loader = furi_record_open(RECORD_LOADER);
bool safety_lock = loader_lock(loader);
if(safety_lock) {
// Execute command
@@ -194,7 +194,7 @@ static void cli_execute_command(Cli* cli, CliCommand* command, string_t args) {
} else {
printf("Other application is running, close it first");
}
- furi_record_close("loader");
+ furi_record_close(RECORD_LOADER);
} else {
// Execute command
command->callback(cli, args, command->context);
@@ -466,7 +466,7 @@ int32_t cli_srv(void* p) {
// Init basic cli commands
cli_commands_init(cli);
- furi_record_create("cli", cli);
+ furi_record_create(RECORD_CLI, cli);
if(cli->session != NULL) {
furi_stdglue_set_thread_stdout_callback(cli->session->tx_stdout);
diff --git a/applications/cli/cli.h b/applications/cli/cli.h
index 29f27392..549e72cc 100644
--- a/applications/cli/cli.h
+++ b/applications/cli/cli.h
@@ -33,6 +33,8 @@ typedef enum {
CliCommandFlagInsomniaSafe = (1 << 1), /**< Safe to run with insomnia mode on */
} CliCommandFlag;
+#define RECORD_CLI "cli"
+
/** Cli type anonymous structure */
typedef struct Cli Cli;
diff --git a/applications/cli/cli_commands.c b/applications/cli/cli_commands.c
index c99f4edc..19887796 100644
--- a/applications/cli/cli_commands.c
+++ b/applications/cli/cli_commands.c
@@ -166,13 +166,13 @@ void cli_command_vibro(Cli* cli, string_t args, void* context) {
UNUSED(cli);
UNUSED(context);
if(!string_cmp(args, "0")) {
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
notification_message_block(notification, &sequence_reset_vibro);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
} else if(!string_cmp(args, "1")) {
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
notification_message_block(notification, &sequence_set_vibro_on);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
} else {
cli_print_usage("vibro", "<1|0>", string_get_cstr(args));
}
@@ -244,9 +244,9 @@ void cli_command_led(Cli* cli, string_t args, void* context) {
};
// Send notification
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
notification_internal_message_block(notification, &notification_sequence);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
}
void cli_command_ps(Cli* cli, string_t args, void* context) {
diff --git a/applications/crypto/crypto_cli.c b/applications/crypto/crypto_cli.c
index a5ea80f8..26e1fb9c 100644
--- a/applications/crypto/crypto_cli.c
+++ b/applications/crypto/crypto_cli.c
@@ -317,9 +317,9 @@ static void crypto_cli(Cli* cli, string_t args, void* context) {
void crypto_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_add_command(cli, "crypto", CliCommandFlagDefault, crypto_cli, NULL);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#else
UNUSED(crypto_cli);
#endif
diff --git a/applications/debug_tools/blink_test.c b/applications/debug_tools/blink_test.c
index 3870c11e..7dd2c9e9 100644
--- a/applications/debug_tools/blink_test.c
+++ b/applications/debug_tools/blink_test.c
@@ -88,10 +88,10 @@ int32_t blink_test_app(void* p) {
furi_timer_start(timer, furi_kernel_get_tick_frequency());
// Register view port in GUI
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
- NotificationApp* notifications = furi_record_open("notification");
+ NotificationApp* notifications = furi_record_open(RECORD_NOTIFICATION);
uint8_t state = 0;
BlinkEvent event;
@@ -119,8 +119,8 @@ int32_t blink_test_app(void* p) {
view_port_free(view_port);
furi_message_queue_free(event_queue);
- furi_record_close("notification");
- furi_record_close("gui");
+ furi_record_close(RECORD_NOTIFICATION);
+ furi_record_close(RECORD_GUI);
return 0;
}
diff --git a/applications/debug_tools/display_test/display_test.c b/applications/debug_tools/display_test/display_test.c
index 95aea1de..947e4dc8 100644
--- a/applications/debug_tools/display_test/display_test.c
+++ b/applications/debug_tools/display_test/display_test.c
@@ -127,7 +127,7 @@ DisplayTest* display_test_alloc() {
View* view = NULL;
- instance->gui = furi_record_open("gui");
+ instance->gui = furi_record_open(RECORD_GUI);
instance->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(instance->view_dispatcher);
view_dispatcher_attach_to_gui(
@@ -206,7 +206,7 @@ void display_test_free(DisplayTest* instance) {
view_display_test_free(instance->view_display_test);
view_dispatcher_free(instance->view_dispatcher);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
free(instance);
}
diff --git a/applications/debug_tools/file_browser_test/file_browser_app.c b/applications/debug_tools/file_browser_test/file_browser_app.c
index c9b63ecb..c7f461d4 100644
--- a/applications/debug_tools/file_browser_test/file_browser_app.c
+++ b/applications/debug_tools/file_browser_test/file_browser_app.c
@@ -29,8 +29,8 @@ FileBrowserApp* file_browser_app_alloc(char* arg) {
UNUSED(arg);
FileBrowserApp* app = malloc(sizeof(FileBrowserApp));
- app->gui = furi_record_open("gui");
- app->dialogs = furi_record_open("dialogs");
+ app->gui = furi_record_open(RECORD_GUI);
+ app->dialogs = furi_record_open(RECORD_DIALOGS);
app->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(app->view_dispatcher);
@@ -80,9 +80,9 @@ void file_browser_app_free(FileBrowserApp* app) {
scene_manager_free(app->scene_manager);
// Close records
- furi_record_close("gui");
- furi_record_close("notification");
- furi_record_close("dialogs");
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_NOTIFICATION);
+ furi_record_close(RECORD_DIALOGS);
string_clear(app->file_path);
diff --git a/applications/debug_tools/file_browser_test/scenes/file_browser_scene_start.c b/applications/debug_tools/file_browser_test/scenes/file_browser_scene_start.c
index bb71e83d..b3381f0a 100644
--- a/applications/debug_tools/file_browser_test/scenes/file_browser_scene_start.c
+++ b/applications/debug_tools/file_browser_test/scenes/file_browser_scene_start.c
@@ -1,6 +1,8 @@
#include "../file_browser_app_i.h"
-#include "furi_hal.h"
-#include "gui/modules/widget_elements/widget_element_i.h"
+
+#include <furi_hal.h>
+#include <gui/modules/widget_elements/widget_element_i.h>
+#include <storage/storage.h>
static void
file_browser_scene_start_ok_callback(GuiButtonType result, InputType type, void* context) {
@@ -17,7 +19,7 @@ bool file_browser_scene_start_on_event(void* context, SceneManagerEvent event) {
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
- string_set_str(app->file_path, "/any/badusb/demo_windows.txt");
+ string_set_str(app->file_path, ANY_PATH("badusb/demo_windows.txt"));
scene_manager_next_scene(app->scene_manager, FileBrowserSceneBrowser);
consumed = true;
} else if(event.type == SceneManagerEventTypeTick) {
diff --git a/applications/debug_tools/keypad_test.c b/applications/debug_tools/keypad_test.c
index 9a6e7f25..6708c82b 100644
--- a/applications/debug_tools/keypad_test.c
+++ b/applications/debug_tools/keypad_test.c
@@ -78,7 +78,7 @@ int32_t keypad_test_app(void* p) {
view_port_input_callback_set(view_port, keypad_test_input_callback, event_queue);
// Open GUI and register view_port
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
InputEvent event;
@@ -149,7 +149,7 @@ int32_t keypad_test_app(void* p) {
furi_message_queue_free(event_queue);
delete_mutex(&state_mutex);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
return 0;
}
diff --git a/applications/debug_tools/text_box_test.c b/applications/debug_tools/text_box_test.c
index 837c34b6..d7194ffe 100644
--- a/applications/debug_tools/text_box_test.c
+++ b/applications/debug_tools/text_box_test.c
@@ -88,7 +88,7 @@ int32_t text_box_test_app(void* p) {
view_port_input_callback_set(view_port, text_box_test_input_callback, event_queue);
// Open GUI and register view_port
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
uint32_t test_renders_num = COUNT_OF(text_box_test_render);
@@ -121,7 +121,7 @@ int32_t text_box_test_app(void* p) {
furi_message_queue_free(event_queue);
delete_mutex(&state_mutex);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
return 0;
}
diff --git a/applications/debug_tools/uart_echo.c b/applications/debug_tools/uart_echo.c
index 8f795c56..7a0f5c39 100644
--- a/applications/debug_tools/uart_echo.c
+++ b/applications/debug_tools/uart_echo.c
@@ -189,8 +189,8 @@ static UartEchoApp* uart_echo_app_alloc() {
app->rx_stream = xStreamBufferCreate(2048, 1);
// Gui
- app->gui = furi_record_open("gui");
- app->notification = furi_record_open("notification");
+ app->gui = furi_record_open(RECORD_GUI);
+ app->notification = furi_record_open(RECORD_NOTIFICATION);
// View dispatcher
app->view_dispatcher = view_dispatcher_alloc();
@@ -256,8 +256,8 @@ static void uart_echo_app_free(UartEchoApp* app) {
view_dispatcher_free(app->view_dispatcher);
// Close gui record
- furi_record_close("gui");
- furi_record_close("notification");
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_NOTIFICATION);
app->gui = NULL;
vStreamBufferDelete(app->rx_stream);
diff --git a/applications/debug_tools/usb_mouse.c b/applications/debug_tools/usb_mouse.c
index 3174ccae..6e716e69 100644
--- a/applications/debug_tools/usb_mouse.c
+++ b/applications/debug_tools/usb_mouse.c
@@ -51,7 +51,7 @@ int32_t usb_mouse_app(void* p) {
view_port_input_callback_set(view_port, usb_mouse_input_callback, event_queue);
// Open GUI and register view_port
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
UsbMouseEvent event;
diff --git a/applications/debug_tools/usb_test.c b/applications/debug_tools/usb_test.c
index a4f42f47..ed86c37a 100644
--- a/applications/debug_tools/usb_test.c
+++ b/applications/debug_tools/usb_test.c
@@ -59,7 +59,7 @@ UsbTestApp* usb_test_app_alloc() {
UsbTestApp* app = malloc(sizeof(UsbTestApp));
// Gui
- app->gui = furi_record_open("gui");
+ app->gui = furi_record_open(RECORD_GUI);
// View dispatcher
app->view_dispatcher = view_dispatcher_alloc();
@@ -106,7 +106,7 @@ void usb_test_app_free(UsbTestApp* app) {
view_dispatcher_free(app->view_dispatcher);
// Close gui record
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
app->gui = NULL;
// Free rest
diff --git a/applications/debug_tools/vibro_test.c b/applications/debug_tools/vibro_test.c
index dbd35d60..e6c45ef6 100644
--- a/applications/debug_tools/vibro_test.c
+++ b/applications/debug_tools/vibro_test.c
@@ -32,10 +32,10 @@ int32_t vibro_test_app(void* p) {
view_port_input_callback_set(view_port, vibro_test_input_callback, event_queue);
// Register view port in GUI
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
InputEvent event;
@@ -60,8 +60,8 @@ int32_t vibro_test_app(void* p) {
view_port_free(view_port);
furi_message_queue_free(event_queue);
- furi_record_close("notification");
- furi_record_close("gui");
+ furi_record_close(RECORD_NOTIFICATION);
+ furi_record_close(RECORD_GUI);
return 0;
}
diff --git a/applications/desktop/animations/animation_manager.c b/applications/desktop/animations/animation_manager.c
index 9b702811..d755be9c 100644
--- a/applications/desktop/animations/animation_manager.c
+++ b/applications/desktop/animations/animation_manager.c
@@ -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(
diff --git a/applications/desktop/animations/animation_storage.c b/applications/desktop/animations/animation_storage.c
index 36b20bc8..e0c6bf41 100644
--- a/applications/desktop/animations/animation_storage.c
+++ b/applications/desktop/animations/animation_storage.c
@@ -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);
diff --git a/applications/desktop/desktop.c b/applications/desktop/desktop.c
index 83b4f0f3..578066a6 100644
--- a/applications/desktop/desktop.c
+++ b/applications/desktop/desktop.c
@@ -15,6 +15,7 @@
#include "desktop/views/desktop_view_pin_timeout.h"
#include "desktop_i.h"
#include "helpers/pin_lock.h"
+#include "helpers/slideshow_filename.h"
static void desktop_auto_lock_arm(Desktop*);
static void desktop_auto_lock_inhibit(Desktop*);
@@ -127,9 +128,9 @@ void desktop_lock(Desktop* desktop) {
void desktop_unlock(Desktop* desktop) {
view_port_enabled_set(desktop->lock_viewport, false);
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_set_lockdown(gui, false);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
desktop_view_locked_unlock(desktop->locked_view);
scene_manager_search_and_switch_to_previous_scene(desktop->scene_manager, DesktopSceneMain);
desktop_auto_lock_arm(desktop);
@@ -139,7 +140,7 @@ Desktop* desktop_alloc() {
Desktop* desktop = malloc(sizeof(Desktop));
desktop->animation_manager = animation_manager_alloc();
- desktop->gui = furi_record_open("gui");
+ desktop->gui = furi_record_open(RECORD_GUI);
desktop->scene_thread = furi_thread_alloc();
desktop->view_dispatcher = view_dispatcher_alloc();
desktop->scene_manager = scene_manager_alloc(&desktop_scene_handlers, desktop);
@@ -218,17 +219,17 @@ Desktop* desktop_alloc() {
gui_add_view_port(desktop->gui, desktop->lock_viewport, GuiLayerStatusBarLeft);
// Special case: autostart application is already running
- desktop->loader = furi_record_open("loader");
+ desktop->loader = furi_record_open(RECORD_LOADER);
if(loader_is_locked(desktop->loader) &&
animation_manager_is_animation_loaded(desktop->animation_manager)) {
animation_manager_unload_and_stall_animation(desktop->animation_manager);
}
- desktop->notification = furi_record_open("notification");
+ desktop->notification = furi_record_open(RECORD_NOTIFICATION);
desktop->app_start_stop_subscription = furi_pubsub_subscribe(
loader_get_pubsub(desktop->loader), desktop_loader_callback, desktop);
- desktop->input_events_pubsub = furi_record_open("input_events");
+ desktop->input_events_pubsub = furi_record_open(RECORD_INPUT_EVENTS);
desktop->input_events_subscription = NULL;
desktop->auto_lock_timer =
@@ -250,9 +251,9 @@ void desktop_free(Desktop* desktop) {
desktop->loader = NULL;
desktop->input_events_pubsub = NULL;
- furi_record_close("loader");
- furi_record_close("notification");
- furi_record_close("input_events");
+ furi_record_close(RECORD_LOADER);
+ furi_record_close(RECORD_NOTIFICATION);
+ furi_record_close(RECORD_INPUT_EVENTS);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdMain);
view_dispatcher_remove_view(desktop->view_dispatcher, DesktopViewIdLockMenu);
@@ -276,7 +277,7 @@ void desktop_free(Desktop* desktop) {
popup_free(desktop->hw_mismatch_popup);
desktop_view_pin_timeout_free(desktop->pin_timeout_view);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
desktop->gui = NULL;
furi_thread_free(desktop->scene_thread);
@@ -289,9 +290,9 @@ void desktop_free(Desktop* desktop) {
}
static bool desktop_check_file_flag(const char* flag_path) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool exists = storage_common_stat(storage, flag_path, NULL) == FSE_OK;
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return exists;
}
@@ -318,7 +319,7 @@ int32_t desktop_srv(void* p) {
desktop_lock(desktop);
}
- if(desktop_check_file_flag("/int/slideshow")) {
+ if(desktop_check_file_flag(SLIDESHOW_FS_PATH)) {
scene_manager_next_scene(desktop->scene_manager, DesktopSceneSlideshow);
}
diff --git a/applications/desktop/desktop_settings/desktop_settings.h b/applications/desktop/desktop_settings/desktop_settings.h
index f2039924..800847d5 100644
--- a/applications/desktop/desktop_settings/desktop_settings.h
+++ b/applications/desktop/desktop_settings/desktop_settings.h
@@ -1,12 +1,16 @@
#pragma once
+#include "desktop_settings_filename.h"
+
#include <furi_hal.h>
#include <stdint.h>
#include <stdbool.h>
#include <toolbox/saved_struct.h>
+#include <storage/storage.h>
#define DESKTOP_SETTINGS_VER (4)
-#define DESKTOP_SETTINGS_PATH "/int/desktop.settings"
+
+#define DESKTOP_SETTINGS_PATH INT_PATH(DESKTOP_SETTINGS_FILE_NAME)
#define DESKTOP_SETTINGS_MAGIC (0x17)
#define PIN_MAX_LENGTH 12
diff --git a/applications/desktop/desktop_settings/desktop_settings_app.c b/applications/desktop/desktop_settings/desktop_settings_app.c
index c52f1947..bc41be6e 100644
--- a/applications/desktop/desktop_settings/desktop_settings_app.c
+++ b/applications/desktop/desktop_settings/desktop_settings_app.c
@@ -21,7 +21,7 @@ static bool desktop_settings_back_event_callback(void* context) {
DesktopSettingsApp* desktop_settings_app_alloc() {
DesktopSettingsApp* app = malloc(sizeof(DesktopSettingsApp));
- app->gui = furi_record_open("gui");
+ app->gui = furi_record_open(RECORD_GUI);
app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&desktop_settings_scene_handlers, app);
view_dispatcher_enable_queue(app->view_dispatcher);
@@ -83,7 +83,7 @@ void desktop_settings_app_free(DesktopSettingsApp* app) {
view_dispatcher_free(app->view_dispatcher);
scene_manager_free(app->scene_manager);
// Records
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
free(app);
}
diff --git a/applications/desktop/desktop_settings/desktop_settings_filename.h b/applications/desktop/desktop_settings/desktop_settings_filename.h
new file mode 100644
index 00000000..b9140f24
--- /dev/null
+++ b/applications/desktop/desktop_settings/desktop_settings_filename.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define DESKTOP_SETTINGS_FILE_NAME ".desktop.settings"
diff --git a/applications/desktop/desktop_settings/scenes/desktop_settings_scene_pin_setup_done.c b/applications/desktop/desktop_settings/scenes/desktop_settings_scene_pin_setup_done.c
index 7be0e51c..42408428 100644
--- a/applications/desktop/desktop_settings/scenes/desktop_settings_scene_pin_setup_done.c
+++ b/applications/desktop/desktop_settings/scenes/desktop_settings_scene_pin_setup_done.c
@@ -25,9 +25,9 @@ void desktop_settings_scene_pin_setup_done_on_enter(void* context) {
app->settings.pin_code = app->pincode_buffer;
SAVE_DESKTOP_SETTINGS(&app->settings);
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
notification_message(notification, &sequence_single_vibro);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
desktop_view_pin_input_set_context(app->pin_input_view, app);
desktop_view_pin_input_set_back_callback(app->pin_input_view, NULL);
diff --git a/applications/desktop/helpers/pin_lock.c b/applications/desktop/helpers/pin_lock.c
index d63398d9..0495b675 100644
--- a/applications/desktop/helpers/pin_lock.c
+++ b/applications/desktop/helpers/pin_lock.c
@@ -44,9 +44,9 @@ static const uint8_t desktop_helpers_fails_timeout[] = {
};
void desktop_pin_lock_error_notify() {
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
notification_message(notification, &sequence_pin_fail);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
}
uint32_t desktop_pin_lock_get_fail_timeout() {
@@ -67,9 +67,9 @@ void desktop_pin_lock(DesktopSettings* settings) {
furi_hal_rtc_set_pin_fails(0);
furi_hal_rtc_set_flag(FuriHalRtcFlagLock);
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_session_close(cli);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
settings->is_locked = 1;
SAVE_DESKTOP_SETTINGS(settings);
}
@@ -78,9 +78,9 @@ void desktop_pin_unlock(DesktopSettings* settings) {
furi_assert(settings);
furi_hal_rtc_reset_flag(FuriHalRtcFlagLock);
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_session_open(cli, &cli_vcp);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
settings->is_locked = 0;
SAVE_DESKTOP_SETTINGS(settings);
}
@@ -103,9 +103,9 @@ void desktop_pin_lock_init(DesktopSettings* settings) {
}
if(desktop_pin_lock_is_locked()) {
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_session_close(cli);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
}
}
diff --git a/applications/desktop/helpers/slideshow.c b/applications/desktop/helpers/slideshow.c
index 4ec55a5a..63bd42b5 100644
--- a/applications/desktop/helpers/slideshow.c
+++ b/applications/desktop/helpers/slideshow.c
@@ -52,7 +52,7 @@ void slideshow_free(Slideshow* slideshow) {
}
bool slideshow_load(Slideshow* slideshow, const char* fspath) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* slideshow_file = storage_file_alloc(storage);
slideshow->loaded = false;
do {
@@ -86,7 +86,7 @@ bool slideshow_load(Slideshow* slideshow, const char* fspath) {
}
} while(false);
storage_file_free(slideshow_file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return slideshow->loaded;
}
diff --git a/applications/desktop/helpers/slideshow_filename.h b/applications/desktop/helpers/slideshow_filename.h
new file mode 100644
index 00000000..2250d91d
--- /dev/null
+++ b/applications/desktop/helpers/slideshow_filename.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define SLIDESHOW_FILE_NAME ".slideshow"
diff --git a/applications/desktop/scenes/desktop_scene_debug.c b/applications/desktop/scenes/desktop_scene_debug.c
index 4945f7ac..e79c56e1 100644
--- a/applications/desktop/scenes/desktop_scene_debug.c
+++ b/applications/desktop/scenes/desktop_scene_debug.c
@@ -22,7 +22,7 @@ void desktop_scene_debug_on_enter(void* context) {
bool desktop_scene_debug_on_event(void* context, SceneManagerEvent event) {
Desktop* desktop = (Desktop*)context;
- Dolphin* dolphin = furi_record_open("dolphin");
+ Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
@@ -55,7 +55,7 @@ bool desktop_scene_debug_on_event(void* context, SceneManagerEvent event) {
}
}
- furi_record_close("dolphin");
+ furi_record_close(RECORD_DOLPHIN);
return consumed;
}
diff --git a/applications/desktop/scenes/desktop_scene_locked.c b/applications/desktop/scenes/desktop_scene_locked.c
index f4c08d32..c377d40a 100644
--- a/applications/desktop/scenes/desktop_scene_locked.c
+++ b/applications/desktop/scenes/desktop_scene_locked.c
@@ -47,9 +47,9 @@ void desktop_scene_locked_on_enter(void* context) {
if(state == SCENE_LOCKED_FIRST_ENTER) {
bool pin_locked = desktop_pin_lock_is_locked();
view_port_enabled_set(desktop->lock_viewport, true);
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_set_lockdown(gui, true);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
if(pin_locked) {
LOAD_DESKTOP_SETTINGS(&desktop->settings);
diff --git a/applications/desktop/scenes/desktop_scene_pin_input.c b/applications/desktop/scenes/desktop_scene_pin_input.c
index 7d980a85..9392309e 100644
--- a/applications/desktop/scenes/desktop_scene_pin_input.c
+++ b/applications/desktop/scenes/desktop_scene_pin_input.c
@@ -24,13 +24,13 @@ typedef struct {
} DesktopScenePinInputState;
static void desktop_scene_locked_light_red(bool value) {
- NotificationApp* app = furi_record_open("notification");
+ NotificationApp* app = furi_record_open(RECORD_NOTIFICATION);
if(value) {
notification_message(app, &sequence_set_only_red_255);
} else {
notification_message(app, &sequence_reset_red);
}
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
}
static void
diff --git a/applications/desktop/scenes/desktop_scene_slideshow.c b/applications/desktop/scenes/desktop_scene_slideshow.c
index 70080127..18460a4c 100644
--- a/applications/desktop/scenes/desktop_scene_slideshow.c
+++ b/applications/desktop/scenes/desktop_scene_slideshow.c
@@ -26,9 +26,9 @@ bool desktop_scene_slideshow_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) {
switch(event.event) {
case DesktopSlideshowCompleted:
- storage = furi_record_open("storage");
- storage_common_remove(storage, "/int/slideshow");
- furi_record_close("storage");
+ storage = furi_record_open(RECORD_STORAGE);
+ storage_common_remove(storage, SLIDESHOW_FS_PATH);
+ furi_record_close(RECORD_STORAGE);
scene_manager_previous_scene(desktop->scene_manager);
consumed = true;
break;
diff --git a/applications/desktop/views/desktop_view_debug.c b/applications/desktop/views/desktop_view_debug.c
index 3a6c87f1..68c054c2 100644
--- a/applications/desktop/views/desktop_view_debug.c
+++ b/applications/desktop/views/desktop_view_debug.c
@@ -79,9 +79,9 @@ void desktop_debug_render(Canvas* canvas, void* model) {
} else {
char buffer[64];
- 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 current_lvl = stats.level;
uint32_t remaining = dolphin_state_xp_to_levelup(m->icounter);
@@ -175,7 +175,7 @@ void desktop_debug_free(DesktopDebugView* debug_view) {
}
void desktop_debug_get_dolphin_data(DesktopDebugView* debug_view) {
- Dolphin* dolphin = furi_record_open("dolphin");
+ Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
DolphinStats stats = dolphin_stats(dolphin);
with_view_model(
debug_view->view, (DesktopDebugViewModel * model) {
@@ -185,7 +185,7 @@ void desktop_debug_get_dolphin_data(DesktopDebugView* debug_view) {
return true;
});
- furi_record_close("dolphin");
+ furi_record_close(RECORD_DOLPHIN);
}
void desktop_debug_reset_screen_idx(DesktopDebugView* debug_view) {
diff --git a/applications/desktop/views/desktop_view_slideshow.c b/applications/desktop/views/desktop_view_slideshow.c
index cd22b39d..943206e1 100644
--- a/applications/desktop/views/desktop_view_slideshow.c
+++ b/applications/desktop/views/desktop_view_slideshow.c
@@ -5,6 +5,7 @@
#include "../desktop_i.h"
#include "desktop_view_slideshow.h"
#include "../helpers/slideshow.h"
+#include "../helpers/slideshow_filename.h"
struct DesktopSlideshowView {
View* view;
@@ -60,7 +61,7 @@ static void desktop_view_slideshow_enter(void* context) {
DesktopSlideshowViewModel* model = view_get_model(instance->view);
model->slideshow = slideshow_alloc();
- if(!slideshow_load(model->slideshow, "/int/slideshow")) {
+ if(!slideshow_load(model->slideshow, SLIDESHOW_FS_PATH)) {
instance->callback(DesktopSlideshowCompleted, instance->context);
}
view_commit_model(instance->view, false);
diff --git a/applications/desktop/views/desktop_view_slideshow.h b/applications/desktop/views/desktop_view_slideshow.h
index 5b45a6b7..624cbf00 100644
--- a/applications/desktop/views/desktop_view_slideshow.h
+++ b/applications/desktop/views/desktop_view_slideshow.h
@@ -3,6 +3,9 @@
#include <gui/view.h>
#include "desktop_events.h"
+#include "../helpers/slideshow_filename.h"
+
+#define SLIDESHOW_FS_PATH INT_PATH(SLIDESHOW_FILE_NAME)
typedef struct DesktopSlideshowView DesktopSlideshowView;
diff --git a/applications/dialogs/dialogs.c b/applications/dialogs/dialogs.c
index da047d8a..381da163 100644
--- a/applications/dialogs/dialogs.c
+++ b/applications/dialogs/dialogs.c
@@ -29,7 +29,7 @@ static void dialogs_app_process_message(DialogsApp* app, DialogsAppMessage* mess
int32_t dialogs_srv(void* p) {
UNUSED(p);
DialogsApp* app = dialogs_app_alloc();
- furi_record_create("dialogs", app);
+ furi_record_create(RECORD_DIALOGS, app);
DialogsAppMessage message;
while(1) {
diff --git a/applications/dialogs/dialogs.h b/applications/dialogs/dialogs.h
index 53606056..946ab6cf 100644
--- a/applications/dialogs/dialogs.h
+++ b/applications/dialogs/dialogs.h
@@ -9,6 +9,8 @@ extern "C" {
/****************** COMMON ******************/
+#define RECORD_DIALOGS "dialogs"
+
typedef struct DialogsApp DialogsApp;
/****************** FILE BROWSER ******************/
diff --git a/applications/dialogs/dialogs_module_file_browser.c b/applications/dialogs/dialogs_module_file_browser.c
index ecd0ca79..f5355571 100644
--- a/applications/dialogs/dialogs_module_file_browser.c
+++ b/applications/dialogs/dialogs_module_file_browser.c
@@ -23,7 +23,7 @@ static void dialogs_app_file_browser_callback(void* context) {
bool dialogs_app_process_module_file_browser(const DialogsAppMessageDataFileBrowser* data) {
bool ret = false;
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
DialogsAppFileBrowserContext* file_browser_context =
malloc(sizeof(DialogsAppFileBrowserContext));
@@ -53,7 +53,7 @@ bool dialogs_app_process_module_file_browser(const DialogsAppMessageDataFileBrow
file_browser_free(file_browser);
API_LOCK_FREE(file_browser_context->lock);
free(file_browser_context);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
return ret;
}
diff --git a/applications/dialogs/dialogs_module_message.c b/applications/dialogs/dialogs_module_message.c
index ec2efd2e..8d1c3ba7 100644
--- a/applications/dialogs/dialogs_module_message.c
+++ b/applications/dialogs/dialogs_module_message.c
@@ -54,7 +54,7 @@ static void dialogs_app_message_callback(DialogExResult result, void* context) {
DialogMessageButton dialogs_app_process_module_message(const DialogsAppMessageDataDialog* data) {
DialogMessageButton ret = DialogMessageButtonBack;
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
const DialogMessage* message = data->message;
DialogsAppMessageContext* message_context = malloc(sizeof(DialogsAppMessageContext));
message_context->lock = API_LOCK_INIT_LOCKED();
@@ -96,7 +96,7 @@ DialogMessageButton dialogs_app_process_module_message(const DialogsAppMessageDa
dialog_ex_free(dialog_ex);
API_LOCK_FREE(message_context->lock);
free(message_context);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
return ret;
}
diff --git a/applications/dolphin/dolphin.c b/applications/dolphin/dolphin.c
index f495068b..41eeef3b 100644
--- a/applications/dolphin/dolphin.c
+++ b/applications/dolphin/dolphin.c
@@ -155,7 +155,7 @@ static void dolphin_update_clear_limits_timer_period(Dolphin* dolphin) {
int32_t dolphin_srv(void* p) {
UNUSED(p);
Dolphin* dolphin = dolphin_alloc();
- furi_record_create("dolphin", dolphin);
+ furi_record_create(RECORD_DOLPHIN, dolphin);
dolphin_state_load(dolphin->state);
xTimerReset(dolphin->butthurt_timer, portMAX_DELAY);
diff --git a/applications/dolphin/dolphin.h b/applications/dolphin/dolphin.h
index 2abb166b..41a6a608 100644
--- a/applications/dolphin/dolphin.h
+++ b/applications/dolphin/dolphin.h
@@ -9,6 +9,8 @@
extern "C" {
#endif
+#define RECORD_DOLPHIN "dolphin"
+
typedef struct Dolphin Dolphin;
typedef struct {
diff --git a/applications/dolphin/helpers/dolphin_state.c b/applications/dolphin/helpers/dolphin_state.c
index 8a569392..76f38a5f 100644
--- a/applications/dolphin/helpers/dolphin_state.c
+++ b/applications/dolphin/helpers/dolphin_state.c
@@ -1,5 +1,7 @@
#include "dolphin_state.h"
#include "dolphin/helpers/dolphin_deed.h"
+#include "dolphin_state_filename.h"
+
#include <stdint.h>
#include <storage/storage.h>
#include <furi.h>
@@ -8,7 +10,8 @@
#include <toolbox/saved_struct.h>
#define TAG "DolphinState"
-#define DOLPHIN_STATE_PATH "/int/dolphin.state"
+
+#define DOLPHIN_STATE_PATH INT_PATH(DOLPHIN_STATE_FILE_NAME)
#define DOLPHIN_STATE_HEADER_MAGIC 0xD0
#define DOLPHIN_STATE_HEADER_VERSION 0x01
#define LEVEL2_THRESHOLD 735
diff --git a/applications/dolphin/helpers/dolphin_state_filename.h b/applications/dolphin/helpers/dolphin_state_filename.h
new file mode 100644
index 00000000..86822c0a
--- /dev/null
+++ b/applications/dolphin/helpers/dolphin_state_filename.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define DOLPHIN_STATE_FILE_NAME ".dolphin.state"
diff --git a/applications/dolphin/passport/passport.c b/applications/dolphin/passport/passport.c
index b9be2d22..d43f150c 100644
--- a/applications/dolphin/passport/passport.c
+++ b/applications/dolphin/passport/passport.c
@@ -95,12 +95,12 @@ int32_t passport_app(void* p) {
ViewPort* view_port = view_port_alloc();
- 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);
view_port_draw_callback_set(view_port, render_callback, &stats);
view_port_input_callback_set(view_port, input_callback, semaphore);
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
view_port_update(view_port);
@@ -108,7 +108,7 @@ int32_t passport_app(void* p) {
gui_remove_view_port(gui, view_port);
view_port_free(view_port);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
furi_semaphore_free(semaphore);
return 0;
diff --git a/applications/gpio/gpio_app.c b/applications/gpio/gpio_app.c
index b5f5184a..b8afdc8e 100644
--- a/applications/gpio/gpio_app.c
+++ b/applications/gpio/gpio_app.c
@@ -24,7 +24,7 @@ static void gpio_app_tick_event_callback(void* context) {
GpioApp* gpio_app_alloc() {
GpioApp* app = malloc(sizeof(GpioApp));
- app->gui = furi_record_open("gui");
+ app->gui = furi_record_open(RECORD_GUI);
app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&gpio_scene_handlers, app);
@@ -40,7 +40,7 @@ GpioApp* gpio_app_alloc() {
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);
- app->notifications = furi_record_open("notification");
+ app->notifications = furi_record_open(RECORD_NOTIFICATION);
app->var_item_list = variable_item_list_alloc();
view_dispatcher_add_view(
@@ -88,8 +88,8 @@ void gpio_app_free(GpioApp* app) {
scene_manager_free(app->scene_manager);
// Close records
- furi_record_close("gui");
- furi_record_close("notification");
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_NOTIFICATION);
free(app);
}
diff --git a/applications/gpio/usb_uart_bridge.c b/applications/gpio/usb_uart_bridge.c
index c51be513..4623c4af 100644
--- a/applications/gpio/usb_uart_bridge.c
+++ b/applications/gpio/usb_uart_bridge.c
@@ -86,15 +86,15 @@ static void usb_uart_on_irq_cb(UartIrqEvent ev, uint8_t data, void* context) {
static void usb_uart_vcp_init(UsbUartBridge* usb_uart, uint8_t vcp_ch) {
furi_hal_usb_unlock();
if(vcp_ch == 0) {
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_session_close(cli);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
furi_check(furi_hal_usb_set_config(&usb_cdc_single, NULL) == true);
} else {
furi_check(furi_hal_usb_set_config(&usb_cdc_dual, NULL) == true);
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_session_open(cli, &cli_vcp);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
}
furi_hal_cdc_set_callbacks(vcp_ch, (CdcCallbacks*)&cdc_cb, usb_uart);
}
@@ -103,9 +103,9 @@ static void usb_uart_vcp_deinit(UsbUartBridge* usb_uart, uint8_t vcp_ch) {
UNUSED(usb_uart);
furi_hal_cdc_set_callbacks(vcp_ch, NULL, NULL);
if(vcp_ch != 0) {
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_session_close(cli);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
}
}
@@ -276,9 +276,9 @@ static int32_t usb_uart_worker(void* context) {
furi_hal_usb_unlock();
furi_check(furi_hal_usb_set_config(&usb_cdc_single, NULL) == true);
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_session_open(cli, &cli_vcp);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
return 0;
}
diff --git a/applications/gui/gui.c b/applications/gui/gui.c
index 50df399a..6b4b9a0a 100644
--- a/applications/gui/gui.c
+++ b/applications/gui/gui.c
@@ -485,7 +485,7 @@ Gui* gui_alloc() {
// Input
gui->input_queue = furi_message_queue_alloc(8, sizeof(InputEvent));
- gui->input_events = furi_record_open("input_events");
+ gui->input_events = furi_record_open(RECORD_INPUT_EVENTS);
furi_check(gui->input_events);
furi_pubsub_subscribe(gui->input_events, gui_input_events_callback, gui);
@@ -497,7 +497,7 @@ int32_t gui_srv(void* p) {
UNUSED(p);
Gui* gui = gui_alloc();
- furi_record_create("gui", gui);
+ furi_record_create(RECORD_GUI, gui);
while(1) {
uint32_t flags =
diff --git a/applications/gui/gui.h b/applications/gui/gui.h
index e3235242..f4886758 100644
--- a/applications/gui/gui.h
+++ b/applications/gui/gui.h
@@ -29,6 +29,8 @@ typedef enum {
/** Gui Canvas Commit Callback */
typedef void (*GuiCanvasCommitCallback)(uint8_t* data, size_t size, void* context);
+#define RECORD_GUI "gui"
+
typedef struct Gui Gui;
/** Add view_port to view_port tree
diff --git a/applications/gui/modules/file_browser_worker.c b/applications/gui/modules/file_browser_worker.c
index ce3def41..d705e5c3 100644
--- a/applications/gui/modules/file_browser_worker.c
+++ b/applications/gui/modules/file_browser_worker.c
@@ -13,7 +13,7 @@
#define TAG "BrowserWorker"
#define ASSETS_DIR "assets"
-#define BROWSER_ROOT "/any"
+#define BROWSER_ROOT STORAGE_ANY_PATH_PREFIX
#define FILE_NAME_LEN_MAX 256
#define LONG_LOAD_THRESHOLD 100
@@ -53,13 +53,13 @@ struct BrowserWorker {
static bool browser_path_is_file(string_t path) {
bool state = false;
FileInfo file_info;
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_common_stat(storage, string_get_cstr(path), &file_info) == FSE_OK) {
if((file_info.flags & FSF_DIRECTORY) == 0) {
state = true;
}
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return state;
}
@@ -97,7 +97,7 @@ static bool browser_filter_by_name(BrowserWorker* browser, string_t name, bool i
static bool browser_folder_check_and_switch(string_t path) {
FileInfo file_info;
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool is_root = false;
while(1) {
// Check if folder is existing and navigate back if not
@@ -111,7 +111,7 @@ static bool browser_folder_check_and_switch(string_t path) {
}
is_root = browser_path_trim(path);
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return is_root;
}
@@ -125,7 +125,7 @@ static bool browser_folder_init(
FileInfo file_info;
uint32_t total_files_cnt = 0;
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* directory = storage_file_alloc(storage);
char name_temp[FILE_NAME_LEN_MAX];
@@ -167,7 +167,7 @@ static bool browser_folder_init(
storage_dir_close(directory);
storage_file_free(directory);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return state;
}
@@ -176,7 +176,7 @@ static bool
browser_folder_load(BrowserWorker* browser, string_t path, uint32_t offset, uint32_t count) {
FileInfo file_info;
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* directory = storage_file_alloc(storage);
char name_temp[FILE_NAME_LEN_MAX];
@@ -241,7 +241,7 @@ static bool
storage_dir_close(directory);
storage_file_free(directory);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return (items_cnt == count);
}
diff --git a/applications/gui/modules/validators.c b/applications/gui/modules/validators.c
index 546423d0..ac293f8c 100644
--- a/applications/gui/modules/validators.c
+++ b/applications/gui/modules/validators.c
@@ -21,7 +21,7 @@ bool validator_is_file_callback(const char* text, string_t error, void* context)
bool ret = true;
string_t path;
string_init_printf(path, "%s/%s%s", instance->app_path_folder, text, instance->app_extension);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_common_stat(storage, string_get_cstr(path), NULL) == FSE_OK) {
ret = false;
string_printf(error, "This name\nexists!\nChoose\nanother one.");
@@ -29,7 +29,7 @@ bool validator_is_file_callback(const char* text, string_t error, void* context)
ret = true;
}
string_clear(path);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return ret;
}
diff --git a/applications/ibutton/ibutton.c b/applications/ibutton/ibutton.c
index 0f14137c..30accd46 100644
--- a/applications/ibutton/ibutton.c
+++ b/applications/ibutton/ibutton.c
@@ -163,11 +163,11 @@ iButton* ibutton_alloc() {
view_dispatcher_set_tick_event_callback(
ibutton->view_dispatcher, ibutton_tick_event_callback, 100);
- ibutton->gui = furi_record_open("gui");
+ ibutton->gui = furi_record_open(RECORD_GUI);
- ibutton->storage = furi_record_open("storage");
- ibutton->dialogs = furi_record_open("dialogs");
- ibutton->notifications = furi_record_open("notification");
+ ibutton->storage = furi_record_open(RECORD_STORAGE);
+ ibutton->dialogs = furi_record_open(RECORD_DIALOGS);
+ ibutton->notifications = furi_record_open(RECORD_NOTIFICATION);
ibutton->key = ibutton_key_alloc();
ibutton->key_worker = ibutton_worker_alloc();
@@ -224,16 +224,16 @@ void ibutton_free(iButton* ibutton) {
view_dispatcher_free(ibutton->view_dispatcher);
scene_manager_free(ibutton->scene_manager);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
ibutton->storage = NULL;
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
ibutton->notifications = NULL;
- furi_record_close("dialogs");
+ furi_record_close(RECORD_DIALOGS);
ibutton->dialogs = NULL;
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
ibutton->gui = NULL;
ibutton_worker_stop_thread(ibutton->key_worker);
diff --git a/applications/ibutton/ibutton_cli.c b/applications/ibutton/ibutton_cli.c
index 324c636d..d36d3dff 100644
--- a/applications/ibutton/ibutton_cli.c
+++ b/applications/ibutton/ibutton_cli.c
@@ -12,10 +12,10 @@ static void onewire_cli(Cli* cli, string_t args, void* context);
// app cli function
void ibutton_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_add_command(cli, "ikey", CliCommandFlagDefault, ibutton_cli, cli);
cli_add_command(cli, "onewire", CliCommandFlagDefault, onewire_cli, cli);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#else
UNUSED(ibutton_cli);
UNUSED(onewire_cli);
diff --git a/applications/ibutton/ibutton_i.h b/applications/ibutton/ibutton_i.h
index 889d5a67..de3065c3 100644
--- a/applications/ibutton/ibutton_i.h
+++ b/applications/ibutton/ibutton_i.h
@@ -25,7 +25,7 @@
#define IBUTTON_FILE_NAME_SIZE 100
#define IBUTTON_TEXT_STORE_SIZE 128
-#define IBUTTON_APP_FOLDER "/any/ibutton"
+#define IBUTTON_APP_FOLDER ANY_PATH("ibutton")
#define IBUTTON_APP_EXTENSION ".ibtn"
#define IBUTTON_APP_FILE_TYPE "Flipper iButton key"
diff --git a/applications/infrared/infrared.c b/applications/infrared/infrared.c
index cd4c148c..f211f006 100644
--- a/applications/infrared/infrared.c
+++ b/applications/infrared/infrared.c
@@ -85,7 +85,7 @@ static bool
}
static void infrared_find_vacant_remote_name(string_t name, const char* path) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
string_t base_path;
string_init_set_str(base_path, path);
@@ -122,7 +122,7 @@ static void infrared_find_vacant_remote_name(string_t name, const char* path) {
}
string_clear(base_path);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static Infrared* infrared_alloc() {
@@ -140,7 +140,7 @@ static Infrared* infrared_alloc() {
infrared->scene_manager = scene_manager_alloc(&infrared_scene_handlers, infrared);
infrared->view_dispatcher = view_dispatcher_alloc();
- infrared->gui = furi_record_open("gui");
+ infrared->gui = furi_record_open(RECORD_GUI);
ViewDispatcher* view_dispatcher = infrared->view_dispatcher;
view_dispatcher_enable_queue(view_dispatcher);
@@ -149,9 +149,9 @@ static Infrared* infrared_alloc() {
view_dispatcher_set_navigation_event_callback(view_dispatcher, infrared_back_event_callback);
view_dispatcher_set_tick_event_callback(view_dispatcher, infrared_tick_event_callback, 100);
- infrared->storage = furi_record_open("storage");
- infrared->dialogs = furi_record_open("dialogs");
- infrared->notifications = furi_record_open("notification");
+ infrared->storage = furi_record_open(RECORD_STORAGE);
+ infrared->dialogs = furi_record_open(RECORD_DIALOGS);
+ infrared->notifications = furi_record_open(RECORD_NOTIFICATION);
infrared->worker = infrared_worker_alloc();
infrared->remote = infrared_remote_alloc();
@@ -242,16 +242,16 @@ static void infrared_free(Infrared* infrared) {
infrared_remote_free(infrared->remote);
infrared_worker_free(infrared->worker);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
infrared->gui = NULL;
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
infrared->notifications = NULL;
- furi_record_close("dialogs");
+ furi_record_close(RECORD_DIALOGS);
infrared->dialogs = NULL;
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
infrared->gui = NULL;
string_clear(infrared->file_path);
@@ -302,7 +302,7 @@ bool infrared_rename_current_remote(Infrared* infrared, const char* name) {
}
string_cat_printf(new_path, "/%s%s", string_get_cstr(new_name), INFRARED_APP_EXTENSION);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FS_Error status = storage_common_rename(
storage, infrared_remote_get_path(remote), string_get_cstr(new_path));
@@ -312,7 +312,7 @@ bool infrared_rename_current_remote(Infrared* infrared, const char* name) {
string_clear(new_name);
string_clear(new_path);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return (status == FSE_OK || status == FSE_EXIST);
}
diff --git a/applications/infrared/infrared_brute_force.c b/applications/infrared/infrared_brute_force.c
index 1e5f557a..8dbc2301 100644
--- a/applications/infrared/infrared_brute_force.c
+++ b/applications/infrared/infrared_brute_force.c
@@ -50,7 +50,7 @@ bool infrared_brute_force_calculate_messages(InfraredBruteForce* brute_force) {
furi_assert(brute_force->db_filename);
bool success = false;
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* ff = flipper_format_buffered_file_alloc(storage);
success = flipper_format_buffered_file_open_existing(ff, brute_force->db_filename);
@@ -68,7 +68,7 @@ bool infrared_brute_force_calculate_messages(InfraredBruteForce* brute_force) {
}
flipper_format_free(ff);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return success;
}
@@ -94,14 +94,14 @@ bool infrared_brute_force_start(
}
if(*record_count) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
brute_force->ff = flipper_format_buffered_file_alloc(storage);
success =
flipper_format_buffered_file_open_existing(brute_force->ff, brute_force->db_filename);
if(!success) {
flipper_format_free(brute_force->ff);
brute_force->ff = NULL;
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
}
return success;
@@ -117,7 +117,7 @@ void infrared_brute_force_stop(InfraredBruteForce* brute_force) {
string_reset(brute_force->current_record_name);
flipper_format_free(brute_force->ff);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
brute_force->ff = NULL;
}
diff --git a/applications/infrared/infrared_cli.c b/applications/infrared/infrared_cli.c
index a2dfc2a3..c190aad3 100644
--- a/applications/infrared/infrared_cli.c
+++ b/applications/infrared/infrared_cli.c
@@ -192,9 +192,9 @@ static void infrared_cli_start_ir(Cli* cli, string_t args, void* context) {
}
void infrared_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = (Cli*)furi_record_open("cli");
+ Cli* cli = (Cli*)furi_record_open(RECORD_CLI);
cli_add_command(cli, "ir", CliCommandFlagDefault, infrared_cli_start_ir, NULL);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#else
UNUSED(infrared_cli_start_ir);
#endif
diff --git a/applications/infrared/infrared_i.h b/applications/infrared/infrared_i.h
index c47753f8..d24cab06 100644
--- a/applications/infrared/infrared_i.h
+++ b/applications/infrared/infrared_i.h
@@ -39,7 +39,7 @@
#define INFRARED_MAX_BUTTON_NAME_LENGTH 22
#define INFRARED_MAX_REMOTE_NAME_LENGTH 22
-#define INFRARED_APP_FOLDER "/any/infrared"
+#define INFRARED_APP_FOLDER ANY_PATH("infrared")
#define INFRARED_APP_EXTENSION ".ir"
#define INFRARED_DEFAULT_REMOTE_NAME "Remote"
diff --git a/applications/infrared/infrared_remote.c b/applications/infrared/infrared_remote.c
index 957e2457..4417c3c7 100644
--- a/applications/infrared/infrared_remote.c
+++ b/applications/infrared/infrared_remote.c
@@ -110,7 +110,7 @@ bool infrared_remote_delete_button(InfraredRemote* remote, size_t index) {
}
bool infrared_remote_store(InfraredRemote* remote) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* ff = flipper_format_file_alloc(storage);
const char* path = string_get_cstr(remote->path);
@@ -134,12 +134,12 @@ bool infrared_remote_store(InfraredRemote* remote) {
}
flipper_format_free(ff);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return success;
}
bool infrared_remote_load(InfraredRemote* remote, string_t path) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* ff = flipper_format_buffered_file_alloc(storage);
string_t buf;
@@ -174,16 +174,16 @@ bool infrared_remote_load(InfraredRemote* remote, string_t path) {
string_clear(buf);
flipper_format_free(ff);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return success;
}
bool infrared_remote_remove(InfraredRemote* remote) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FS_Error status = storage_common_remove(storage, string_get_cstr(remote->path));
infrared_remote_reset(remote);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return (status == FSE_OK || status == FSE_NOT_EXIST);
}
diff --git a/applications/infrared/scenes/infrared_scene_universal_tv.c b/applications/infrared/scenes/infrared_scene_universal_tv.c
index 83b084c3..583f21fa 100644
--- a/applications/infrared/scenes/infrared_scene_universal_tv.c
+++ b/applications/infrared/scenes/infrared_scene_universal_tv.c
@@ -9,7 +9,7 @@ void infrared_scene_universal_tv_on_enter(void* context) {
ButtonPanel* button_panel = infrared->button_panel;
InfraredBruteForce* brute_force = infrared->brute_force;
- infrared_brute_force_set_db_filename(brute_force, "/ext/infrared/assets/tv.ir");
+ infrared_brute_force_set_db_filename(brute_force, EXT_PATH("infrared/assets/tv.ir"));
button_panel_reserve(button_panel, 2, 3);
uint32_t i = 0;
diff --git a/applications/input/input.c b/applications/input/input.c
index 7270a020..27e7bf21 100644
--- a/applications/input/input.c
+++ b/applications/input/input.c
@@ -68,10 +68,10 @@ int32_t input_srv() {
input = malloc(sizeof(Input));
input->thread_id = furi_thread_get_current_id();
input->event_pubsub = furi_pubsub_alloc();
- furi_record_create("input_events", input->event_pubsub);
+ furi_record_create(RECORD_INPUT_EVENTS, input->event_pubsub);
#ifdef SRV_CLI
- input->cli = furi_record_open("cli");
+ input->cli = furi_record_open(RECORD_CLI);
if(input->cli) {
cli_add_command(input->cli, "input", CliCommandFlagParallelSafe, input_cli, input);
}
diff --git a/applications/input/input.h b/applications/input/input.h
index ad5263a8..001ab1e2 100644
--- a/applications/input/input.h
+++ b/applications/input/input.h
@@ -7,6 +7,8 @@
#include <furi_hal_resources.h>
+#define RECORD_INPUT_EVENTS "input_events"
+
/** Input Types
* Some of them are physical events and some logical
*/
diff --git a/applications/lfrfid/lfrfid_app.cpp b/applications/lfrfid/lfrfid_app.cpp
index 2ba36ea3..329f052b 100644
--- a/applications/lfrfid/lfrfid_app.cpp
+++ b/applications/lfrfid/lfrfid_app.cpp
@@ -27,7 +27,7 @@
#include "rpc/rpc_app.h"
-const char* LfRfidApp::app_folder = "/any/lfrfid";
+const char* LfRfidApp::app_folder = ANY_PATH("lfrfid");
const char* LfRfidApp::app_extension = ".rfid";
const char* LfRfidApp::app_filetype = "Flipper RFID key";
diff --git a/applications/loader/loader.c b/applications/loader/loader.c
index f5db5586..3f4e876f 100644
--- a/applications/loader/loader.c
+++ b/applications/loader/loader.c
@@ -290,8 +290,9 @@ static Loader* loader_alloc() {
instance->pubsub = furi_pubsub_alloc();
#ifdef SRV_CLI
- instance->cli = furi_record_open("cli");
- cli_add_command(instance->cli, "loader", CliCommandFlagParallelSafe, loader_cli, instance);
+ instance->cli = furi_record_open(RECORD_CLI);
+ cli_add_command(
+ instance->cli, RECORD_LOADER, CliCommandFlagParallelSafe, loader_cli, instance);
#else
UNUSED(loader_cli);
#endif
@@ -299,7 +300,7 @@ static Loader* loader_alloc() {
instance->loader_thread = furi_thread_get_current_id();
// Gui
- instance->gui = furi_record_open("gui");
+ instance->gui = furi_record_open(RECORD_GUI);
instance->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_attach_to_gui(
instance->view_dispatcher, instance->gui, ViewDispatcherTypeFullscreen);
@@ -343,7 +344,7 @@ static void loader_free(Loader* instance) {
furi_assert(instance);
if(instance->cli) {
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
}
furi_pubsub_free(instance->pubsub);
@@ -360,7 +361,7 @@ static void loader_free(Loader* instance) {
view_dispatcher_remove_view(loader_instance->view_dispatcher, LoaderMenuViewSettings);
view_dispatcher_free(loader_instance->view_dispatcher);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
free(instance);
instance = NULL;
@@ -463,7 +464,7 @@ int32_t loader_srv(void* p) {
FURI_LOG_I(TAG, "Started");
- furi_record_create("loader", loader_instance);
+ furi_record_create(RECORD_LOADER, loader_instance);
#ifdef LOADER_AUTOSTART
loader_start(loader_instance, LOADER_AUTOSTART, NULL);
@@ -480,7 +481,7 @@ int32_t loader_srv(void* p) {
}
}
- furi_record_destroy("loader");
+ furi_record_destroy(RECORD_LOADER);
loader_free(loader_instance);
return 0;
diff --git a/applications/loader/loader.h b/applications/loader/loader.h
index 4bf835b4..8f95d81b 100644
--- a/applications/loader/loader.h
+++ b/applications/loader/loader.h
@@ -3,6 +3,8 @@
#include <core/pubsub.h>
#include <stdbool.h>
+#define RECORD_LOADER "loader"
+
typedef struct Loader Loader;
typedef enum {
diff --git a/applications/music_player/music_player.c b/applications/music_player/music_player.c
index 26dfb812..ffdd2bea 100644
--- a/applications/music_player/music_player.c
+++ b/applications/music_player/music_player.c
@@ -1,15 +1,18 @@
-#include "assets_icons.h"
-#include "m-string.h"
+#include "music_player_worker.h"
+
#include <furi.h>
#include <furi_hal.h>
+#include <assets_icons.h>
#include <gui/gui.h>
#include <dialogs/dialogs.h>
-#include "music_player_worker.h"
+#include <storage/storage.h>
+
+#include <m-string.h>
#define TAG "MusicPlayer"
-#define MUSIC_PLAYER_APP_PATH_FOLDER "/any/music_player"
+#define MUSIC_PLAYER_APP_PATH_FOLDER ANY_PATH("music_player")
#define MUSIC_PLAYER_APP_EXTENSION "*"
#define MUSIC_PLAYER_SEMITONE_HISTORY_SIZE 4
@@ -269,7 +272,7 @@ MusicPlayer* music_player_alloc() {
view_port_input_callback_set(instance->view_port, input_callback, instance);
// Open GUI and register view_port
- instance->gui = furi_record_open("gui");
+ instance->gui = furi_record_open(RECORD_GUI);
gui_add_view_port(instance->gui, instance->view_port, GuiLayerFullscreen);
return instance;
@@ -277,7 +280,7 @@ MusicPlayer* music_player_alloc() {
void music_player_free(MusicPlayer* instance) {
gui_remove_view_port(instance->gui, instance->view_port);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
view_port_free(instance->view_port);
music_player_worker_free(instance->worker);
@@ -302,7 +305,7 @@ int32_t music_player_app(void* p) {
} else {
string_set_str(file_path, MUSIC_PLAYER_APP_PATH_FOLDER);
- DialogsApp* dialogs = furi_record_open("dialogs");
+ DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS);
bool res = dialog_file_browser_show(
dialogs,
file_path,
@@ -312,7 +315,7 @@ int32_t music_player_app(void* p) {
&I_music_10px,
false);
- furi_record_close("dialogs");
+ furi_record_close(RECORD_DIALOGS);
if(!res) {
FURI_LOG_E(TAG, "No file selected");
break;
diff --git a/applications/music_player/music_player_cli.c b/applications/music_player/music_player_cli.c
index 986c8781..78200443 100644
--- a/applications/music_player/music_player_cli.c
+++ b/applications/music_player/music_player_cli.c
@@ -6,7 +6,7 @@
static void music_player_cli(Cli* cli, string_t args, void* context) {
UNUSED(context);
MusicPlayerWorker* music_player_worker = music_player_worker_alloc();
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
do {
if(storage_common_stat(storage, string_get_cstr(args), NULL) == FSE_OK) {
@@ -31,17 +31,17 @@ static void music_player_cli(Cli* cli, string_t args, void* context) {
music_player_worker_stop(music_player_worker);
} while(0);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
music_player_worker_free(music_player_worker);
}
void music_player_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_add_command(cli, "music_player", CliCommandFlagDefault, music_player_cli, NULL);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#else
UNUSED(music_player_cli);
#endif
diff --git a/applications/music_player/music_player_worker.c b/applications/music_player/music_player_worker.c
index 835745b7..ca4f1d8c 100644
--- a/applications/music_player/music_player_worker.c
+++ b/applications/music_player/music_player_worker.c
@@ -329,7 +329,7 @@ bool music_player_worker_load_fmf_from_file(MusicPlayerWorker* instance, const c
string_t temp_str;
string_init(temp_str);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* file = flipper_format_file_alloc(storage);
do {
@@ -367,7 +367,7 @@ bool music_player_worker_load_fmf_from_file(MusicPlayerWorker* instance, const c
result = true;
} while(false);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
flipper_format_free(file);
string_clear(temp_str);
@@ -381,7 +381,7 @@ bool music_player_worker_load_rtttl_from_file(MusicPlayerWorker* instance, const
bool result = false;
string_t content;
string_init(content);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(storage);
do {
@@ -414,7 +414,7 @@ bool music_player_worker_load_rtttl_from_file(MusicPlayerWorker* instance, const
} while(0);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
string_clear(content);
return result;
diff --git a/applications/nfc/helpers/nfc_debug_pcap.c b/applications/nfc/helpers/nfc_debug_pcap.c
index d340791b..48d72bfb 100644
--- a/applications/nfc/helpers/nfc_debug_pcap.c
+++ b/applications/nfc/helpers/nfc_debug_pcap.c
@@ -15,7 +15,7 @@
#define DATA_PICC_TO_PCD_CRC_DROPPED 0xFB
#define DATA_PCD_TO_PICC_CRC_DROPPED 0xFA
-#define NFC_DEBUG_PCAP_FILENAME "/ext/nfc/debug.pcap"
+#define NFC_DEBUG_PCAP_FILENAME EXT_PATH("nfc/debug.pcap")
#define NFC_DEBUG_PCAP_BUFFER_SIZE 64
struct NfcDebugPcapWorker {
diff --git a/applications/nfc/helpers/nfc_emv_parser.c b/applications/nfc/helpers/nfc_emv_parser.c
index 2e060999..0d7cb5a3 100755
--- a/applications/nfc/helpers/nfc_emv_parser.c
+++ b/applications/nfc/helpers/nfc_emv_parser.c
@@ -44,7 +44,7 @@ bool nfc_emv_parser_get_aid_name(
for(uint8_t i = 0; i < aid_len; i++) {
string_cat_printf(key, "%02X", aid[i]);
}
- if(nfc_emv_parser_search_data(storage, "/ext/nfc/assets/aid.nfc", key, aid_name)) {
+ if(nfc_emv_parser_search_data(storage, EXT_PATH("nfc/assets/aid.nfc"), key, aid_name)) {
parsed = true;
}
string_clear(key);
@@ -58,7 +58,8 @@ bool nfc_emv_parser_get_country_name(
bool parsed = false;
string_t key;
string_init_printf(key, "%04X", country_code);
- if(nfc_emv_parser_search_data(storage, "/ext/nfc/assets/country_code.nfc", key, country_name)) {
+ if(nfc_emv_parser_search_data(
+ storage, EXT_PATH("nfc/assets/country_code.nfc"), key, country_name)) {
parsed = true;
}
string_clear(key);
@@ -73,7 +74,7 @@ bool nfc_emv_parser_get_currency_name(
string_t key;
string_init_printf(key, "%04X", currency_code);
if(nfc_emv_parser_search_data(
- storage, "/ext/nfc/assets/currency_code.nfc", key, currency_name)) {
+ storage, EXT_PATH("nfc/assets/currency_code.nfc"), key, currency_name)) {
parsed = true;
}
string_clear(key);
diff --git a/applications/nfc/helpers/nfc_mf_classic_dict.c b/applications/nfc/helpers/nfc_mf_classic_dict.c
index e9cfff39..be77dede 100644
--- a/applications/nfc/helpers/nfc_mf_classic_dict.c
+++ b/applications/nfc/helpers/nfc_mf_classic_dict.c
@@ -3,7 +3,7 @@
#include <flipper_format/flipper_format.h>
#include <lib/toolbox/args.h>
-#define NFC_MF_CLASSIC_DICT_PATH "/ext/nfc/assets/mf_classic_dict.nfc"
+#define NFC_MF_CLASSIC_DICT_PATH EXT_PATH("nfc/assets/mf_classic_dict.nfc")
#define NFC_MF_CLASSIC_KEY_LEN (13)
diff --git a/applications/nfc/nfc.c b/applications/nfc/nfc.c
index fb739c61..f6af3573 100644
--- a/applications/nfc/nfc.c
+++ b/applications/nfc/nfc.c
@@ -108,10 +108,10 @@ Nfc* nfc_alloc() {
nfc->dev = nfc_device_alloc();
// Open GUI record
- nfc->gui = furi_record_open("gui");
+ nfc->gui = furi_record_open(RECORD_GUI);
// Open Notification record
- nfc->notifications = furi_record_open("notification");
+ nfc->notifications = furi_record_open(RECORD_NOTIFICATION);
// Submenu
nfc->submenu = submenu_alloc();
@@ -224,11 +224,11 @@ void nfc_free(Nfc* nfc) {
scene_manager_free(nfc->scene_manager);
// GUI
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
nfc->gui = NULL;
// Notifications
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
nfc->notifications = NULL;
free(nfc);
diff --git a/applications/nfc/nfc_cli.c b/applications/nfc/nfc_cli.c
index bed00776..133bd558 100755
--- a/applications/nfc/nfc_cli.c
+++ b/applications/nfc/nfc_cli.c
@@ -131,9 +131,9 @@ static void nfc_cli(Cli* cli, string_t args, void* context) {
void nfc_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_add_command(cli, "nfc", CliCommandFlagDefault, nfc_cli, NULL);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#else
UNUSED(nfc_cli);
#endif
diff --git a/applications/nfc/nfc_device.c b/applications/nfc/nfc_device.c
index e4f9ac56..a3bff23a 100644
--- a/applications/nfc/nfc_device.c
+++ b/applications/nfc/nfc_device.c
@@ -14,8 +14,8 @@ static const uint32_t nfc_mifare_classic_data_format_version = 1;
NfcDevice* nfc_device_alloc() {
NfcDevice* nfc_dev = malloc(sizeof(NfcDevice));
- nfc_dev->storage = furi_record_open("storage");
- nfc_dev->dialogs = furi_record_open("dialogs");
+ nfc_dev->storage = furi_record_open(RECORD_STORAGE);
+ nfc_dev->dialogs = furi_record_open(RECORD_DIALOGS);
string_init(nfc_dev->load_path);
return nfc_dev;
}
@@ -23,8 +23,8 @@ NfcDevice* nfc_device_alloc() {
void nfc_device_free(NfcDevice* nfc_dev) {
furi_assert(nfc_dev);
nfc_device_clear(nfc_dev);
- furi_record_close("storage");
- furi_record_close("dialogs");
+ furi_record_close(RECORD_STORAGE);
+ furi_record_close(RECORD_DIALOGS);
string_clear(nfc_dev->load_path);
free(nfc_dev);
}
diff --git a/applications/nfc/nfc_device.h b/applications/nfc/nfc_device.h
index fee9b07e..5ffca5ca 100644
--- a/applications/nfc/nfc_device.h
+++ b/applications/nfc/nfc_device.h
@@ -14,7 +14,7 @@
#define NFC_DEV_NAME_MAX_LEN 22
#define NFC_READER_DATA_MAX_SIZE 64
-#define NFC_APP_FOLDER "/any/nfc"
+#define NFC_APP_FOLDER ANY_PATH("nfc")
#define NFC_APP_EXTENSION ".nfc"
#define NFC_APP_SHADOW_EXTENSION ".shd"
diff --git a/applications/nfc/nfc_worker.c b/applications/nfc/nfc_worker.c
index 0ca26736..df1b5faf 100644
--- a/applications/nfc/nfc_worker.c
+++ b/applications/nfc/nfc_worker.c
@@ -19,7 +19,7 @@ NfcWorker* nfc_worker_alloc() {
nfc_worker->callback = NULL;
nfc_worker->context = NULL;
- nfc_worker->storage = furi_record_open("storage");
+ nfc_worker->storage = furi_record_open(RECORD_STORAGE);
// Initialize rfal
while(furi_hal_nfc_is_busy()) {
@@ -39,7 +39,7 @@ void nfc_worker_free(NfcWorker* nfc_worker) {
furi_thread_free(nfc_worker->thread);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
if(nfc_worker->debug_pcap_worker) nfc_debug_pcap_free(nfc_worker->debug_pcap_worker);
diff --git a/applications/notification/notification.h b/applications/notification/notification.h
index 14ca0ac2..b38620f0 100644
--- a/applications/notification/notification.h
+++ b/applications/notification/notification.h
@@ -7,6 +7,8 @@
extern "C" {
#endif
+#define RECORD_NOTIFICATION "notification"
+
typedef struct NotificationApp NotificationApp;
typedef struct {
float frequency;
diff --git a/applications/notification/notification_app.c b/applications/notification/notification_app.c
index 437d20ab..640bd7d7 100644
--- a/applications/notification/notification_app.c
+++ b/applications/notification/notification_app.c
@@ -398,7 +398,7 @@ void notification_process_internal_message(NotificationApp* app, NotificationApp
static bool notification_load_settings(NotificationApp* app) {
NotificationSettings settings;
- File* file = storage_file_alloc(furi_record_open("storage"));
+ File* file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
const size_t settings_size = sizeof(NotificationSettings);
FURI_LOG_I(TAG, "loading settings from \"%s\"", NOTIFICATION_SETTINGS_PATH);
@@ -430,14 +430,14 @@ static bool notification_load_settings(NotificationApp* app) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return fs_result;
};
static bool notification_save_settings(NotificationApp* app) {
NotificationSettings settings;
- File* file = storage_file_alloc(furi_record_open("storage"));
+ File* file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
const size_t settings_size = sizeof(NotificationSettings);
FURI_LOG_I(TAG, "saving settings to \"%s\"", NOTIFICATION_SETTINGS_PATH);
@@ -465,7 +465,7 @@ static bool notification_save_settings(NotificationApp* app) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return fs_result;
};
@@ -512,7 +512,7 @@ static NotificationApp* notification_app_alloc() {
app->settings.version = NOTIFICATION_SETTINGS_VERSION;
// display backlight control
- app->event_record = furi_record_open("input_events");
+ app->event_record = furi_record_open(RECORD_INPUT_EVENTS);
furi_pubsub_subscribe(app->event_record, input_event_callback, app);
notification_message(app, &sequence_display_backlight_on);
@@ -535,7 +535,7 @@ int32_t notification_srv(void* p) {
notification_apply_internal_led_layer(&app->led[1], 0x00);
notification_apply_internal_led_layer(&app->led[2], 0x00);
- furi_record_create("notification", app);
+ furi_record_create(RECORD_NOTIFICATION, app);
NotificationAppMessage message;
while(1) {
diff --git a/applications/notification/notification_app.h b/applications/notification/notification_app.h
index f5c7cc46..88194bfb 100644
--- a/applications/notification/notification_app.h
+++ b/applications/notification/notification_app.h
@@ -2,6 +2,7 @@
#include <furi_hal.h>
#include "notification.h"
#include "notification_messages.h"
+#include "notification_settings_filename.h"
#define NOTIFICATION_LED_COUNT 3
#define NOTIFICATION_EVENT_COMPLETE 0x00000001U
@@ -32,7 +33,7 @@ typedef struct {
} NotificationLedLayer;
#define NOTIFICATION_SETTINGS_VERSION 0x01
-#define NOTIFICATION_SETTINGS_PATH "/int/notification.settings"
+#define NOTIFICATION_SETTINGS_PATH INT_PATH(NOTIFICATION_SETTINGS_FILE_NAME)
typedef struct {
uint8_t version;
diff --git a/applications/notification/notification_settings_app.c b/applications/notification/notification_settings_app.c
index bcb1b6a2..894938f4 100644
--- a/applications/notification/notification_settings_app.c
+++ b/applications/notification/notification_settings_app.c
@@ -126,8 +126,8 @@ static uint32_t notification_app_settings_exit(void* context) {
static NotificationAppSettings* alloc_settings() {
NotificationAppSettings* app = malloc(sizeof(NotificationAppSettings));
- app->notification = furi_record_open("notification");
- app->gui = furi_record_open("gui");
+ app->notification = furi_record_open(RECORD_NOTIFICATION);
+ app->gui = furi_record_open(RECORD_GUI);
app->variable_item_list = variable_item_list_alloc();
View* view = variable_item_list_get_view(app->variable_item_list);
@@ -184,8 +184,8 @@ static void free_settings(NotificationAppSettings* app) {
variable_item_list_free(app->variable_item_list);
view_dispatcher_free(app->view_dispatcher);
- furi_record_close("gui");
- furi_record_close("notification");
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_NOTIFICATION);
free(app);
}
diff --git a/applications/notification/notification_settings_filename.h b/applications/notification/notification_settings_filename.h
new file mode 100644
index 00000000..d9ed596e
--- /dev/null
+++ b/applications/notification/notification_settings_filename.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define NOTIFICATION_SETTINGS_FILE_NAME ".notification.settings"
diff --git a/applications/picopass/picopass.c b/applications/picopass/picopass.c
index 19189548..8c0db4e2 100644
--- a/applications/picopass/picopass.c
+++ b/applications/picopass/picopass.c
@@ -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);
diff --git a/applications/picopass/picopass_device.c b/applications/picopass/picopass_device.c
index 75d9e290..9b422edd 100644
--- a/applications/picopass/picopass_device.c
+++ b/applications/picopass/picopass_device.c
@@ -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);
}
diff --git a/applications/picopass/picopass_device.h b/applications/picopass/picopass_device.h
index 326e58e6..89e031ca 100644
--- a/applications/picopass/picopass_device.h
+++ b/applications/picopass/picopass_device.h
@@ -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"
diff --git a/applications/picopass/picopass_worker.c b/applications/picopass/picopass_worker.c
index 7ecfbc3b..3079a98c 100644
--- a/applications/picopass/picopass_worker.c
+++ b/applications/picopass/picopass_worker.c
@@ -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);
}
diff --git a/applications/power/battery_test_app/battery_test_app.c b/applications/power/battery_test_app/battery_test_app.c
index f24de32b..0b5bc578 100755
--- a/applications/power/battery_test_app/battery_test_app.c
+++ b/applications/power/battery_test_app/battery_test_app.c
@@ -35,9 +35,9 @@ BatteryTestApp* battery_test_alloc() {
BatteryTestApp* app = malloc(sizeof(BatteryTestApp));
// Records
- app->gui = furi_record_open("gui");
- app->power = furi_record_open("power");
- app->notifications = furi_record_open("notification");
+ app->gui = furi_record_open(RECORD_GUI);
+ app->power = furi_record_open(RECORD_POWER);
+ app->notifications = furi_record_open(RECORD_NOTIFICATION);
// View dispatcher
app->view_dispatcher = view_dispatcher_alloc();
@@ -82,9 +82,9 @@ void battery_test_free(BatteryTestApp* app) {
// View dispatcher
view_dispatcher_free(app->view_dispatcher);
// Records
- furi_record_close("power");
- furi_record_close("gui");
- furi_record_close("notification");
+ furi_record_close(RECORD_POWER);
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_NOTIFICATION);
free(app);
}
diff --git a/applications/power/power_cli.c b/applications/power/power_cli.c
index 8c6a986d..6af39631 100644
--- a/applications/power/power_cli.c
+++ b/applications/power/power_cli.c
@@ -8,7 +8,7 @@
void power_cli_off(Cli* cli, string_t args) {
UNUSED(cli);
UNUSED(args);
- Power* power = furi_record_open("power");
+ Power* power = furi_record_open(RECORD_POWER);
printf("It's now safe to disconnect USB from your flipper\r\n");
furi_delay_ms(666);
power_off(power);
@@ -138,11 +138,11 @@ void power_cli(Cli* cli, string_t args, void* context) {
void power_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_add_command(cli, "power", CliCommandFlagParallelSafe, power_cli, NULL);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#else
UNUSED(power_cli);
#endif
diff --git a/applications/power/power_service/power.c b/applications/power/power_service/power.c
index 991c2a81..ac68bfd7 100644
--- a/applications/power/power_service/power.c
+++ b/applications/power/power_service/power.c
@@ -41,8 +41,8 @@ Power* power_alloc() {
Power* power = malloc(sizeof(Power));
// Records
- power->notification = furi_record_open("notification");
- power->gui = furi_record_open("gui");
+ power->notification = furi_record_open(RECORD_NOTIFICATION);
+ power->gui = furi_record_open(RECORD_GUI);
// Pubsub
power->event_pubsub = furi_pubsub_alloc();
@@ -89,8 +89,8 @@ void power_free(Power* power) {
furi_pubsub_free(power->event_pubsub);
// Records
- furi_record_close("notification");
- furi_record_close("gui");
+ furi_record_close(RECORD_NOTIFICATION);
+ furi_record_close(RECORD_GUI);
free(power);
}
@@ -203,7 +203,7 @@ int32_t power_srv(void* p) {
(void)p;
Power* power = power_alloc();
power_update_info(power);
- furi_record_create("power", power);
+ furi_record_create(RECORD_POWER, power);
while(1) {
// Update data from gauge and charger
diff --git a/applications/power/power_service/power.h b/applications/power/power_service/power.h
index cea1663f..c516f28f 100644
--- a/applications/power/power_service/power.h
+++ b/applications/power/power_service/power.h
@@ -4,6 +4,8 @@
#include <core/pubsub.h>
#include <stdbool.h>
+#define RECORD_POWER "power"
+
typedef struct Power Power;
typedef enum {
diff --git a/applications/power/power_settings_app/power_settings_app.c b/applications/power/power_settings_app/power_settings_app.c
index 3edf3837..92c63704 100644
--- a/applications/power/power_settings_app/power_settings_app.c
+++ b/applications/power/power_settings_app/power_settings_app.c
@@ -22,8 +22,8 @@ PowerSettingsApp* power_settings_app_alloc(uint32_t first_scene) {
PowerSettingsApp* app = malloc(sizeof(PowerSettingsApp));
// Records
- app->gui = furi_record_open("gui");
- app->power = furi_record_open("power");
+ app->gui = furi_record_open(RECORD_GUI);
+ app->power = furi_record_open(RECORD_POWER);
// View dispatcher
app->view_dispatcher = view_dispatcher_alloc();
@@ -69,8 +69,8 @@ void power_settings_app_free(PowerSettingsApp* app) {
view_dispatcher_free(app->view_dispatcher);
scene_manager_free(app->scene_manager);
// Records
- furi_record_close("power");
- furi_record_close("gui");
+ furi_record_close(RECORD_POWER);
+ furi_record_close(RECORD_GUI);
free(app);
}
diff --git a/applications/rpc/rpc.c b/applications/rpc/rpc.c
index a85d0a42..f241a678 100644
--- a/applications/rpc/rpc.c
+++ b/applications/rpc/rpc.c
@@ -655,11 +655,11 @@ int32_t rpc_srv(void* p) {
rpc->busy_mutex = furi_mutex_alloc(FuriMutexTypeNormal);
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_add_command(
cli, "start_rpc_session", CliCommandFlagParallelSafe, rpc_cli_command_start_session, rpc);
- furi_record_create("rpc", rpc);
+ furi_record_create(RECORD_RPC, rpc);
return 0;
}
diff --git a/applications/rpc/rpc.h b/applications/rpc/rpc.h
index 38dd9af3..dea8b749 100644
--- a/applications/rpc/rpc.h
+++ b/applications/rpc/rpc.h
@@ -8,6 +8,8 @@
#define RPC_BUFFER_SIZE (1024)
#define RPC_MAX_MESSAGE_SIZE (1536)
+#define RECORD_RPC "rpc"
+
/** Rpc interface. Used for opening session only. */
typedef struct Rpc Rpc;
/** Rpc session interface */
diff --git a/applications/rpc/rpc_app.c b/applications/rpc/rpc_app.c
index 525eedcf..e349e61c 100644
--- a/applications/rpc/rpc_app.c
+++ b/applications/rpc/rpc_app.c
@@ -39,7 +39,7 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
PB_CommandStatus result = PB_CommandStatus_ERROR_APP_CANT_START;
- Loader* loader = furi_record_open("loader");
+ Loader* loader = furi_record_open(RECORD_LOADER);
const char* app_name = request->content.app_start_request.name;
if(app_name) {
const char* app_args = request->content.app_start_request.args;
@@ -64,7 +64,7 @@ static void rpc_system_app_start_process(const PB_Main* request, void* context)
result = PB_CommandStatus_ERROR_INVALID_PARAMETERS;
}
- furi_record_close("loader");
+ furi_record_close(RECORD_LOADER);
rpc_send_and_release_empty(session, request->command_id, result);
}
@@ -80,7 +80,7 @@ static void rpc_system_app_lock_status_process(const PB_Main* request, void* con
FURI_LOG_D(TAG, "LockStatus");
- Loader* loader = furi_record_open("loader");
+ Loader* loader = furi_record_open(RECORD_LOADER);
PB_Main response = {
.has_next = false,
@@ -91,7 +91,7 @@ static void rpc_system_app_lock_status_process(const PB_Main* request, void* con
response.content.app_lock_status_response.locked = loader_is_locked(loader);
- furi_record_close("loader");
+ furi_record_close(RECORD_LOADER);
rpc_send_and_release(session, &response);
pb_release(&PB_Main_msg, &response);
diff --git a/applications/rpc/rpc_gui.c b/applications/rpc/rpc_gui.c
index 62a232d8..029ed010 100644
--- a/applications/rpc/rpc_gui.c
+++ b/applications/rpc/rpc_gui.c
@@ -198,10 +198,10 @@ static void
return;
}
- FuriPubSub* input_events = furi_record_open("input_events");
+ FuriPubSub* input_events = furi_record_open(RECORD_INPUT_EVENTS);
furi_check(input_events);
furi_pubsub_publish(input_events, &event);
- furi_record_close("input_events");
+ furi_record_close(RECORD_INPUT_EVENTS);
rpc_send_and_release_empty(session, request->command_id, PB_CommandStatus_OK);
}
@@ -317,7 +317,7 @@ void* rpc_system_gui_alloc(RpcSession* session) {
furi_assert(session);
RpcGuiSystem* rpc_gui = malloc(sizeof(RpcGuiSystem));
- rpc_gui->gui = furi_record_open("gui");
+ rpc_gui->gui = furi_record_open(RECORD_GUI);
rpc_gui->session = session;
RpcHandler rpc_handler = {
@@ -374,6 +374,6 @@ void rpc_system_gui_free(void* context) {
free(rpc_gui->transmit_frame);
rpc_gui->transmit_frame = NULL;
}
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
free(rpc_gui);
}
diff --git a/applications/rpc/rpc_storage.c b/applications/rpc/rpc_storage.c
index 4ab681ae..89c94b03 100644
--- a/applications/rpc/rpc_storage.c
+++ b/applications/rpc/rpc_storage.c
@@ -49,7 +49,7 @@ static void rpc_system_storage_reset_state(
if(rpc_storage->state == RpcStorageStateWriting) {
storage_file_close(rpc_storage->file);
storage_file_free(rpc_storage->file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
rpc_storage->state = RpcStorageStateIdle;
@@ -117,7 +117,7 @@ static void rpc_system_storage_info_process(const PB_Main* request, void* contex
PB_Main* response = malloc(sizeof(PB_Main));
response->command_id = request->command_id;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
FS_Error error = storage_common_fs_info(
fs_api,
@@ -134,7 +134,7 @@ static void rpc_system_storage_info_process(const PB_Main* request, void* contex
rpc_send_and_release(session, response);
free(response);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void rpc_system_storage_stat_process(const PB_Main* request, void* context) {
@@ -153,7 +153,7 @@ static void rpc_system_storage_stat_process(const PB_Main* request, void* contex
PB_Main* response = malloc(sizeof(PB_Main));
response->command_id = request->command_id;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
const char* path = request->content.storage_stat_request.path;
FileInfo fileinfo;
@@ -173,7 +173,7 @@ static void rpc_system_storage_stat_process(const PB_Main* request, void* contex
rpc_send_and_release(session, response);
free(response);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void rpc_system_storage_list_root(const PB_Main* request, void* context) {
@@ -222,7 +222,7 @@ static void rpc_system_storage_list_process(const PB_Main* request, void* contex
return;
}
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* dir = storage_file_alloc(fs_api);
PB_Main response = {
@@ -276,7 +276,7 @@ static void rpc_system_storage_list_process(const PB_Main* request, void* contex
storage_dir_close(dir);
storage_file_free(dir);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void rpc_system_storage_read_process(const PB_Main* request, void* context) {
@@ -295,7 +295,7 @@ static void rpc_system_storage_read_process(const PB_Main* request, void* contex
/* use same message memory to send reponse */
PB_Main* response = malloc(sizeof(PB_Main));
const char* path = request->content.storage_read_request.path;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
bool result = false;
@@ -335,7 +335,7 @@ static void rpc_system_storage_read_process(const PB_Main* request, void* contex
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void rpc_system_storage_write_process(const PB_Main* request, void* context) {
@@ -365,7 +365,7 @@ static void rpc_system_storage_write_process(const PB_Main* request, void* conte
}
if(rpc_storage->state != RpcStorageStateWriting) {
- rpc_storage->api = furi_record_open("storage");
+ rpc_storage->api = furi_record_open(RECORD_STORAGE);
rpc_storage->file = storage_file_alloc(rpc_storage->api);
rpc_storage->current_command_id = request->command_id;
rpc_storage->state = RpcStorageStateWriting;
@@ -433,7 +433,7 @@ static void rpc_system_storage_delete_process(const PB_Main* request, void* cont
PB_CommandStatus status = PB_CommandStatus_ERROR;
rpc_system_storage_reset_state(rpc_storage, session, true);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
char* path = request->content.storage_delete_request.path;
if(!path) {
@@ -456,7 +456,7 @@ static void rpc_system_storage_delete_process(const PB_Main* request, void* cont
}
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
rpc_send_and_release_empty(session, request->command_id, status);
}
@@ -474,7 +474,7 @@ static void rpc_system_storage_mkdir_process(const PB_Main* request, void* conte
PB_CommandStatus status;
rpc_system_storage_reset_state(rpc_storage, session, true);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
char* path = request->content.storage_mkdir_request.path;
if(path) {
if(path_contains_only_ascii(path)) {
@@ -486,7 +486,7 @@ static void rpc_system_storage_mkdir_process(const PB_Main* request, void* conte
} else {
status = PB_CommandStatus_ERROR_INVALID_PARAMETERS;
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
rpc_send_and_release_empty(session, request->command_id, status);
}
@@ -510,7 +510,7 @@ static void rpc_system_storage_md5sum_process(const PB_Main* request, void* cont
return;
}
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
if(storage_file_open(file, filename, FSAM_READ, FSOM_OPEN_EXISTING)) {
@@ -555,7 +555,7 @@ static void rpc_system_storage_md5sum_process(const PB_Main* request, void* cont
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void rpc_system_storage_rename_process(const PB_Main* request, void* context) {
@@ -572,7 +572,7 @@ static void rpc_system_storage_rename_process(const PB_Main* request, void* cont
PB_CommandStatus status;
rpc_system_storage_reset_state(rpc_storage, session, true);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
if(path_contains_only_ascii(request->content.storage_rename_request.new_path)) {
FS_Error error = storage_common_rename(
@@ -584,7 +584,7 @@ static void rpc_system_storage_rename_process(const PB_Main* request, void* cont
status = PB_CommandStatus_ERROR_STORAGE_INVALID_NAME;
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
rpc_send_and_release_empty(session, request->command_id, status);
}
@@ -601,13 +601,13 @@ static void rpc_system_storage_backup_create_process(const PB_Main* request, voi
response->command_id = request->command_id;
response->has_next = false;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
bool backup_ok =
lfs_backup_create(fs_api, request->content.storage_backup_create_request.archive_path);
response->command_status = backup_ok ? PB_CommandStatus_OK : PB_CommandStatus_ERROR;
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
rpc_send_and_release(session, response);
free(response);
@@ -627,13 +627,13 @@ static void rpc_system_storage_backup_restore_process(const PB_Main* request, vo
response->has_next = false;
response->command_status = PB_CommandStatus_OK;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
bool backup_ok =
lfs_backup_unpack(fs_api, request->content.storage_backup_restore_request.archive_path);
response->command_status = backup_ok ? PB_CommandStatus_OK : PB_CommandStatus_ERROR;
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
rpc_send_and_release(session, response);
free(response);
@@ -643,7 +643,7 @@ void* rpc_system_storage_alloc(RpcSession* session) {
furi_assert(session);
RpcStorageSystem* rpc_storage = malloc(sizeof(RpcStorageSystem));
- rpc_storage->api = furi_record_open("storage");
+ rpc_storage->api = furi_record_open(RECORD_STORAGE);
rpc_storage->session = session;
rpc_storage->state = RpcStorageStateIdle;
diff --git a/applications/rpc/rpc_system.c b/applications/rpc/rpc_system.c
index 350602fd..38a28828 100644
--- a/applications/rpc/rpc_system.c
+++ b/applications/rpc/rpc_system.c
@@ -193,9 +193,9 @@ static void
RpcSession* session = (RpcSession*)context;
furi_assert(session);
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
notification_message(notification, &sequence_audiovisual_alert);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
rpc_send_and_release_empty(session, request->command_id, PB_CommandStatus_OK);
}
diff --git a/applications/snake_game/snake_game.c b/applications/snake_game/snake_game.c
index bfd31ced..b7aabb17 100644
--- a/applications/snake_game/snake_game.c
+++ b/applications/snake_game/snake_game.c
@@ -304,7 +304,7 @@ int32_t snake_game_app(void* p) {
furi_timer_start(timer, furi_kernel_get_tick_frequency() / 4);
// Open GUI and register view_port
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, view_port, GuiLayerFullscreen);
SnakeEvent event;
@@ -354,7 +354,7 @@ int32_t snake_game_app(void* p) {
furi_timer_free(timer);
view_port_enabled_set(view_port, false);
gui_remove_view_port(gui, view_port);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
view_port_free(view_port);
furi_message_queue_free(event_queue);
delete_mutex(&state_mutex);
diff --git a/applications/storage/storage.c b/applications/storage/storage.c
index 90a191a2..9079a95e 100644
--- a/applications/storage/storage.c
+++ b/applications/storage/storage.c
@@ -11,7 +11,7 @@
#define ICON_SD_MOUNTED &I_SDcardMounted_11x8
#define ICON_SD_ERROR &I_SDcardFail_11x8
-#define TAG "Storage"
+#define TAG RECORD_STORAGE
static void storage_app_sd_icon_draw_callback(Canvas* canvas, void* context) {
furi_assert(canvas);
@@ -52,9 +52,9 @@ Storage* storage_app_alloc() {
view_port_draw_callback_set(app->sd_gui.view_port, storage_app_sd_icon_draw_callback, app);
view_port_enabled_set(app->sd_gui.view_port, false);
- Gui* gui = furi_record_open("gui");
+ Gui* gui = furi_record_open(RECORD_GUI);
gui_add_view_port(gui, app->sd_gui.view_port, GuiLayerStatusBarLeft);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
return app;
}
@@ -102,7 +102,7 @@ void storage_tick(Storage* app) {
int32_t storage_srv(void* p) {
UNUSED(p);
Storage* app = storage_app_alloc();
- furi_record_create("storage", app);
+ furi_record_create(RECORD_STORAGE, app);
StorageMessage message;
while(1) {
diff --git a/applications/storage/storage.h b/applications/storage/storage.h
index dcb8deee..55a951d1 100644
--- a/applications/storage/storage.h
+++ b/applications/storage/storage.h
@@ -8,6 +8,16 @@
extern "C" {
#endif
+#define STORAGE_INT_PATH_PREFIX "/int"
+#define STORAGE_EXT_PATH_PREFIX "/ext"
+#define STORAGE_ANY_PATH_PREFIX "/any"
+
+#define INT_PATH(path) STORAGE_INT_PATH_PREFIX "/" path
+#define EXT_PATH(path) STORAGE_EXT_PATH_PREFIX "/" path
+#define ANY_PATH(path) STORAGE_ANY_PATH_PREFIX "/" path
+
+#define RECORD_STORAGE "storage"
+
typedef struct Storage Storage;
/** Allocates and initializes a file descriptor
@@ -273,6 +283,8 @@ FS_Error storage_sd_status(Storage* api);
/******************* Internal LFS Functions *******************/
+typedef void (*Storage_name_converter)(string_t);
+
/** Backs up internal storage to a tar archive
* @param api pointer to the api
* @param dstmane destination archive path
@@ -283,9 +295,10 @@ FS_Error storage_int_backup(Storage* api, const char* dstname);
/** Restores internal storage from a tar archive
* @param api pointer to the api
* @param dstmane archive path
+ * @param converter pointer to filename conversion function, may be NULL
* @return FS_Error operation result
*/
-FS_Error storage_int_restore(Storage* api, const char* dstname);
+FS_Error storage_int_restore(Storage* api, const char* dstname, Storage_name_converter converter);
/***************** Simplified Functions ******************/
diff --git a/applications/storage/storage_cli.c b/applications/storage/storage_cli.c
index dd423cc6..63b9a54b 100644
--- a/applications/storage/storage_cli.c
+++ b/applications/storage/storage_cli.c
@@ -40,12 +40,13 @@ static void storage_cli_print_error(FS_Error error) {
static void storage_cli_info(Cli* cli, string_t path) {
UNUSED(cli);
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
- if(string_cmp_str(path, "/int") == 0) {
+ if(string_cmp_str(path, STORAGE_INT_PATH_PREFIX) == 0) {
uint64_t total_space;
uint64_t free_space;
- FS_Error error = storage_common_fs_info(api, "/int", &total_space, &free_space);
+ FS_Error error =
+ storage_common_fs_info(api, STORAGE_INT_PATH_PREFIX, &total_space, &free_space);
if(error != FSE_OK) {
storage_cli_print_error(error);
@@ -56,7 +57,7 @@ static void storage_cli_info(Cli* cli, string_t path) {
(uint32_t)(total_space / 1024),
(uint32_t)(free_space / 1024));
}
- } else if(string_cmp_str(path, "/ext") == 0) {
+ } else if(string_cmp_str(path, STORAGE_EXT_PATH_PREFIX) == 0) {
SDInfo sd_info;
FS_Error error = storage_sd_info(api, &sd_info);
@@ -74,17 +75,17 @@ static void storage_cli_info(Cli* cli, string_t path) {
storage_cli_print_usage();
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
};
static void storage_cli_format(Cli* cli, string_t path) {
- if(string_cmp_str(path, "/int") == 0) {
+ if(string_cmp_str(path, STORAGE_INT_PATH_PREFIX) == 0) {
storage_cli_print_error(FSE_NOT_IMPLEMENTED);
- } else if(string_cmp_str(path, "/ext") == 0) {
+ } else if(string_cmp_str(path, STORAGE_EXT_PATH_PREFIX) == 0) {
printf("Formatting SD card, all data will be lost. Are you sure (y/n)?\r\n");
char answer = cli_getc(cli);
if(answer == 'y' || answer == 'Y') {
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
printf("Formatting, please wait...\r\n");
FS_Error error = storage_sd_format(api);
@@ -94,7 +95,7 @@ static void storage_cli_format(Cli* cli, string_t path) {
} else {
printf("SD card was successfully formatted.\r\n");
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
} else {
printf("Cancelled.\r\n");
}
@@ -110,7 +111,7 @@ static void storage_cli_list(Cli* cli, string_t path) {
printf("\t[D] ext\r\n");
printf("\t[D] any\r\n");
} else {
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(api);
if(storage_dir_open(file, string_get_cstr(path))) {
@@ -136,18 +137,18 @@ static void storage_cli_list(Cli* cli, string_t path) {
storage_dir_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
}
static void storage_cli_tree(Cli* cli, string_t path) {
if(string_cmp_str(path, "/") == 0) {
- string_set(path, "/int");
+ string_set(path, STORAGE_INT_PATH_PREFIX);
storage_cli_tree(cli, path);
- string_set(path, "/ext");
+ string_set(path, STORAGE_EXT_PATH_PREFIX);
storage_cli_tree(cli, path);
} else {
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
DirWalk* dir_walk = dir_walk_alloc(api);
string_t name;
string_init(name);
@@ -174,13 +175,13 @@ static void storage_cli_tree(Cli* cli, string_t path) {
string_clear(name);
dir_walk_free(dir_walk);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
}
static void storage_cli_read(Cli* cli, string_t path) {
UNUSED(cli);
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(api);
if(storage_file_open(file, string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
@@ -206,11 +207,11 @@ static void storage_cli_read(Cli* cli, string_t path) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_cli_write(Cli* cli, string_t path) {
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(api);
const uint16_t buffer_size = 512;
@@ -260,11 +261,11 @@ static void storage_cli_write(Cli* cli, string_t path) {
free(buffer);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_cli_read_chunks(Cli* cli, string_t path, string_t args) {
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(api);
uint32_t buffer_size;
@@ -298,11 +299,11 @@ static void storage_cli_read_chunks(Cli* cli, string_t path, string_t args) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_cli_write_chunk(Cli* cli, string_t path, string_t args) {
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(api);
uint32_t buffer_size;
@@ -334,18 +335,19 @@ static void storage_cli_write_chunk(Cli* cli, string_t path, string_t args) {
}
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_cli_stat(Cli* cli, string_t path) {
UNUSED(cli);
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
if(string_cmp_str(path, "/") == 0) {
printf("Storage\r\n");
} else if(
- string_cmp_str(path, "/ext") == 0 || string_cmp_str(path, "/int") == 0 ||
- string_cmp_str(path, "/any") == 0) {
+ string_cmp_str(path, STORAGE_EXT_PATH_PREFIX) == 0 ||
+ string_cmp_str(path, STORAGE_INT_PATH_PREFIX) == 0 ||
+ string_cmp_str(path, STORAGE_ANY_PATH_PREFIX) == 0) {
uint64_t total_space;
uint64_t free_space;
FS_Error error =
@@ -374,12 +376,12 @@ static void storage_cli_stat(Cli* cli, string_t path) {
}
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_cli_copy(Cli* cli, string_t old_path, string_t args) {
UNUSED(cli);
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
string_t new_path;
string_init(new_path);
@@ -395,24 +397,24 @@ static void storage_cli_copy(Cli* cli, string_t old_path, string_t args) {
}
string_clear(new_path);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_cli_remove(Cli* cli, string_t path) {
UNUSED(cli);
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
FS_Error error = storage_common_remove(api, string_get_cstr(path));
if(error != FSE_OK) {
storage_cli_print_error(error);
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_cli_rename(Cli* cli, string_t old_path, string_t args) {
UNUSED(cli);
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
string_t new_path;
string_init(new_path);
@@ -428,24 +430,24 @@ static void storage_cli_rename(Cli* cli, string_t old_path, string_t args) {
}
string_clear(new_path);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_cli_mkdir(Cli* cli, string_t path) {
UNUSED(cli);
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
FS_Error error = storage_common_mkdir(api, string_get_cstr(path));
if(error != FSE_OK) {
storage_cli_print_error(error);
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_cli_md5(Cli* cli, string_t path) {
UNUSED(cli);
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(api);
if(storage_file_open(file, string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) {
@@ -478,7 +480,7 @@ static void storage_cli_md5(Cli* cli, string_t path) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
void storage_cli(Cli* cli, string_t args, void* context) {
@@ -592,11 +594,11 @@ static void storage_cli_factory_reset(Cli* cli, string_t args, void* context) {
void storage_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = furi_record_open("cli");
- cli_add_command(cli, "storage", CliCommandFlagParallelSafe, storage_cli, NULL);
+ Cli* cli = furi_record_open(RECORD_CLI);
+ cli_add_command(cli, RECORD_STORAGE, CliCommandFlagParallelSafe, storage_cli, NULL);
cli_add_command(
cli, "factory_reset", CliCommandFlagParallelSafe, storage_cli_factory_reset, NULL);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#else
UNUSED(storage_cli_factory_reset);
#endif
diff --git a/applications/storage/storage_external_api.c b/applications/storage/storage_external_api.c
index 426fac9a..b32080df 100644
--- a/applications/storage/storage_external_api.c
+++ b/applications/storage/storage_external_api.c
@@ -447,17 +447,16 @@ static FS_Error
storage_merge_recursive(Storage* storage, const char* old_path, const char* new_path) {
FS_Error error = storage_common_mkdir(storage, new_path);
DirWalk* dir_walk = dir_walk_alloc(storage);
- string_t path;
- string_t tmp_new_path;
- string_t tmp_old_path;
+ string_t path, file_basename, tmp_new_path;
FileInfo fileinfo;
string_init(path);
+ string_init(file_basename);
string_init(tmp_new_path);
- string_init(tmp_old_path);
do {
if((error != FSE_OK) && (error != FSE_EXIST)) break;
+ dir_walk_set_recursive(dir_walk, false);
if(!dir_walk_open(dir_walk, old_path)) {
error = dir_walk_get_error(dir_walk);
break;
@@ -472,30 +471,33 @@ static FS_Error
} else if(res == DirWalkLast) {
break;
} else {
- string_set(tmp_old_path, path);
- string_right(path, strlen(old_path));
- string_printf(tmp_new_path, "%s%s", new_path, string_get_cstr(path));
+ path_extract_basename(string_get_cstr(path), file_basename);
+ path_concat(new_path, string_get_cstr(file_basename), tmp_new_path);
if(fileinfo.flags & FSF_DIRECTORY) {
if(storage_common_stat(storage, string_get_cstr(tmp_new_path), &fileinfo) ==
FSE_OK) {
if(fileinfo.flags & FSF_DIRECTORY) {
error = storage_common_mkdir(storage, string_get_cstr(tmp_new_path));
+ if(error != FSE_OK) {
+ break;
+ }
}
}
- } else {
- error = storage_common_merge(
- storage, string_get_cstr(tmp_old_path), string_get_cstr(tmp_new_path));
}
+ error = storage_common_merge(
+ storage, string_get_cstr(path), string_get_cstr(tmp_new_path));
- if(error != FSE_OK) break;
+ if(error != FSE_OK) {
+ break;
+ }
}
}
} while(false);
string_clear(tmp_new_path);
- string_clear(tmp_old_path);
+ string_clear(file_basename);
string_clear(path);
dir_walk_free(dir_walk);
return error;
diff --git a/applications/storage/storage_internal_api.c b/applications/storage/storage_internal_api.c
index 09314043..620eae36 100644
--- a/applications/storage/storage_internal_api.c
+++ b/applications/storage/storage_internal_api.c
@@ -3,20 +3,19 @@
#include "storage.h"
#include <toolbox/tar/tar_archive.h>
-#define INT_PATH "/int"
-
FS_Error storage_int_backup(Storage* api, const char* dstname) {
TarArchive* archive = tar_archive_alloc(api);
bool success = tar_archive_open(archive, dstname, TAR_OPEN_MODE_WRITE) &&
- tar_archive_add_dir(archive, INT_PATH, "") && tar_archive_finalize(archive);
+ tar_archive_add_dir(archive, STORAGE_INT_PATH_PREFIX, "") &&
+ tar_archive_finalize(archive);
tar_archive_free(archive);
return success ? FSE_OK : FSE_INTERNAL;
}
-FS_Error storage_int_restore(Storage* api, const char* srcname) {
+FS_Error storage_int_restore(Storage* api, const char* srcname, Storage_name_converter converter) {
TarArchive* archive = tar_archive_alloc(api);
bool success = tar_archive_open(archive, srcname, TAR_OPEN_MODE_READ) &&
- tar_archive_unpack_to(archive, INT_PATH);
+ tar_archive_unpack_to(archive, STORAGE_INT_PATH_PREFIX, converter);
tar_archive_free(archive);
return success ? FSE_OK : FSE_INTERNAL;
}
diff --git a/applications/storage/storage_processing.c b/applications/storage/storage_processing.c
index 0eb8a32c..46ca4e16 100644
--- a/applications/storage/storage_processing.c
+++ b/applications/storage/storage_processing.c
@@ -43,17 +43,18 @@ static const char* remove_vfs(const char* path) {
return path + MIN(4u, strlen(path));
}
-static const char* ext_path = "/ext";
-static const char* int_path = "/int";
-static const char* any_path = "/any";
-
static StorageType storage_get_type_by_path(Storage* app, const char* path) {
StorageType type = ST_ERROR;
- if(strlen(path) >= strlen(ext_path) && memcmp(path, ext_path, strlen(ext_path)) == 0) {
+ if(strlen(path) >= strlen(STORAGE_EXT_PATH_PREFIX) &&
+ memcmp(path, STORAGE_EXT_PATH_PREFIX, strlen(STORAGE_EXT_PATH_PREFIX)) == 0) {
type = ST_EXT;
- } else if(strlen(path) >= strlen(int_path) && memcmp(path, int_path, strlen(int_path)) == 0) {
+ } else if(
+ strlen(path) >= strlen(STORAGE_INT_PATH_PREFIX) &&
+ memcmp(path, STORAGE_INT_PATH_PREFIX, strlen(STORAGE_INT_PATH_PREFIX)) == 0) {
type = ST_INT;
- } else if(strlen(path) >= strlen(any_path) && memcmp(path, any_path, strlen(any_path)) == 0) {
+ } else if(
+ strlen(path) >= strlen(STORAGE_ANY_PATH_PREFIX) &&
+ memcmp(path, STORAGE_ANY_PATH_PREFIX, strlen(STORAGE_ANY_PATH_PREFIX)) == 0) {
type = ST_ANY;
}
@@ -68,19 +69,20 @@ static StorageType storage_get_type_by_path(Storage* app, const char* path) {
}
static void storage_path_change_to_real_storage(string_t path, StorageType real_storage) {
- if(memcmp(string_get_cstr(path), any_path, strlen(any_path)) == 0) {
+ if(memcmp(string_get_cstr(path), STORAGE_ANY_PATH_PREFIX, strlen(STORAGE_ANY_PATH_PREFIX)) ==
+ 0) {
switch(real_storage) {
case ST_EXT:
- string_set_char(path, 0, ext_path[0]);
- string_set_char(path, 1, ext_path[1]);
- string_set_char(path, 2, ext_path[2]);
- string_set_char(path, 3, ext_path[3]);
+ string_set_char(path, 0, STORAGE_EXT_PATH_PREFIX[0]);
+ string_set_char(path, 1, STORAGE_EXT_PATH_PREFIX[1]);
+ string_set_char(path, 2, STORAGE_EXT_PATH_PREFIX[2]);
+ string_set_char(path, 3, STORAGE_EXT_PATH_PREFIX[3]);
break;
case ST_INT:
- string_set_char(path, 0, int_path[0]);
- string_set_char(path, 1, int_path[1]);
- string_set_char(path, 2, int_path[2]);
- string_set_char(path, 3, int_path[3]);
+ string_set_char(path, 0, STORAGE_INT_PATH_PREFIX[0]);
+ string_set_char(path, 1, STORAGE_INT_PATH_PREFIX[1]);
+ string_set_char(path, 2, STORAGE_INT_PATH_PREFIX[2]);
+ string_set_char(path, 3, STORAGE_INT_PATH_PREFIX[3]);
break;
default:
break;
diff --git a/applications/storage/storage_test_app.c b/applications/storage/storage_test_app.c
index 226024b3..8bfa9826 100644
--- a/applications/storage/storage_test_app.c
+++ b/applications/storage/storage_test_app.c
@@ -317,22 +317,22 @@ static void do_test_end(Storage* api, const char* path) {
int32_t storage_test_app(void* p) {
UNUSED(p);
- Storage* api = furi_record_open("storage");
- do_test_start(api, "/int");
- do_test_start(api, "/any");
- do_test_start(api, "/ext");
-
- do_file_test(api, "/int/test.txt");
- do_file_test(api, "/any/test.txt");
- do_file_test(api, "/ext/test.txt");
-
- do_dir_test(api, "/int");
- do_dir_test(api, "/any");
- do_dir_test(api, "/ext");
-
- do_test_end(api, "/int");
- do_test_end(api, "/any");
- do_test_end(api, "/ext");
+ Storage* api = furi_record_open(RECORD_STORAGE);
+ do_test_start(api, STORAGE_INT_PATH_PREFIX);
+ do_test_start(api, STORAGE_ANY_PATH_PREFIX);
+ do_test_start(api, STORAGE_EXT_PATH_PREFIX);
+
+ do_file_test(api, INT_PATH("test.txt"));
+ do_file_test(api, ANY_PATH("test.txt"));
+ do_file_test(api, EXT_PATH("test.txt"));
+
+ do_dir_test(api, STORAGE_INT_PATH_PREFIX);
+ do_dir_test(api, STORAGE_ANY_PATH_PREFIX);
+ do_dir_test(api, STORAGE_EXT_PATH_PREFIX);
+
+ do_test_end(api, STORAGE_INT_PATH_PREFIX);
+ do_test_end(api, STORAGE_ANY_PATH_PREFIX);
+ do_test_end(api, STORAGE_EXT_PATH_PREFIX);
while(true) {
furi_delay_ms(1000);
diff --git a/applications/storage/storages/storage_ext.c b/applications/storage/storages/storage_ext.c
index abfcb0e7..4a9d4218 100644
--- a/applications/storage/storages/storage_ext.c
+++ b/applications/storage/storages/storage_ext.c
@@ -11,7 +11,7 @@ typedef FILINFO SDFileInfo;
typedef FRESULT SDError;
#define TAG "StorageExt"
-#define STORAGE_PATH "/ext"
+
/********************* Definitions ********************/
typedef struct {
@@ -35,9 +35,9 @@ static bool sd_mount_card(StorageData* storage, bool notify) {
while(result == false && counter > 0 && hal_sd_detect()) {
if(notify) {
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
sd_notify_wait(notification);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
}
if((counter % 2) == 0) {
@@ -78,9 +78,9 @@ static bool sd_mount_card(StorageData* storage, bool notify) {
}
if(notify) {
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
sd_notify_wait_off(notification);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
}
if(!result) {
@@ -224,16 +224,16 @@ static void storage_ext_tick_internal(StorageData* storage, bool notify) {
if(storage->status != StorageStatusOK) {
FURI_LOG_E(TAG, "sd init error: %s", storage_data_status_text(storage));
if(notify) {
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
sd_notify_error(notification);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
}
} else {
FURI_LOG_I(TAG, "card mounted");
if(notify) {
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
sd_notify_success(notification);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
}
}
@@ -252,9 +252,9 @@ static void storage_ext_tick_internal(StorageData* storage, bool notify) {
sd_unmount_card(storage);
if(notify) {
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
sd_notify_eject(notification);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
}
}
}
diff --git a/applications/storage/storages/storage_int.c b/applications/storage/storages/storage_int.c
index bdd78172..0765a92d 100644
--- a/applications/storage/storages/storage_int.c
+++ b/applications/storage/storages/storage_int.c
@@ -1,11 +1,16 @@
#include "storage_int.h"
#include <lfs.h>
#include <furi_hal.h>
+#include <toolbox/path.h>
#define TAG "StorageInt"
-#define STORAGE_PATH "/int"
+#define STORAGE_PATH STORAGE_INT_PATH_PREFIX
#define LFS_CLEAN_FINGERPRINT 0
+/* When less than LFS_RESERVED_PAGES_COUNT are left free, creation &
+ * modification of non-dot files is restricted */
+#define LFS_RESERVED_PAGES_COUNT 5
+
typedef struct {
const size_t start_address;
const size_t start_page;
@@ -297,6 +302,20 @@ static FS_Error storage_int_parse_error(int error) {
return result;
}
+/* Returns false if less than reserved space is left free */
+static bool storage_int_check_for_free_space(StorageData* storage) {
+ LFSData* lfs_data = lfs_data_get_from_storage(storage);
+
+ lfs_ssize_t result = lfs_fs_size(lfs_get_from_storage(storage));
+ if(result >= 0) {
+ lfs_size_t free_space =
+ (lfs_data->config.block_count - result) * lfs_data->config.block_size;
+
+ return (free_space > LFS_RESERVED_PAGES_COUNT * furi_hal_flash_get_page_size());
+ }
+
+ return false;
+}
/******************* File Functions *******************/
static bool storage_int_file_open(
@@ -308,6 +327,8 @@ static bool storage_int_file_open(
StorageData* storage = ctx;
lfs_t* lfs = lfs_get_from_storage(storage);
+ bool enough_free_space = storage_int_check_for_free_space(storage);
+
int flags = 0;
if(access_mode & FSAM_READ) flags |= LFS_O_RDONLY;
@@ -321,6 +342,23 @@ static bool storage_int_file_open(
LFSHandle* handle = lfs_handle_alloc_file();
storage_set_storage_file_data(file, handle, storage);
+
+ if(!enough_free_space) {
+ string_t filename;
+ string_init(filename);
+ path_extract_basename(path, filename);
+ bool is_dot_file = (!string_empty_p(filename) && (string_get_char(filename, 0) == '.'));
+ string_clear(filename);
+
+ /* Restrict write & creation access to all non-dot files */
+ if(!is_dot_file && (flags & (LFS_O_CREAT | LFS_O_WRONLY))) {
+ file->internal_error_id = LFS_ERR_NOSPC;
+ file->error_id = FSE_DENIED;
+ FURI_LOG_W(TAG, "Denied access to '%s': no free space", path);
+ return false;
+ }
+ }
+
file->internal_error_id = lfs_file_open(lfs, lfs_handle_get_file(handle), path, flags);
if(file->internal_error_id >= LFS_ERR_OK) {
@@ -328,6 +366,7 @@ static bool storage_int_file_open(
}
file->error_id = storage_int_parse_error(file->internal_error_id);
+
return (file->error_id == FSE_OK);
}
diff --git a/applications/storage_move_to_sd/application.fam b/applications/storage_move_to_sd/application.fam
index 60a6d987..de47de05 100644
--- a/applications/storage_move_to_sd/application.fam
+++ b/applications/storage_move_to_sd/application.fam
@@ -3,7 +3,7 @@ App(
name="StorageMoveToSd",
apptype=FlipperAppType.SYSTEM,
entry_point="storage_move_to_sd_app",
- requires=["gui","storage"],
+ requires=["gui", "storage"],
provides=["storage_move_to_sd_start"],
stack_size=2 * 1024,
order=30,
@@ -16,4 +16,3 @@ App(
requires=["storage"],
order=120,
)
-
diff --git a/applications/storage_move_to_sd/storage_move_to_sd.c b/applications/storage_move_to_sd/storage_move_to_sd.c
index fe5807d1..e5b195d5 100644
--- a/applications/storage_move_to_sd/storage_move_to_sd.c
+++ b/applications/storage_move_to_sd/storage_move_to_sd.c
@@ -4,66 +4,78 @@
#include "loader/loader.h"
#include "m-string.h"
#include <stdint.h>
+#include <toolbox/dir_walk.h>
+#include <toolbox/path.h>
#define TAG "MoveToSd"
-#define MOVE_SRC "/int"
-#define MOVE_DST "/ext"
+#define MOVE_SRC STORAGE_INT_PATH_PREFIX
+#define MOVE_DST STORAGE_EXT_PATH_PREFIX
-static const char* app_dirs[] = {
- "subghz",
- "lfrfid",
- "nfc",
- "infrared",
- "ibutton",
- "badusb",
-};
+static bool storage_move_to_sd_check_entry(const char* name, FileInfo* fileinfo, void* ctx) {
+ UNUSED(ctx);
+ if((fileinfo->flags & FSF_DIRECTORY) != 0) {
+ return true;
+ }
+
+ return (name && (*name != '.'));
+}
bool storage_move_to_sd_perform(void) {
- Storage* storage = furi_record_open("storage");
- string_t path_src;
- string_t path_dst;
- string_init(path_src);
+ Storage* storage = furi_record_open(RECORD_STORAGE);
+
+ DirWalk* dir_walk = dir_walk_alloc(storage);
+ dir_walk_set_recursive(dir_walk, false);
+ dir_walk_set_filter_cb(dir_walk, storage_move_to_sd_check_entry, NULL);
+
+ string_t path_src, path_dst;
+
string_init(path_dst);
+ string_init(path_src);
+
+ if(dir_walk_open(dir_walk, STORAGE_INT_PATH_PREFIX)) {
+ while(dir_walk_read(dir_walk, path_src, NULL) == DirWalkOK) {
+ string_set(path_dst, path_src);
+ string_replace_at(
+ path_dst, 0, strlen(STORAGE_INT_PATH_PREFIX), STORAGE_EXT_PATH_PREFIX);
- for(uint32_t i = 0; i < COUNT_OF(app_dirs); i++) {
- string_printf(path_src, "%s/%s", MOVE_SRC, app_dirs[i]);
- string_printf(path_dst, "%s/%s", MOVE_DST, app_dirs[i]);
- storage_common_merge(storage, string_get_cstr(path_src), string_get_cstr(path_dst));
- storage_simply_remove_recursive(storage, string_get_cstr(path_src));
+ storage_common_merge(storage, string_get_cstr(path_src), string_get_cstr(path_dst));
+ storage_simply_remove_recursive(storage, string_get_cstr(path_src));
+ }
}
- string_clear(path_src);
+ dir_walk_free(dir_walk);
string_clear(path_dst);
+ string_clear(path_src);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return false;
}
static bool storage_move_to_sd_check(void) {
- Storage* storage = furi_record_open("storage");
-
- FileInfo file_info;
- bool state = false;
- string_t path;
- string_init(path);
-
- for(uint32_t i = 0; i < COUNT_OF(app_dirs); i++) {
- string_printf(path, "%s/%s", MOVE_SRC, app_dirs[i]);
- if(storage_common_stat(storage, string_get_cstr(path), &file_info) == FSE_OK) {
- if((file_info.flags & FSF_DIRECTORY) != 0) {
- state = true;
- break;
- }
- }
+ Storage* storage = furi_record_open(RECORD_STORAGE);
+
+ bool should_migrate = false;
+
+ DirWalk* dir_walk = dir_walk_alloc(storage);
+ dir_walk_set_recursive(dir_walk, false);
+ dir_walk_set_filter_cb(dir_walk, storage_move_to_sd_check_entry, NULL);
+
+ string_t name;
+ string_init(name);
+
+ if(dir_walk_open(dir_walk, STORAGE_INT_PATH_PREFIX)) {
+ // if at least 1 entry is present, we should migrate
+ should_migrate = (dir_walk_read(dir_walk, name, NULL) == DirWalkOK);
}
- string_clear(path);
+ dir_walk_free(dir_walk);
+ string_clear(name);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
- return state;
+ return should_migrate;
}
static bool storage_move_to_sd_custom_event_callback(void* context, uint32_t event) {
@@ -92,8 +104,8 @@ static void storage_move_to_sd_unmount_callback(const void* message, void* conte
static StorageMoveToSd* storage_move_to_sd_alloc() {
StorageMoveToSd* app = malloc(sizeof(StorageMoveToSd));
- app->gui = furi_record_open("gui");
- app->notifications = furi_record_open("notification");
+ app->gui = furi_record_open(RECORD_GUI);
+ app->notifications = furi_record_open(RECORD_NOTIFICATION);
app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&storage_move_to_sd_scene_handlers, app);
@@ -114,26 +126,26 @@ static StorageMoveToSd* storage_move_to_sd_alloc() {
scene_manager_next_scene(app->scene_manager, StorageMoveToSdConfirm);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
app->sub = furi_pubsub_subscribe(
storage_get_pubsub(storage), storage_move_to_sd_unmount_callback, app);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return app;
}
static void storage_move_to_sd_free(StorageMoveToSd* app) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
furi_pubsub_unsubscribe(storage_get_pubsub(storage), app->sub);
- furi_record_close("storage");
- furi_record_close("notification");
+ furi_record_close(RECORD_STORAGE);
+ furi_record_close(RECORD_NOTIFICATION);
view_dispatcher_remove_view(app->view_dispatcher, StorageMoveToSdViewWidget);
widget_free(app->widget);
view_dispatcher_free(app->view_dispatcher);
scene_manager_free(app->scene_manager);
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
free(app);
}
@@ -159,18 +171,18 @@ static void storage_move_to_sd_mount_callback(const void* message, void* context
const StorageEvent* storage_event = message;
if(storage_event->type == StorageEventTypeCardMount) {
- Loader* loader = furi_record_open("loader");
+ Loader* loader = furi_record_open(RECORD_LOADER);
loader_start(loader, "StorageMoveToSd", NULL);
- furi_record_close("loader");
+ furi_record_close(RECORD_LOADER);
}
}
int32_t storage_move_to_sd_start(void* p) {
UNUSED(p);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
furi_pubsub_subscribe(storage_get_pubsub(storage), storage_move_to_sd_mount_callback, NULL);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return 0;
}
diff --git a/applications/storage_settings/scenes/storage_settings_scene_benchmark.c b/applications/storage_settings/scenes/storage_settings_scene_benchmark.c
index 947bb4e5..610696af 100644
--- a/applications/storage_settings/scenes/storage_settings_scene_benchmark.c
+++ b/applications/storage_settings/scenes/storage_settings_scene_benchmark.c
@@ -4,7 +4,7 @@
#define BENCH_DATA_SIZE 4096
#define BENCH_COUNT 6
#define BENCH_REPEATS 4
-#define BENCH_FILE "/ext/rwfiletest.bin"
+#define BENCH_FILE EXT_PATH("rwfiletest.bin")
static void
storage_settings_scene_benchmark_dialog_callback(DialogExResult result, void* context) {
diff --git a/applications/storage_settings/scenes/storage_settings_scene_internal_info.c b/applications/storage_settings/scenes/storage_settings_scene_internal_info.c
index 53f791bd..74eecdb9 100644
--- a/applications/storage_settings/scenes/storage_settings_scene_internal_info.c
+++ b/applications/storage_settings/scenes/storage_settings_scene_internal_info.c
@@ -12,7 +12,8 @@ void storage_settings_scene_internal_info_on_enter(void* context) {
StorageSettings* app = context;
uint64_t total_space;
uint64_t free_space;
- FS_Error error = storage_common_fs_info(app->fs_api, "/int", &total_space, &free_space);
+ FS_Error error =
+ storage_common_fs_info(app->fs_api, STORAGE_INT_PATH_PREFIX, &total_space, &free_space);
DialogEx* dialog_ex = app->dialog_ex;
dialog_ex_set_context(dialog_ex, app);
diff --git a/applications/storage_settings/storage_settings.c b/applications/storage_settings/storage_settings.c
index b89fdf06..f580e636 100644
--- a/applications/storage_settings/storage_settings.c
+++ b/applications/storage_settings/storage_settings.c
@@ -15,9 +15,9 @@ static bool storage_settings_back_event_callback(void* context) {
static StorageSettings* storage_settings_alloc() {
StorageSettings* app = malloc(sizeof(StorageSettings));
- app->gui = furi_record_open("gui");
- app->fs_api = furi_record_open("storage");
- app->notification = furi_record_open("notification");
+ app->gui = furi_record_open(RECORD_GUI);
+ app->fs_api = furi_record_open(RECORD_STORAGE);
+ app->notification = furi_record_open(RECORD_NOTIFICATION);
app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&storage_settings_scene_handlers, app);
@@ -56,9 +56,9 @@ static void storage_settings_free(StorageSettings* app) {
view_dispatcher_free(app->view_dispatcher);
scene_manager_free(app->scene_manager);
- furi_record_close("gui");
- furi_record_close("storage");
- furi_record_close("notification");
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_STORAGE);
+ furi_record_close(RECORD_NOTIFICATION);
string_clear(app->text_string);
diff --git a/applications/subghz/subghz.c b/applications/subghz/subghz.c
index 76998eb0..26f1bbe9 100644
--- a/applications/subghz/subghz.c
+++ b/applications/subghz/subghz.c
@@ -95,7 +95,7 @@ SubGhz* subghz_alloc() {
string_init(subghz->file_path_tmp);
// GUI
- subghz->gui = furi_record_open("gui");
+ subghz->gui = furi_record_open(RECORD_GUI);
// View Dispatcher
subghz->view_dispatcher = view_dispatcher_alloc();
@@ -111,7 +111,7 @@ SubGhz* subghz_alloc() {
subghz->view_dispatcher, subghz_tick_event_callback, 100);
// Open Notification record
- subghz->notifications = furi_record_open("notification");
+ subghz->notifications = furi_record_open(RECORD_NOTIFICATION);
// SubMenu
subghz->submenu = submenu_alloc();
@@ -141,7 +141,7 @@ SubGhz* subghz_alloc() {
subghz->view_dispatcher, SubGhzViewIdWidget, widget_get_view(subghz->widget));
//Dialog
- subghz->dialogs = furi_record_open("dialogs");
+ subghz->dialogs = furi_record_open(RECORD_DIALOGS);
// Transmitter
subghz->subghz_transmitter = subghz_view_transmitter_alloc();
@@ -194,7 +194,7 @@ SubGhz* subghz_alloc() {
//init setting
subghz->setting = subghz_setting_alloc();
- subghz_setting_load(subghz->setting, "/ext/subghz/assets/setting_user");
+ subghz_setting_load(subghz->setting, EXT_PATH("subghz/assets/setting_user"));
//init Worker & Protocol & History & KeyBoard
subghz->lock = SubGhzLockOff;
@@ -210,9 +210,9 @@ SubGhz* subghz_alloc() {
subghz->txrx->environment = subghz_environment_alloc();
subghz_environment_set_came_atomo_rainbow_table_file_name(
- subghz->txrx->environment, "/ext/subghz/assets/came_atomo");
+ subghz->txrx->environment, EXT_PATH("subghz/assets/came_atomo"));
subghz_environment_set_nice_flor_s_rainbow_table_file_name(
- subghz->txrx->environment, "/ext/subghz/assets/nice_flor_s");
+ subghz->txrx->environment, EXT_PATH("subghz/assets/nice_flor_s"));
subghz->txrx->receiver = subghz_receiver_alloc_init(subghz->txrx->environment);
subghz_receiver_set_filter(subghz->txrx->receiver, SubGhzProtocolFlag_Decodable);
@@ -263,7 +263,7 @@ void subghz_free(SubGhz* subghz) {
widget_free(subghz->widget);
//Dialog
- furi_record_close("dialogs");
+ furi_record_close(RECORD_DIALOGS);
// Transmitter
view_dispatcher_remove_view(subghz->view_dispatcher, SubGhzViewIdTransmitter);
@@ -296,7 +296,7 @@ void subghz_free(SubGhz* subghz) {
view_dispatcher_free(subghz->view_dispatcher);
// GUI
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
subghz->gui = NULL;
//setting
@@ -314,7 +314,7 @@ void subghz_free(SubGhz* subghz) {
string_clear(subghz->error_str);
// Notifications
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
subghz->notifications = NULL;
// Path strings
@@ -330,9 +330,9 @@ int32_t subghz_app(void* p) {
//Load database
bool load_database = subghz_environment_load_keystore(
- subghz->txrx->environment, "/ext/subghz/assets/keeloq_mfcodes");
+ subghz->txrx->environment, EXT_PATH("subghz/assets/keeloq_mfcodes"));
subghz_environment_load_keystore(
- subghz->txrx->environment, "/ext/subghz/assets/keeloq_mfcodes_user");
+ subghz->txrx->environment, EXT_PATH("subghz/assets/keeloq_mfcodes_user"));
// Check argument and run corresponding scene
if(p) {
uint32_t rpc_ctx = 0;
diff --git a/applications/subghz/subghz_cli.c b/applications/subghz/subghz_cli.c
index eadef9f4..2b6fdd84 100644
--- a/applications/subghz/subghz_cli.c
+++ b/applications/subghz/subghz_cli.c
@@ -245,12 +245,12 @@ void subghz_cli_command_rx(Cli* cli, string_t args, void* context) {
furi_check(instance->stream);
SubGhzEnvironment* environment = subghz_environment_alloc();
- subghz_environment_load_keystore(environment, "/ext/subghz/assets/keeloq_mfcodes");
- subghz_environment_load_keystore(environment, "/ext/subghz/assets/keeloq_mfcodes_user");
+ subghz_environment_load_keystore(environment, EXT_PATH("subghz/assets/keeloq_mfcodes"));
+ subghz_environment_load_keystore(environment, EXT_PATH("subghz/assets/keeloq_mfcodes_user"));
subghz_environment_set_came_atomo_rainbow_table_file_name(
- environment, "/ext/subghz/assets/came_atomo");
+ environment, EXT_PATH("subghz/assets/came_atomo"));
subghz_environment_set_nice_flor_s_rainbow_table_file_name(
- environment, "/ext/subghz/assets/nice_flor_s");
+ environment, EXT_PATH("subghz/assets/nice_flor_s"));
SubGhzReceiver* receiver = subghz_receiver_alloc_init(environment);
subghz_receiver_set_filter(receiver, SubGhzProtocolFlag_Decodable);
@@ -304,9 +304,9 @@ void subghz_cli_command_decode_raw(Cli* cli, string_t args, void* context) {
UNUSED(context);
string_t file_name;
string_init(file_name);
- string_set_str(file_name, "/any/subghz/test.sub");
+ string_set_str(file_name, ANY_PATH("subghz/test.sub"));
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
string_t temp_str;
string_init(temp_str);
@@ -346,29 +346,30 @@ void subghz_cli_command_decode_raw(Cli* cli, string_t args, void* context) {
string_clear(temp_str);
flipper_format_free(fff_data_file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
if(check_file) {
// Allocate context
SubGhzCliCommandRx* instance = malloc(sizeof(SubGhzCliCommandRx));
SubGhzEnvironment* environment = subghz_environment_alloc();
- if(subghz_environment_load_keystore(environment, "/ext/subghz/assets/keeloq_mfcodes")) {
+ if(subghz_environment_load_keystore(
+ environment, EXT_PATH("subghz/assets/keeloq_mfcodes"))) {
printf("SubGhz decode_raw: Load_keystore keeloq_mfcodes \033[0;32mOK\033[0m\r\n");
} else {
printf("SubGhz decode_raw: Load_keystore keeloq_mfcodes \033[0;31mERROR\033[0m\r\n");
}
if(subghz_environment_load_keystore(
- environment, "/ext/subghz/assets/keeloq_mfcodes_user")) {
+ environment, EXT_PATH("subghz/assets/keeloq_mfcodes_user"))) {
printf("SubGhz decode_raw: Load_keystore keeloq_mfcodes_user \033[0;32mOK\033[0m\r\n");
} else {
printf(
"SubGhz decode_raw: Load_keystore keeloq_mfcodes_user \033[0;31mERROR\033[0m\r\n");
}
subghz_environment_set_came_atomo_rainbow_table_file_name(
- environment, "/ext/subghz/assets/came_atomo");
+ environment, EXT_PATH("subghz/assets/came_atomo"));
subghz_environment_set_nice_flor_s_rainbow_table_file_name(
- environment, "/ext/subghz/assets/nice_flor_s");
+ environment, EXT_PATH("subghz/assets/nice_flor_s"));
SubGhzReceiver* receiver = subghz_receiver_alloc_init(environment);
subghz_receiver_set_filter(receiver, SubGhzProtocolFlag_Decodable);
@@ -569,7 +570,7 @@ static void subghz_cli_command_chat(Cli* cli, string_t args) {
bool exit = false;
SubGhzChatEvent chat_event;
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
string_printf(name, "\033[0;33m%s\033[0m: ", furi_hal_version_get_name_ptr());
string_set(input, name);
@@ -688,7 +689,7 @@ static void subghz_cli_command_chat(Cli* cli, string_t args) {
string_clear(output);
string_clear(sysmsg);
furi_hal_power_suppress_charge_exit();
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
if(subghz_chat_worker_is_running(subghz_chat)) {
subghz_chat_worker_stop(subghz_chat);
@@ -757,11 +758,11 @@ static void subghz_cli_command(Cli* cli, string_t args, void* context) {
void subghz_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
cli_add_command(cli, "subghz", CliCommandFlagDefault, subghz_cli_command, NULL);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#else
UNUSED(subghz_cli_command);
#endif
diff --git a/applications/subghz/subghz_i.c b/applications/subghz/subghz_i.c
index f6e4d4f5..9c8a3fc4 100644
--- a/applications/subghz/subghz_i.c
+++ b/applications/subghz/subghz_i.c
@@ -226,7 +226,7 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
furi_assert(subghz);
furi_assert(file_path);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
Stream* fff_data_stream = flipper_format_get_raw_stream(subghz->txrx->fff_data);
@@ -308,7 +308,7 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
string_clear(temp_str);
flipper_format_free(fff_data_file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
switch(load_key_state) {
case SubGhzLoadKeyStateParseErr:
@@ -335,7 +335,7 @@ bool subghz_key_load(SubGhz* subghz, const char* file_path, bool show_dialog) {
bool subghz_get_next_name_file(SubGhz* subghz, uint8_t max_len) {
furi_assert(subghz);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
string_t temp_str;
string_t file_name;
string_t file_path;
@@ -372,7 +372,7 @@ bool subghz_get_next_name_file(SubGhz* subghz, uint8_t max_len) {
string_clear(temp_str);
string_clear(file_path);
string_clear(file_name);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return res;
}
@@ -385,7 +385,7 @@ bool subghz_save_protocol_to_file(
furi_assert(flipper_format);
furi_assert(dev_file_name);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
Stream* flipper_format_stream = flipper_format_get_raw_stream(flipper_format);
bool saved = false;
@@ -414,7 +414,7 @@ bool subghz_save_protocol_to_file(
saved = true;
} while(0);
string_clear(file_dir);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return saved;
}
@@ -447,7 +447,7 @@ bool subghz_rename_file(SubGhz* subghz) {
furi_assert(subghz);
bool ret = true;
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
if(string_cmp(subghz->file_path_tmp, subghz->file_path)) {
FS_Error fs_result = storage_common_rename(
@@ -458,7 +458,7 @@ bool subghz_rename_file(SubGhz* subghz) {
ret = false;
}
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return ret;
}
@@ -466,9 +466,9 @@ bool subghz_rename_file(SubGhz* subghz) {
bool subghz_delete_file(SubGhz* subghz) {
furi_assert(subghz);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = storage_simply_remove(storage, string_get_cstr(subghz->file_path_tmp));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
subghz_file_name_clear(subghz);
diff --git a/applications/subghz/subghz_setting.c b/applications/subghz/subghz_setting.c
index 9dcfb291..7d688105 100644
--- a/applications/subghz/subghz_setting.c
+++ b/applications/subghz/subghz_setting.c
@@ -229,7 +229,7 @@ void subghz_setting_load_default(SubGhzSetting* instance) {
void subghz_setting_load(SubGhzSetting* instance, const char* file_path) {
furi_assert(instance);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
string_t temp_str;
@@ -318,7 +318,7 @@ void subghz_setting_load(SubGhzSetting* instance, const char* file_path) {
string_clear(temp_str);
flipper_format_free(fff_data_file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
if(!FrequencyList_size(instance->frequencies) ||
!FrequencyList_size(instance->hopper_frequencies)) {
diff --git a/applications/subghz/views/subghz_test_static.c b/applications/subghz/views/subghz_test_static.c
index 41de7262..7af54c3c 100644
--- a/applications/subghz/views/subghz_test_static.c
+++ b/applications/subghz/views/subghz_test_static.c
@@ -93,7 +93,7 @@ bool subghz_test_static_input(InputEvent* event, void* context) {
model->real_frequency = subghz_frequencies_testing[model->frequency];
if(event->key == InputKeyOk) {
- NotificationApp* notification = furi_record_open("notification");
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
if(event->type == InputTypePress) {
furi_hal_subghz_idle();
furi_hal_subghz_set_frequency_and_path(
@@ -126,7 +126,7 @@ bool subghz_test_static_input(InputEvent* event, void* context) {
}
instance->status_tx = SubGhzTestStaticStatusIDLE;
}
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
}
return true;
diff --git a/applications/system/system_settings.c b/applications/system/system_settings.c
index 7bbcdd7b..7661413d 100644
--- a/applications/system/system_settings.c
+++ b/applications/system/system_settings.c
@@ -54,7 +54,7 @@ SystemSettings* system_settings_alloc() {
SystemSettings* app = malloc(sizeof(SystemSettings));
// Load settings
- app->gui = furi_record_open("gui");
+ app->gui = furi_record_open(RECORD_GUI);
app->view_dispatcher = view_dispatcher_alloc();
view_dispatcher_enable_queue(app->view_dispatcher);
@@ -99,7 +99,7 @@ void system_settings_free(SystemSettings* app) {
// View dispatcher
view_dispatcher_free(app->view_dispatcher);
// Records
- furi_record_close("gui");
+ furi_record_close(RECORD_GUI);
free(app);
}
diff --git a/applications/u2f/u2f_app.c b/applications/u2f/u2f_app.c
index 2c3ff562..21648197 100644
--- a/applications/u2f/u2f_app.c
+++ b/applications/u2f/u2f_app.c
@@ -24,8 +24,8 @@ static void u2f_app_tick_event_callback(void* context) {
U2fApp* u2f_app_alloc() {
U2fApp* app = malloc(sizeof(U2fApp));
- app->gui = furi_record_open("gui");
- app->notifications = furi_record_open("notification");
+ app->gui = furi_record_open(RECORD_GUI);
+ app->notifications = furi_record_open(RECORD_NOTIFICATION);
app->view_dispatcher = view_dispatcher_alloc();
app->scene_manager = scene_manager_alloc(&u2f_scene_handlers, app);
@@ -79,8 +79,8 @@ void u2f_app_free(U2fApp* app) {
scene_manager_free(app->scene_manager);
// Close records
- furi_record_close("gui");
- furi_record_close("notification");
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_NOTIFICATION);
free(app);
}
diff --git a/applications/u2f/u2f_data.c b/applications/u2f/u2f_data.c
index 5143b27b..0419fc7e 100644
--- a/applications/u2f/u2f_data.c
+++ b/applications/u2f/u2f_data.c
@@ -7,7 +7,7 @@
#define TAG "U2F"
-#define U2F_DATA_FOLDER "/any/u2f/"
+#define U2F_DATA_FOLDER ANY_PATH("u2f/")
#define U2F_CERT_FILE U2F_DATA_FOLDER "assets/cert.der"
#define U2F_CERT_KEY_FILE U2F_DATA_FOLDER "assets/cert_key.u2f"
#define U2F_KEY_FILE U2F_DATA_FOLDER "key.u2f"
@@ -40,7 +40,7 @@ typedef struct {
bool u2f_data_check(bool cert_only) {
bool state = false;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
do {
@@ -61,14 +61,14 @@ bool u2f_data_check(bool cert_only) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return state;
}
bool u2f_data_cert_check() {
bool state = false;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
uint8_t file_buf[8];
@@ -96,7 +96,7 @@ bool u2f_data_cert_check() {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return state;
}
@@ -104,7 +104,7 @@ bool u2f_data_cert_check() {
uint32_t u2f_data_cert_load(uint8_t* cert) {
furi_assert(cert);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
uint32_t file_size = 0;
uint32_t len_cur = 0;
@@ -117,7 +117,7 @@ uint32_t u2f_data_cert_load(uint8_t* cert) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return len_cur;
}
@@ -146,7 +146,7 @@ static bool u2f_data_cert_key_encrypt(uint8_t* cert_key) {
}
furi_hal_crypto_store_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
if(flipper_format_file_open_always(flipper_format, U2F_CERT_KEY_FILE)) {
@@ -162,7 +162,7 @@ static bool u2f_data_cert_key_encrypt(uint8_t* cert_key) {
}
flipper_format_free(flipper_format);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return state;
}
@@ -183,7 +183,7 @@ bool u2f_data_cert_key_load(uint8_t* cert_key) {
string_t filetype;
string_init(filetype);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
if(flipper_format_file_open_existing(flipper_format, U2F_CERT_KEY_FILE)) {
@@ -248,7 +248,7 @@ bool u2f_data_cert_key_load(uint8_t* cert_key) {
}
flipper_format_free(flipper_format);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
string_clear(filetype);
if(cert_type == U2F_CERT_USER_UNENCRYPTED) {
@@ -269,7 +269,7 @@ bool u2f_data_key_load(uint8_t* device_key) {
string_t filetype;
string_init(filetype);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
if(flipper_format_file_open_existing(flipper_format, U2F_KEY_FILE)) {
@@ -306,7 +306,7 @@ bool u2f_data_key_load(uint8_t* device_key) {
} while(0);
}
flipper_format_free(flipper_format);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
string_clear(filetype);
return state;
}
@@ -334,7 +334,7 @@ bool u2f_data_key_generate(uint8_t* device_key) {
}
furi_hal_crypto_store_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
if(flipper_format_file_open_always(flipper_format, U2F_KEY_FILE)) {
@@ -350,7 +350,7 @@ bool u2f_data_key_generate(uint8_t* device_key) {
}
flipper_format_free(flipper_format);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return state;
}
@@ -367,7 +367,7 @@ bool u2f_data_cnt_read(uint32_t* cnt_val) {
string_t filetype;
string_init(filetype);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
if(flipper_format_file_open_existing(flipper_format, U2F_CNT_FILE)) {
@@ -407,7 +407,7 @@ bool u2f_data_cnt_read(uint32_t* cnt_val) {
} while(0);
}
flipper_format_free(flipper_format);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
string_clear(filetype);
return state;
}
@@ -435,7 +435,7 @@ bool u2f_data_cnt_write(uint32_t cnt_val) {
}
furi_hal_crypto_store_unload_key(U2F_DATA_FILE_ENCRYPTION_KEY_SLOT_UNIQUE);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
if(flipper_format_file_open_always(flipper_format, U2F_CNT_FILE)) {
@@ -450,7 +450,7 @@ bool u2f_data_cnt_write(uint32_t cnt_val) {
}
flipper_format_free(flipper_format);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return state;
}
diff --git a/applications/unit_tests/flipper_format/flipper_format_string_test.c b/applications/unit_tests/flipper_format/flipper_format_string_test.c
index 7158ffd8..b22b333a 100644
--- a/applications/unit_tests/flipper_format/flipper_format_string_test.c
+++ b/applications/unit_tests/flipper_format/flipper_format_string_test.c
@@ -296,9 +296,9 @@ MU_TEST(flipper_format_string_test) {
}
MU_TEST(flipper_format_file_test) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* flipper_format = flipper_format_file_alloc(storage);
- mu_check(flipper_format_file_open_always(flipper_format, "/ext/flipper.fff"));
+ mu_check(flipper_format_file_open_always(flipper_format, EXT_PATH("flipper.fff")));
Stream* stream = flipper_format_get_raw_stream(flipper_format);
mu_check(flipper_format_write_header_cstr(flipper_format, test_filetype, test_version));
@@ -323,7 +323,7 @@ MU_TEST(flipper_format_file_test) {
MU_RUN_TEST_1(flipper_format_read_and_update_test, flipper_format);
flipper_format_free(flipper_format);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
MU_TEST_SUITE(flipper_format_string_suite) {
diff --git a/applications/unit_tests/flipper_format/flipper_format_test.c b/applications/unit_tests/flipper_format/flipper_format_test.c
index f83360b4..86e2df21 100644
--- a/applications/unit_tests/flipper_format/flipper_format_test.c
+++ b/applications/unit_tests/flipper_format/flipper_format_test.c
@@ -5,7 +5,7 @@
#include "../minunit.h"
#define TEST_DIR TEST_DIR_NAME "/"
-#define TEST_DIR_NAME "/ext/unit_tests_tmp"
+#define TEST_DIR_NAME EXT_PATH("unit_tests_tmp")
static const char* test_filetype = "Flipper File test";
static const uint32_t test_version = 666;
@@ -66,7 +66,7 @@ static const char* test_file_windows = TEST_DIR READ_TEST_WIN;
static const char* test_file_flipper = TEST_DIR READ_TEST_FLP;
static bool storage_write_string(const char* path, const char* data) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(storage);
bool result = false;
@@ -79,26 +79,26 @@ static bool storage_write_string(const char* path, const char* data) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
static void tests_setup() {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
mu_assert(storage_simply_remove_recursive(storage, TEST_DIR_NAME), "Cannot clean data");
mu_assert(storage_simply_mkdir(storage, TEST_DIR_NAME), "Cannot create dir");
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void tests_teardown() {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
mu_assert(storage_simply_remove_recursive(storage, TEST_DIR_NAME), "Cannot clean data");
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static bool test_read(const char* file_name) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -154,13 +154,13 @@ static bool test_read(const char* file_name) {
flipper_format_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
static bool test_read_updated(const char* file_name) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -232,13 +232,13 @@ static bool test_read_updated(const char* file_name) {
flipper_format_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
static bool test_write(const char* file_name) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -264,13 +264,13 @@ static bool test_write(const char* file_name) {
} while(false);
flipper_format_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
static bool test_delete_last_key(const char* file_name) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -281,13 +281,13 @@ static bool test_delete_last_key(const char* file_name) {
} while(false);
flipper_format_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
static bool test_append_key(const char* file_name) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -299,13 +299,13 @@ static bool test_append_key(const char* file_name) {
} while(false);
flipper_format_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
static bool test_update(const char* file_name) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -333,13 +333,13 @@ static bool test_update(const char* file_name) {
} while(false);
flipper_format_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
static bool test_update_backward(const char* file_name) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -364,13 +364,13 @@ static bool test_update_backward(const char* file_name) {
} while(false);
flipper_format_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
static bool test_write_multikey(const char* file_name) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -391,13 +391,13 @@ static bool test_write_multikey(const char* file_name) {
} while(false);
flipper_format_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
static bool test_read_multikey(const char* file_name) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -432,7 +432,7 @@ static bool test_read_multikey(const char* file_name) {
string_clear(string_value);
flipper_format_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
diff --git a/applications/unit_tests/infrared/infrared_test.c b/applications/unit_tests/infrared/infrared_test.c
index cdae742f..32266c48 100644
--- a/applications/unit_tests/infrared/infrared_test.c
+++ b/applications/unit_tests/infrared/infrared_test.c
@@ -4,7 +4,7 @@
#include <common/infrared_common_i.h>
#include "../minunit.h"
-#define IR_TEST_FILES_DIR "/ext/unit_tests/infrared/"
+#define IR_TEST_FILES_DIR EXT_PATH("unit_tests/infrared/")
#define IR_TEST_FILE_PREFIX "test_"
#define IR_TEST_FILE_SUFFIX ".irtest"
@@ -18,7 +18,7 @@ typedef struct {
static InfraredTest* test;
static void infrared_test_alloc() {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
test = malloc(sizeof(InfraredTest));
test->decoder_handler = infrared_alloc_decoder();
test->encoder_handler = infrared_alloc_encoder();
@@ -32,7 +32,7 @@ static void infrared_test_free() {
infrared_free_encoder(test->encoder_handler);
flipper_format_free(test->ff);
string_clear(test->file_path);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
free(test);
test = NULL;
}
diff --git a/applications/unit_tests/nfc/nfc_test.c b/applications/unit_tests/nfc/nfc_test.c
index 4e1b9a64..13060a6d 100644
--- a/applications/unit_tests/nfc/nfc_test.c
+++ b/applications/unit_tests/nfc/nfc_test.c
@@ -12,7 +12,7 @@
#define TAG "NfcTest"
-#define NFC_TEST_RESOURCES_DIR "/ext/unit_tests/nfc/"
+#define NFC_TEST_RESOURCES_DIR EXT_PATH("unit_tests/nfc/")
#define NFC_TEST_SIGNAL_SHORT_FILE "nfc_nfca_signal_short.nfc"
#define NFC_TEST_SIGNAL_LONG_FILE "nfc_nfca_signal_long.nfc"
@@ -36,13 +36,13 @@ static NfcTest* nfc_test = NULL;
static void nfc_test_alloc() {
nfc_test = malloc(sizeof(NfcTest));
nfc_test->signal = nfca_signal_alloc();
- nfc_test->storage = furi_record_open("storage");
+ nfc_test->storage = furi_record_open(RECORD_STORAGE);
}
static void nfc_test_free() {
furi_assert(nfc_test);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
nfca_signal_free(nfc_test->signal);
free(nfc_test);
nfc_test = NULL;
diff --git a/applications/unit_tests/rpc/rpc_test.c b/applications/unit_tests/rpc/rpc_test.c
index c5336385..1b9c5b0b 100644
--- a/applications/unit_tests/rpc/rpc_test.c
+++ b/applications/unit_tests/rpc/rpc_test.c
@@ -47,7 +47,7 @@ static RpcSessionContext rpc_session[TEST_RPC_SESSIONS];
#define MAX_NAME_LENGTH 255
#define MAX_DATA_SIZE 512u // have to be exact as in rpc_storage.c
#define TEST_DIR TEST_DIR_NAME "/"
-#define TEST_DIR_NAME "/ext/unit_tests_tmp"
+#define TEST_DIR_NAME EXT_PATH("unit_tests_tmp")
#define MD5SUM_SIZE 16
#define PING_REQUEST 0
@@ -83,7 +83,7 @@ static void test_rpc_setup(void) {
furi_check(!rpc);
furi_check(!(rpc_session[0].session));
- rpc = furi_record_open("rpc");
+ rpc = furi_record_open(RECORD_RPC);
for(int i = 0; !(rpc_session[0].session) && (i < 10000); ++i) {
rpc_session[0].session = rpc_session_open(rpc);
furi_delay_tick(1);
@@ -125,7 +125,7 @@ static void test_rpc_teardown(void) {
xSemaphoreTake(rpc_session[0].terminate_semaphore, 0);
rpc_session_close(rpc_session[0].session);
furi_check(xSemaphoreTake(rpc_session[0].terminate_semaphore, portMAX_DELAY));
- furi_record_close("rpc");
+ furi_record_close(RECORD_RPC);
vStreamBufferDelete(rpc_session[0].output_stream);
vSemaphoreDelete(rpc_session[0].close_session_semaphore);
vSemaphoreDelete(rpc_session[0].terminate_semaphore);
@@ -153,17 +153,17 @@ static void test_rpc_teardown_second_session(void) {
static void test_rpc_storage_setup(void) {
test_rpc_setup();
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
clean_directory(fs_api, TEST_DIR_NAME);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void test_rpc_storage_teardown(void) {
test_rpc_teardown();
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
clean_directory(fs_api, TEST_DIR_NAME);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void test_rpc_session_close_callback(void* context) {
@@ -571,7 +571,7 @@ static void test_rpc_storage_list_create_expected_list(
MsgList_t msg_list,
const char* path,
uint32_t command_id) {
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* dir = storage_file_alloc(fs_api);
PB_Main response = {
@@ -627,7 +627,7 @@ static void test_rpc_storage_list_create_expected_list(
storage_dir_close(dir);
storage_file_free(dir);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void test_rpc_decode_and_compare(MsgList_t expected_msg_list, uint8_t session) {
@@ -693,13 +693,13 @@ static void test_rpc_storage_list_run(const char* path, uint32_t command_id) {
MU_TEST(test_storage_list) {
test_rpc_storage_list_run("/", ++command_id);
- test_rpc_storage_list_run("/ext/nfc", ++command_id);
+ test_rpc_storage_list_run(EXT_PATH("nfc"), ++command_id);
- test_rpc_storage_list_run("/int", ++command_id);
- test_rpc_storage_list_run("/ext", ++command_id);
- test_rpc_storage_list_run("/ext/infrared", ++command_id);
- test_rpc_storage_list_run("/ext/ibutton", ++command_id);
- test_rpc_storage_list_run("/ext/lfrfid", ++command_id);
+ test_rpc_storage_list_run(STORAGE_INT_PATH_PREFIX, ++command_id);
+ test_rpc_storage_list_run(STORAGE_EXT_PATH_PREFIX, ++command_id);
+ test_rpc_storage_list_run(EXT_PATH("infrared"), ++command_id);
+ test_rpc_storage_list_run(EXT_PATH("ibutton"), ++command_id);
+ test_rpc_storage_list_run(EXT_PATH("lfrfid"), ++command_id);
test_rpc_storage_list_run("error_path", ++command_id);
}
@@ -718,7 +718,7 @@ static void test_rpc_add_read_to_list_by_reading_real_file(
const char* path,
uint32_t command_id) {
furi_check(MsgList_empty_p(msg_list));
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
bool result = false;
@@ -759,7 +759,7 @@ static void test_rpc_add_read_to_list_by_reading_real_file(
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void test_storage_read_run(const char* path, uint32_t command_id) {
@@ -777,25 +777,25 @@ static void test_storage_read_run(const char* path, uint32_t command_id) {
}
static bool test_is_exists(const char* path) {
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
FileInfo fileinfo;
FS_Error result = storage_common_stat(fs_api, path, &fileinfo);
furi_check((result == FSE_OK) || (result == FSE_NOT_EXIST));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result == FSE_OK;
}
static void test_create_dir(const char* path) {
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
FS_Error error = storage_common_mkdir(fs_api, path);
(void)error;
furi_check((error == FSE_OK) || (error == FSE_EXIST));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
furi_check(test_is_exists(path));
}
static void test_create_file(const char* path, size_t size) {
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(fs_api);
if(storage_file_open(file, path, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
@@ -813,7 +813,7 @@ static void test_create_file(const char* path, size_t size) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
furi_check(test_is_exists(path));
}
@@ -827,7 +827,7 @@ static void test_rpc_storage_info_run(const char* path, uint32_t command_id) {
PB_Main* response = MsgList_push_new(expected_msg_list);
response->command_id = command_id;
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
FS_Error error = storage_common_fs_info(
fs_api,
@@ -856,10 +856,10 @@ static void test_rpc_storage_stat_run(const char* path, uint32_t command_id) {
test_rpc_create_simple_message(&request, PB_Main_storage_stat_request_tag, path, command_id);
- Storage* fs_api = furi_record_open("storage");
+ Storage* fs_api = furi_record_open(RECORD_STORAGE);
FileInfo fileinfo;
FS_Error error = storage_common_stat(fs_api, path, &fileinfo);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
PB_Main* response = MsgList_push_new(expected_msg_list);
response->command_id = command_id;
@@ -884,9 +884,9 @@ static void test_rpc_storage_stat_run(const char* path, uint32_t command_id) {
}
MU_TEST(test_storage_info) {
- test_rpc_storage_info_run("/any", ++command_id);
- test_rpc_storage_info_run("/int", ++command_id);
- test_rpc_storage_info_run("/ext", ++command_id);
+ test_rpc_storage_info_run(STORAGE_ANY_PATH_PREFIX, ++command_id);
+ test_rpc_storage_info_run(STORAGE_INT_PATH_PREFIX, ++command_id);
+ test_rpc_storage_info_run(STORAGE_EXT_PATH_PREFIX, ++command_id);
}
#define TEST_DIR_STAT_NAME TEST_DIR "stat_dir"
@@ -897,8 +897,8 @@ MU_TEST(test_storage_stat) {
test_create_file(TEST_DIR_STAT "l33t.txt", 1337);
test_rpc_storage_stat_run("/", ++command_id);
- test_rpc_storage_stat_run("/int", ++command_id);
- test_rpc_storage_stat_run("/ext", ++command_id);
+ test_rpc_storage_stat_run(STORAGE_INT_PATH_PREFIX, ++command_id);
+ test_rpc_storage_stat_run(STORAGE_EXT_PATH_PREFIX, ++command_id);
test_rpc_storage_stat_run(TEST_DIR_STAT "empty.txt", ++command_id);
test_rpc_storage_stat_run(TEST_DIR_STAT "l33t.txt", ++command_id);
@@ -1225,7 +1225,7 @@ MU_TEST(test_storage_mkdir) {
}
static void test_storage_calculate_md5sum(const char* path, char* md5sum) {
- Storage* api = furi_record_open("storage");
+ Storage* api = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(api);
if(storage_file_open(file, path, FSAM_READ, FSOM_OPEN_EXISTING)) {
@@ -1257,7 +1257,7 @@ static void test_storage_calculate_md5sum(const char* path, char* md5sum) {
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void test_storage_md5sum_run(
@@ -1516,7 +1516,8 @@ static void test_app_get_status_lock_run(bool locked_expected, uint32_t command_
MU_TEST(test_app_start_and_lock_status) {
test_app_get_status_lock_run(false, ++command_id);
- test_app_start_run(NULL, "/ext/file", PB_CommandStatus_ERROR_INVALID_PARAMETERS, ++command_id);
+ test_app_start_run(
+ NULL, EXT_PATH("file"), PB_CommandStatus_ERROR_INVALID_PARAMETERS, ++command_id);
test_app_start_run(NULL, NULL, PB_CommandStatus_ERROR_INVALID_PARAMETERS, ++command_id);
test_app_get_status_lock_run(false, ++command_id);
test_app_start_run(
@@ -1765,23 +1766,23 @@ MU_TEST_SUITE(test_rpc_session) {
MU_RUN_TEST(test_rpc_feed_rubbish);
MU_RUN_TEST(test_rpc_multisession_ping);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_sd_status(storage) != FSE_OK) {
FURI_LOG_E(TAG, "SD card not mounted - skip storage tests");
} else {
MU_RUN_TEST(test_rpc_multisession_storage);
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
int run_minunit_test_rpc() {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
if(storage_sd_status(storage) != FSE_OK) {
FURI_LOG_E(TAG, "SD card not mounted - skip storage tests");
} else {
MU_RUN_SUITE(test_rpc_storage);
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
MU_RUN_SUITE(test_rpc_system);
MU_RUN_SUITE(test_rpc_app);
MU_RUN_SUITE(test_rpc_session);
diff --git a/applications/unit_tests/storage/dirwalk_test.c b/applications/unit_tests/storage/dirwalk_test.c
index 25e12259..db3d91a9 100644
--- a/applications/unit_tests/storage/dirwalk_test.c
+++ b/applications/unit_tests/storage/dirwalk_test.c
@@ -175,10 +175,10 @@ MU_TEST_1(test_dirwalk_full, Storage* storage) {
storage_test_paths_alloc(storage_test_dirwalk_full, COUNT_OF(storage_test_dirwalk_full));
DirWalk* dir_walk = dir_walk_alloc(storage);
- mu_check(dir_walk_open(dir_walk, "/ext/dirwalk"));
+ mu_check(dir_walk_open(dir_walk, EXT_PATH("dirwalk")));
while(dir_walk_read(dir_walk, path, &fileinfo) == DirWalkOK) {
- string_right(path, strlen("/ext/dirwalk/"));
+ string_right(path, strlen(EXT_PATH("dirwalk/")));
mu_check(storage_test_paths_mark(paths, path, (fileinfo.flags & FSF_DIRECTORY)));
}
@@ -200,10 +200,10 @@ MU_TEST_1(test_dirwalk_no_recursive, Storage* storage) {
DirWalk* dir_walk = dir_walk_alloc(storage);
dir_walk_set_recursive(dir_walk, false);
- mu_check(dir_walk_open(dir_walk, "/ext/dirwalk"));
+ mu_check(dir_walk_open(dir_walk, EXT_PATH("dirwalk")));
while(dir_walk_read(dir_walk, path, &fileinfo) == DirWalkOK) {
- string_right(path, strlen("/ext/dirwalk/"));
+ string_right(path, strlen(EXT_PATH("dirwalk/")));
mu_check(storage_test_paths_mark(paths, path, (fileinfo.flags & FSF_DIRECTORY)));
}
@@ -239,10 +239,10 @@ MU_TEST_1(test_dirwalk_filter, Storage* storage) {
DirWalk* dir_walk = dir_walk_alloc(storage);
dir_walk_set_filter_cb(dir_walk, test_dirwalk_filter_no_folder_ext, NULL);
- mu_check(dir_walk_open(dir_walk, "/ext/dirwalk"));
+ mu_check(dir_walk_open(dir_walk, EXT_PATH("dirwalk")));
while(dir_walk_read(dir_walk, path, &fileinfo) == DirWalkOK) {
- string_right(path, strlen("/ext/dirwalk/"));
+ string_right(path, strlen(EXT_PATH("dirwalk/")));
mu_check(storage_test_paths_mark(paths, path, (fileinfo.flags & FSF_DIRECTORY)));
}
@@ -255,15 +255,15 @@ MU_TEST_1(test_dirwalk_filter, Storage* storage) {
}
MU_TEST_SUITE(test_dirwalk_suite) {
- Storage* storage = furi_record_open("storage");
- storage_dirs_create(storage, "/ext/dirwalk");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
+ storage_dirs_create(storage, EXT_PATH("dirwalk"));
MU_RUN_TEST_1(test_dirwalk_full, storage);
MU_RUN_TEST_1(test_dirwalk_no_recursive, storage);
MU_RUN_TEST_1(test_dirwalk_filter, storage);
- storage_simply_remove_recursive(storage, "/ext/dirwalk");
- furi_record_close("storage");
+ storage_simply_remove_recursive(storage, EXT_PATH("dirwalk"));
+ furi_record_close(RECORD_STORAGE);
}
int run_minunit_test_dirwalk() {
diff --git a/applications/unit_tests/storage/storage_test.c b/applications/unit_tests/storage/storage_test.c
index c21abecc..c3628a4f 100644
--- a/applications/unit_tests/storage/storage_test.c
+++ b/applications/unit_tests/storage/storage_test.c
@@ -2,28 +2,28 @@
#include <furi.h>
#include <storage/storage.h>
-#define STORAGE_LOCKED_FILE "/ext/locked_file.test"
-#define STORAGE_LOCKED_DIR "/int"
+#define STORAGE_LOCKED_FILE EXT_PATH("locked_file.test")
+#define STORAGE_LOCKED_DIR STORAGE_INT_PATH_PREFIX
static void storage_file_open_lock_setup() {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(storage);
storage_simply_remove(storage, STORAGE_LOCKED_FILE);
mu_check(storage_file_open(file, STORAGE_LOCKED_FILE, FSAM_WRITE, FSOM_CREATE_NEW));
mu_check(storage_file_write(file, "0123", 4) == 4);
mu_check(storage_file_close(file));
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static void storage_file_open_lock_teardown() {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
mu_check(storage_simply_remove(storage, STORAGE_LOCKED_FILE));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static int32_t storage_file_locker(void* ctx) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FuriSemaphore* semaphore = ctx;
File* file = storage_file_alloc(storage);
furi_check(storage_file_open(file, STORAGE_LOCKED_FILE, FSAM_READ_WRITE, FSOM_OPEN_EXISTING));
@@ -31,13 +31,13 @@ static int32_t storage_file_locker(void* ctx) {
furi_delay_ms(1000);
furi_check(storage_file_close(file));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
storage_file_free(file);
return 0;
}
MU_TEST(storage_file_open_lock) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FuriSemaphore* semaphore = furi_semaphore_alloc(1, 0);
File* file = storage_file_alloc(storage);
@@ -63,13 +63,13 @@ MU_TEST(storage_file_open_lock) {
// clean data
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
mu_assert(result, "cannot open locked file");
}
MU_TEST(storage_file_open_close) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* file;
file = storage_file_alloc(storage);
@@ -84,7 +84,7 @@ MU_TEST(storage_file_open_close) {
storage_file_free(file);
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
MU_TEST_SUITE(storage_file) {
@@ -95,7 +95,7 @@ MU_TEST_SUITE(storage_file) {
}
MU_TEST(storage_dir_open_close) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* file;
file = storage_file_alloc(storage);
@@ -109,11 +109,11 @@ MU_TEST(storage_dir_open_close) {
storage_file_free(file);
}
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
static int32_t storage_dir_locker(void* ctx) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FuriSemaphore* semaphore = ctx;
File* file = storage_file_alloc(storage);
furi_check(storage_dir_open(file, STORAGE_LOCKED_DIR));
@@ -121,13 +121,13 @@ static int32_t storage_dir_locker(void* ctx) {
furi_delay_ms(1000);
furi_check(storage_dir_close(file));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
storage_file_free(file);
return 0;
}
MU_TEST(storage_dir_open_lock) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool result = false;
FuriSemaphore* semaphore = furi_semaphore_alloc(1, 0);
File* file = storage_file_alloc(storage);
@@ -153,7 +153,7 @@ MU_TEST(storage_dir_open_lock) {
// clean data
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
mu_assert(result, "cannot open locked dir");
}
@@ -265,46 +265,48 @@ static bool storage_dir_rename_check(Storage* storage, const char* base) {
}
MU_TEST(storage_file_rename) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(storage);
- mu_check(write_file_13DA(storage, "/ext/file.old"));
- mu_check(check_file_13DA(storage, "/ext/file.old"));
- mu_assert_int_eq(FSE_OK, storage_common_rename(storage, "/ext/file.old", "/ext/file.new"));
- mu_assert_int_eq(FSE_NOT_EXIST, storage_common_stat(storage, "/ext/file.old", NULL));
- mu_assert_int_eq(FSE_OK, storage_common_stat(storage, "/ext/file.new", NULL));
- mu_check(check_file_13DA(storage, "/ext/file.new"));
- mu_assert_int_eq(FSE_OK, storage_common_remove(storage, "/ext/file.new"));
+ mu_check(write_file_13DA(storage, EXT_PATH("file.old")));
+ mu_check(check_file_13DA(storage, EXT_PATH("file.old")));
+ mu_assert_int_eq(
+ FSE_OK, storage_common_rename(storage, EXT_PATH("file.old"), EXT_PATH("file.new")));
+ mu_assert_int_eq(FSE_NOT_EXIST, storage_common_stat(storage, EXT_PATH("file.old"), NULL));
+ mu_assert_int_eq(FSE_OK, storage_common_stat(storage, EXT_PATH("file.new"), NULL));
+ mu_check(check_file_13DA(storage, EXT_PATH("file.new")));
+ mu_assert_int_eq(FSE_OK, storage_common_remove(storage, EXT_PATH("file.new")));
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
MU_TEST(storage_dir_rename) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
- storage_dir_create(storage, "/ext/dir.old");
+ storage_dir_create(storage, EXT_PATH("dir.old"));
- mu_check(storage_dir_rename_check(storage, "/ext/dir.old"));
+ mu_check(storage_dir_rename_check(storage, EXT_PATH("dir.old")));
- mu_assert_int_eq(FSE_OK, storage_common_rename(storage, "/ext/dir.old", "/ext/dir.new"));
- mu_assert_int_eq(FSE_NOT_EXIST, storage_common_stat(storage, "/ext/dir.old", NULL));
- mu_check(storage_dir_rename_check(storage, "/ext/dir.new"));
+ mu_assert_int_eq(
+ FSE_OK, storage_common_rename(storage, EXT_PATH("dir.old"), EXT_PATH("dir.new")));
+ mu_assert_int_eq(FSE_NOT_EXIST, storage_common_stat(storage, EXT_PATH("dir.old"), NULL));
+ mu_check(storage_dir_rename_check(storage, EXT_PATH("dir.new")));
- storage_dir_remove(storage, "/ext/dir.new");
- mu_assert_int_eq(FSE_NOT_EXIST, storage_common_stat(storage, "/ext/dir.new", NULL));
+ storage_dir_remove(storage, EXT_PATH("dir.new"));
+ mu_assert_int_eq(FSE_NOT_EXIST, storage_common_stat(storage, EXT_PATH("dir.new"), NULL));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
MU_TEST_SUITE(storage_rename) {
MU_RUN_TEST(storage_file_rename);
MU_RUN_TEST(storage_dir_rename);
- Storage* storage = furi_record_open("storage");
- storage_dir_remove(storage, "/ext/dir.old");
- storage_dir_remove(storage, "/ext/dir.new");
- furi_record_close("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
+ storage_dir_remove(storage, EXT_PATH("dir.old"));
+ storage_dir_remove(storage, EXT_PATH("dir.new"));
+ furi_record_close(RECORD_STORAGE);
}
int run_minunit_test_storage() {
diff --git a/applications/unit_tests/stream/stream_test.c b/applications/unit_tests/stream/stream_test.c
index 65f1409a..36155e33 100644
--- a/applications/unit_tests/stream/stream_test.c
+++ b/applications/unit_tests/stream/stream_test.c
@@ -278,19 +278,20 @@ MU_TEST(stream_composite_test) {
stream_free(stream);
// test file stream
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
stream = file_stream_alloc(storage);
- mu_check(file_stream_open(stream, "/ext/filestream.str", FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
+ mu_check(
+ file_stream_open(stream, EXT_PATH("filestream.str"), FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
MU_RUN_TEST_1(stream_composite_subtest, stream);
stream_free(stream);
// test buffered file stream
stream = buffered_file_stream_alloc(storage);
mu_check(buffered_file_stream_open(
- stream, "/ext/filestream.str", FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
+ stream, EXT_PATH("filestream.str"), FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
MU_RUN_TEST_1(stream_composite_subtest, stream);
stream_free(stream);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
MU_TEST_1(stream_write_subtest, Stream* stream) {
@@ -307,7 +308,7 @@ MU_TEST_1(stream_read_subtest, Stream* stream) {
MU_TEST(stream_write_read_save_load_test) {
Stream* stream_orig = string_stream_alloc();
Stream* stream_copy = string_stream_alloc();
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
// write, read
MU_RUN_TEST_1(stream_write_subtest, stream_orig);
@@ -321,7 +322,7 @@ MU_TEST(stream_write_read_save_load_test) {
mu_check(stream_seek(stream_orig, 0, StreamOffsetFromStart));
mu_assert_int_eq(
strlen(stream_test_data),
- stream_save_to_file(stream_orig, storage, "/ext/filestream.str", FSOM_CREATE_ALWAYS));
+ stream_save_to_file(stream_orig, storage, EXT_PATH("filestream.str"), FSOM_CREATE_ALWAYS));
stream_free(stream_copy);
stream_free(stream_orig);
@@ -330,11 +331,11 @@ MU_TEST(stream_write_read_save_load_test) {
Stream* stream_new = string_stream_alloc();
mu_assert_int_eq(
strlen(stream_test_data),
- stream_load_from_file(stream_new, storage, "/ext/filestream.str"));
+ stream_load_from_file(stream_new, storage, EXT_PATH("filestream.str")));
MU_RUN_TEST_1(stream_read_subtest, stream_new);
stream_free(stream_new);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
MU_TEST_1(stream_split_subtest, Stream* stream) {
@@ -369,20 +370,21 @@ MU_TEST(stream_split_test) {
stream_free(stream);
// test file stream
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
stream = file_stream_alloc(storage);
- mu_check(file_stream_open(stream, "/ext/filestream.str", FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
+ mu_check(
+ file_stream_open(stream, EXT_PATH("filestream.str"), FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
MU_RUN_TEST_1(stream_split_subtest, stream);
stream_free(stream);
// test buffered stream
stream = buffered_file_stream_alloc(storage);
mu_check(buffered_file_stream_open(
- stream, "/ext/filestream.str", FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
+ stream, EXT_PATH("filestream.str"), FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
MU_RUN_TEST_1(stream_split_subtest, stream);
stream_free(stream);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
}
MU_TEST(stream_buffered_large_file_test) {
@@ -391,7 +393,7 @@ MU_TEST(stream_buffered_large_file_test) {
string_init(input_data);
string_init(output_data);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
// generate test data consisting of several identical lines
const size_t data_size = 4096;
@@ -405,7 +407,7 @@ MU_TEST(stream_buffered_large_file_test) {
// write test data to file
Stream* stream = buffered_file_stream_alloc(storage);
mu_check(buffered_file_stream_open(
- stream, "/ext/filestream.str", FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
+ stream, EXT_PATH("filestream.str"), FSAM_READ_WRITE, FSOM_CREATE_ALWAYS));
mu_assert_int_eq(0, stream_size(stream));
mu_assert_int_eq(string_size(input_data), stream_write_string(stream, input_data));
mu_assert_int_eq(string_size(input_data), stream_size(stream));
@@ -459,7 +461,7 @@ MU_TEST(stream_buffered_large_file_test) {
stream_free(stream);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
string_clear(input_data);
string_clear(output_data);
}
diff --git a/applications/unit_tests/subghz/subghz_test.c b/applications/unit_tests/subghz/subghz_test.c
index 23c6117b..4799d235 100644
--- a/applications/unit_tests/subghz/subghz_test.c
+++ b/applications/unit_tests/subghz/subghz_test.c
@@ -9,10 +9,10 @@
#include <flipper_format/flipper_format_i.h>
#define TAG "SubGhz TEST"
-#define KEYSTORE_DIR_NAME "/ext/subghz/assets/keeloq_mfcodes"
-#define CAME_ATOMO_DIR_NAME "/ext/subghz/assets/came_atomo"
-#define NICE_FLOR_S_DIR_NAME "/ext/subghz/assets/nice_flor_s"
-#define TEST_RANDOM_DIR_NAME "/ext/unit_tests/subghz/test_random_raw.sub"
+#define KEYSTORE_DIR_NAME EXT_PATH("subghz/assets/keeloq_mfcodes")
+#define CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo")
+#define NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s")
+#define TEST_RANDOM_DIR_NAME EXT_PATH("unit_tests/subghz/test_random_raw.sub")
#define TEST_RANDOM_COUNT_PARSE 119
#define TEST_TIMEOUT 10000
@@ -145,7 +145,7 @@ static bool subghz_encoder_test(const char* path) {
string_init(temp_str);
bool file_load = false;
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
do {
@@ -210,234 +210,243 @@ MU_TEST(subghz_keystore_test) {
MU_TEST(subghz_decoder_came_atomo_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/came_atomo_raw.sub", SUBGHZ_PROTOCOL_CAME_ATOMO_NAME),
+ EXT_PATH("unit_tests/subghz/came_atomo_raw.sub"), SUBGHZ_PROTOCOL_CAME_ATOMO_NAME),
"Test decoder " SUBGHZ_PROTOCOL_CAME_ATOMO_NAME " error\r\n");
}
MU_TEST(subghz_decoder_came_test) {
mu_assert(
- subghz_decoder_test("/ext/unit_tests/subghz/came_raw.sub", SUBGHZ_PROTOCOL_CAME_NAME),
+ subghz_decoder_test(EXT_PATH("unit_tests/subghz/came_raw.sub"), SUBGHZ_PROTOCOL_CAME_NAME),
"Test decoder " SUBGHZ_PROTOCOL_CAME_NAME " error\r\n");
}
MU_TEST(subghz_decoder_came_twee_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/came_twee_raw.sub", SUBGHZ_PROTOCOL_CAME_TWEE_NAME),
+ EXT_PATH("unit_tests/subghz/came_twee_raw.sub"), SUBGHZ_PROTOCOL_CAME_TWEE_NAME),
"Test decoder " SUBGHZ_PROTOCOL_CAME_TWEE_NAME " error\r\n");
}
MU_TEST(subghz_decoder_faac_slh_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/faac_slh_raw.sub", SUBGHZ_PROTOCOL_FAAC_SLH_NAME),
+ EXT_PATH("unit_tests/subghz/faac_slh_raw.sub"), SUBGHZ_PROTOCOL_FAAC_SLH_NAME),
"Test decoder " SUBGHZ_PROTOCOL_FAAC_SLH_NAME " error\r\n");
}
MU_TEST(subghz_decoder_gate_tx_test) {
mu_assert(
- subghz_decoder_test("/ext/unit_tests/subghz/gate_tx_raw.sub", SUBGHZ_PROTOCOL_GATE_TX_NAME),
+ subghz_decoder_test(
+ EXT_PATH("unit_tests/subghz/gate_tx_raw.sub"), SUBGHZ_PROTOCOL_GATE_TX_NAME),
"Test decoder " SUBGHZ_PROTOCOL_GATE_TX_NAME " error\r\n");
}
MU_TEST(subghz_decoder_hormann_hsm_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/hormann_hsm_raw.sub", SUBGHZ_PROTOCOL_HORMANN_HSM_NAME),
+ EXT_PATH("unit_tests/subghz/hormann_hsm_raw.sub"), SUBGHZ_PROTOCOL_HORMANN_HSM_NAME),
"Test decoder " SUBGHZ_PROTOCOL_HORMANN_HSM_NAME " error\r\n");
}
MU_TEST(subghz_decoder_ido_test) {
mu_assert(
- subghz_decoder_test("/ext/unit_tests/subghz/ido_117_111_raw.sub", SUBGHZ_PROTOCOL_IDO_NAME),
+ subghz_decoder_test(
+ EXT_PATH("unit_tests/subghz/ido_117_111_raw.sub"), SUBGHZ_PROTOCOL_IDO_NAME),
"Test decoder " SUBGHZ_PROTOCOL_IDO_NAME " error\r\n");
}
MU_TEST(subghz_decoder_keelog_test) {
mu_assert(
- subghz_decoder_test("/ext/unit_tests/subghz/doorhan_raw.sub", SUBGHZ_PROTOCOL_KEELOQ_NAME),
+ subghz_decoder_test(
+ EXT_PATH("unit_tests/subghz/doorhan_raw.sub"), SUBGHZ_PROTOCOL_KEELOQ_NAME),
"Test decoder " SUBGHZ_PROTOCOL_KEELOQ_NAME " error\r\n");
}
MU_TEST(subghz_decoder_kia_seed_test) {
mu_assert(
- subghz_decoder_test("/ext/unit_tests/subghz/kia_seed_raw.sub", SUBGHZ_PROTOCOL_KIA_NAME),
+ subghz_decoder_test(
+ EXT_PATH("unit_tests/subghz/kia_seed_raw.sub"), SUBGHZ_PROTOCOL_KIA_NAME),
"Test decoder " SUBGHZ_PROTOCOL_KIA_NAME " error\r\n");
}
MU_TEST(subghz_decoder_nero_radio_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/nero_radio_raw.sub", SUBGHZ_PROTOCOL_NERO_RADIO_NAME),
+ EXT_PATH("unit_tests/subghz/nero_radio_raw.sub"), SUBGHZ_PROTOCOL_NERO_RADIO_NAME),
"Test decoder " SUBGHZ_PROTOCOL_NERO_RADIO_NAME " error\r\n");
}
MU_TEST(subghz_decoder_nero_sketch_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/nero_sketch_raw.sub", SUBGHZ_PROTOCOL_NERO_SKETCH_NAME),
+ EXT_PATH("unit_tests/subghz/nero_sketch_raw.sub"), SUBGHZ_PROTOCOL_NERO_SKETCH_NAME),
"Test decoder " SUBGHZ_PROTOCOL_NERO_SKETCH_NAME " error\r\n");
}
MU_TEST(subghz_decoder_nice_flo_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/nice_flo_raw.sub", SUBGHZ_PROTOCOL_NICE_FLO_NAME),
+ EXT_PATH("unit_tests/subghz/nice_flo_raw.sub"), SUBGHZ_PROTOCOL_NICE_FLO_NAME),
"Test decoder " SUBGHZ_PROTOCOL_NICE_FLO_NAME " error\r\n");
}
MU_TEST(subghz_decoder_nice_flor_s_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/nice_flor_s_raw.sub", SUBGHZ_PROTOCOL_NICE_FLOR_S_NAME),
+ EXT_PATH("unit_tests/subghz/nice_flor_s_raw.sub"), SUBGHZ_PROTOCOL_NICE_FLOR_S_NAME),
"Test decoder " SUBGHZ_PROTOCOL_NICE_FLOR_S_NAME " error\r\n");
}
MU_TEST(subghz_decoder_princeton_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/Princeton_raw.sub", SUBGHZ_PROTOCOL_PRINCETON_NAME),
+ EXT_PATH("unit_tests/subghz/Princeton_raw.sub"), SUBGHZ_PROTOCOL_PRINCETON_NAME),
"Test decoder " SUBGHZ_PROTOCOL_PRINCETON_NAME " error\r\n");
}
MU_TEST(subghz_decoder_scher_khan_magic_code_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/scher_khan_magic_code.sub", SUBGHZ_PROTOCOL_SCHER_KHAN_NAME),
+ EXT_PATH("unit_tests/subghz/scher_khan_magic_code.sub"),
+ SUBGHZ_PROTOCOL_SCHER_KHAN_NAME),
"Test decoder " SUBGHZ_PROTOCOL_SCHER_KHAN_NAME " error\r\n");
}
MU_TEST(subghz_decoder_somfy_keytis_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/Somfy_keytis_raw.sub", SUBGHZ_PROTOCOL_SOMFY_KEYTIS_NAME),
+ EXT_PATH("unit_tests/subghz/Somfy_keytis_raw.sub"), SUBGHZ_PROTOCOL_SOMFY_KEYTIS_NAME),
"Test decoder " SUBGHZ_PROTOCOL_SOMFY_KEYTIS_NAME " error\r\n");
}
MU_TEST(subghz_decoder_somfy_telis_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/somfy_telis_raw.sub", SUBGHZ_PROTOCOL_SOMFY_TELIS_NAME),
+ EXT_PATH("unit_tests/subghz/somfy_telis_raw.sub"), SUBGHZ_PROTOCOL_SOMFY_TELIS_NAME),
"Test decoder " SUBGHZ_PROTOCOL_SOMFY_TELIS_NAME " error\r\n");
}
MU_TEST(subghz_decoder_star_line_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/cenmax_raw.sub", SUBGHZ_PROTOCOL_STAR_LINE_NAME),
+ EXT_PATH("unit_tests/subghz/cenmax_raw.sub"), SUBGHZ_PROTOCOL_STAR_LINE_NAME),
"Test decoder " SUBGHZ_PROTOCOL_STAR_LINE_NAME " error\r\n");
}
MU_TEST(subghz_decoder_linear_test) {
mu_assert(
- subghz_decoder_test("/ext/unit_tests/subghz/linear_raw.sub", SUBGHZ_PROTOCOL_LINEAR_NAME),
+ subghz_decoder_test(
+ EXT_PATH("unit_tests/subghz/linear_raw.sub"), SUBGHZ_PROTOCOL_LINEAR_NAME),
"Test decoder " SUBGHZ_PROTOCOL_LINEAR_NAME " error\r\n");
}
MU_TEST(subghz_decoder_megacode_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/megacode_raw.sub", SUBGHZ_PROTOCOL_MEGACODE_NAME),
+ EXT_PATH("unit_tests/subghz/megacode_raw.sub"), SUBGHZ_PROTOCOL_MEGACODE_NAME),
"Test decoder " SUBGHZ_PROTOCOL_MEGACODE_NAME " error\r\n");
}
MU_TEST(subghz_decoder_secplus_v1_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/security_pls_1_0_raw.sub", SUBGHZ_PROTOCOL_SECPLUS_V1_NAME),
+ EXT_PATH("unit_tests/subghz/security_pls_1_0_raw.sub"),
+ SUBGHZ_PROTOCOL_SECPLUS_V1_NAME),
"Test decoder " SUBGHZ_PROTOCOL_SECPLUS_V1_NAME " error\r\n");
}
MU_TEST(subghz_decoder_secplus_v2_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/security_pls_2_0_raw.sub", SUBGHZ_PROTOCOL_SECPLUS_V2_NAME),
+ EXT_PATH("unit_tests/subghz/security_pls_2_0_raw.sub"),
+ SUBGHZ_PROTOCOL_SECPLUS_V2_NAME),
"Test decoder " SUBGHZ_PROTOCOL_SECPLUS_V2_NAME " error\r\n");
}
MU_TEST(subghz_decoder_holtek_test) {
mu_assert(
- subghz_decoder_test("/ext/unit_tests/subghz/holtek_raw.sub", SUBGHZ_PROTOCOL_HOLTEK_NAME),
+ subghz_decoder_test(
+ EXT_PATH("unit_tests/subghz/holtek_raw.sub"), SUBGHZ_PROTOCOL_HOLTEK_NAME),
"Test decoder " SUBGHZ_PROTOCOL_HOLTEK_NAME " error\r\n");
}
MU_TEST(subghz_decoder_power_smart_test) {
mu_assert(
subghz_decoder_test(
- "/ext/unit_tests/subghz/power_smart_raw.sub", SUBGHZ_PROTOCOL_POWER_SMART_NAME),
+ EXT_PATH("unit_tests/subghz/power_smart_raw.sub"), SUBGHZ_PROTOCOL_POWER_SMART_NAME),
"Test decoder " SUBGHZ_PROTOCOL_POWER_SMART_NAME " error\r\n");
}
//test encoders
MU_TEST(subghz_encoder_princeton_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/princeton.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/princeton.sub")),
"Test encoder " SUBGHZ_PROTOCOL_PRINCETON_NAME " error\r\n");
}
MU_TEST(subghz_encoder_came_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/came.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/came.sub")),
"Test encoder " SUBGHZ_PROTOCOL_CAME_NAME " error\r\n");
}
MU_TEST(subghz_encoder_came_twee_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/came_twee.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/came_twee.sub")),
"Test encoder " SUBGHZ_PROTOCOL_CAME_TWEE_NAME " error\r\n");
}
MU_TEST(subghz_encoder_gate_tx_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/gate_tx.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/gate_tx.sub")),
"Test encoder " SUBGHZ_PROTOCOL_GATE_TX_NAME " error\r\n");
}
MU_TEST(subghz_encoder_nice_flo_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/nice_flo.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/nice_flo.sub")),
"Test encoder " SUBGHZ_PROTOCOL_NICE_FLO_NAME " error\r\n");
}
MU_TEST(subghz_encoder_keelog_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/doorhan.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/doorhan.sub")),
"Test encoder " SUBGHZ_PROTOCOL_KEELOQ_NAME " error\r\n");
}
MU_TEST(subghz_encoder_linear_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/linear.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/linear.sub")),
"Test encoder " SUBGHZ_PROTOCOL_LINEAR_NAME " error\r\n");
}
MU_TEST(subghz_encoder_megacode_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/megacode.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/megacode.sub")),
"Test encoder " SUBGHZ_PROTOCOL_MEGACODE_NAME " error\r\n");
}
MU_TEST(subghz_encoder_holtek_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/holtek.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/holtek.sub")),
"Test encoder " SUBGHZ_PROTOCOL_HOLTEK_NAME " error\r\n");
}
MU_TEST(subghz_encoder_secplus_v1_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/security_pls_1_0.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/security_pls_1_0.sub")),
"Test encoder " SUBGHZ_PROTOCOL_SECPLUS_V1_NAME " error\r\n");
}
MU_TEST(subghz_encoder_secplus_v2_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/security_pls_2_0.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/security_pls_2_0.sub")),
"Test encoder " SUBGHZ_PROTOCOL_SECPLUS_V2_NAME " error\r\n");
}
MU_TEST(subghz_encoder_power_smart_test) {
mu_assert(
- subghz_encoder_test("/ext/unit_tests/subghz/power_smart.sub"),
+ subghz_encoder_test(EXT_PATH("unit_tests/subghz/power_smart.sub")),
"Test encoder " SUBGHZ_PROTOCOL_POWER_SMART_NAME " error\r\n");
}
diff --git a/applications/unit_tests/test_index.c b/applications/unit_tests/test_index.c
index ca7641b1..e5282246 100644
--- a/applications/unit_tests/test_index.c
+++ b/applications/unit_tests/test_index.c
@@ -67,8 +67,8 @@ void unit_tests_cli(Cli* cli, string_t args, void* context) {
minunit_fail = 0;
minunit_status = 0;
- Loader* loader = furi_record_open("loader");
- NotificationApp* notification = furi_record_open("notification");
+ Loader* loader = furi_record_open(RECORD_LOADER);
+ NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
// TODO: lock device while test running
if(loader_is_locked(loader)) {
@@ -116,16 +116,16 @@ void unit_tests_cli(Cli* cli, string_t args, void* context) {
}
}
- furi_record_close("notification");
- furi_record_close("loader");
+ furi_record_close(RECORD_NOTIFICATION);
+ furi_record_close(RECORD_LOADER);
}
void unit_tests_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = furi_record_open("cli");
+ Cli* cli = furi_record_open(RECORD_CLI);
// We need to launch apps from tests, so we cannot lock loader
cli_add_command(cli, "unit_tests", CliCommandFlagParallelSafe, unit_tests_cli, NULL);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#endif
}
diff --git a/applications/updater/cli/updater_cli.c b/applications/updater/cli/updater_cli.c
index 3dfd145c..ec209bd1 100644
--- a/applications/updater/cli/updater_cli.c
+++ b/applications/updater/cli/updater_cli.c
@@ -35,17 +35,17 @@ static void updater_cli_install(string_t manifest_path) {
static void updater_cli_backup(string_t args) {
printf("Backup /int to '%s'\r\n", string_get_cstr(args));
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool success = lfs_backup_create(storage, string_get_cstr(args));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
printf("Result: %s\r\n", success ? "OK" : "FAIL");
}
static void updater_cli_restore(string_t args) {
printf("Restore /int from '%s'\r\n", string_get_cstr(args));
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
bool success = lfs_backup_unpack(storage, string_get_cstr(args));
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
printf("Result: %s\r\n", success ? "OK" : "FAIL");
}
@@ -88,9 +88,9 @@ static void updater_cli_ep(Cli* cli, string_t args, void* context) {
static int32_t updater_spawner_thread_worker(void* arg) {
UNUSED(arg);
- Loader* loader = furi_record_open("loader");
+ Loader* loader = furi_record_open(RECORD_LOADER);
loader_start(loader, "UpdaterApp", NULL);
- furi_record_close("loader");
+ furi_record_close(RECORD_LOADER);
return 0;
}
@@ -123,9 +123,9 @@ static void updater_start_app() {
void updater_on_system_start() {
#ifdef SRV_CLI
- Cli* cli = (Cli*)furi_record_open("cli");
+ Cli* cli = (Cli*)furi_record_open(RECORD_CLI);
cli_add_command(cli, "update", CliCommandFlagDefault, updater_cli_ep, NULL);
- furi_record_close("cli");
+ furi_record_close(RECORD_CLI);
#else
UNUSED(updater_cli_ep);
#endif
diff --git a/applications/updater/updater.c b/applications/updater/updater.c
index 4c9fe41f..daba9eaf 100644
--- a/applications/updater/updater.c
+++ b/applications/updater/updater.c
@@ -36,15 +36,15 @@ Updater* updater_alloc(const char* arg) {
Updater* updater = malloc(sizeof(Updater));
if(arg) {
string_init_set_str(updater->startup_arg, arg);
- string_replace_str(updater->startup_arg, "/any/", "/ext/");
+ string_replace_str(updater->startup_arg, ANY_PATH(""), EXT_PATH(""));
} else {
string_init(updater->startup_arg);
}
- updater->storage = furi_record_open("storage");
- updater->notification = furi_record_open("notification");
+ updater->storage = furi_record_open(RECORD_STORAGE);
+ updater->notification = furi_record_open(RECORD_NOTIFICATION);
- updater->gui = furi_record_open("gui");
+ updater->gui = furi_record_open(RECORD_GUI);
updater->view_dispatcher = view_dispatcher_alloc();
updater->scene_manager = scene_manager_alloc(&updater_scene_handlers, updater);
@@ -111,9 +111,9 @@ void updater_free(Updater* updater) {
view_dispatcher_free(updater->view_dispatcher);
scene_manager_free(updater->scene_manager);
- furi_record_close("gui");
- furi_record_close("storage");
- furi_record_close("notification");
+ furi_record_close(RECORD_GUI);
+ furi_record_close(RECORD_STORAGE);
+ furi_record_close(RECORD_NOTIFICATION);
free(updater);
}
diff --git a/applications/updater/util/update_task.c b/applications/updater/util/update_task.c
index f7b9f812..6864076d 100644
--- a/applications/updater/util/update_task.c
+++ b/applications/updater/util/update_task.c
@@ -211,7 +211,7 @@ UpdateTask* update_task_alloc() {
string_init(update_task->state.status);
update_task->manifest = update_manifest_alloc();
- update_task->storage = furi_record_open("storage");
+ update_task->storage = furi_record_open(RECORD_STORAGE);
update_task->file = storage_file_alloc(update_task->storage);
update_task->status_change_cb = NULL;
update_task->boot_mode = furi_hal_rtc_get_boot_mode();
@@ -246,7 +246,7 @@ void update_task_free(UpdateTask* update_task) {
storage_file_free(update_task->file);
update_manifest_free(update_task->manifest);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
string_clear(update_task->update_path);
free(update_task);
diff --git a/applications/updater/util/update_task_worker_backup.c b/applications/updater/util/update_task_worker_backup.c
index 1e8c2f09..09e45953 100644
--- a/applications/updater/util/update_task_worker_backup.c
+++ b/applications/updater/util/update_task_worker_backup.c
@@ -4,6 +4,7 @@
#include <furi.h>
#include <furi_hal.h>
#include <storage/storage.h>
+#include <desktop/helpers/slideshow_filename.h>
#include <toolbox/path.h>
#include <update_util/dfu_file.h>
#include <update_util/lfs_backup.h>
@@ -18,8 +19,6 @@
break; \
}
-#define EXT_PATH "/ext"
-
static bool update_task_pre_update(UpdateTask* update_task) {
bool success = false;
string_t backup_file_path;
@@ -89,7 +88,7 @@ static bool update_task_post_update(UpdateTask* update_task) {
progress.total_files = tar_archive_get_entries_count(archive);
if(progress.total_files > 0) {
- CHECK_RESULT(tar_archive_unpack_to(archive, EXT_PATH));
+ CHECK_RESULT(tar_archive_unpack_to(archive, STORAGE_EXT_PATH_PREFIX, NULL));
}
}
@@ -99,7 +98,9 @@ static bool update_task_post_update(UpdateTask* update_task) {
string_init_set(tmp_path, update_task->update_path);
path_append(tmp_path, string_get_cstr(update_task->manifest->splash_file));
if(storage_common_copy(
- update_task->storage, string_get_cstr(tmp_path), "/int/slideshow") != FSE_OK) {
+ update_task->storage,
+ string_get_cstr(tmp_path),
+ INT_PATH(SLIDESHOW_FILE_NAME)) != FSE_OK) {
// actually, not critical
}
string_clear(tmp_path);
@@ -129,10 +130,6 @@ int32_t update_task_worker_backup_restore(void* context) {
break;
}
- /* Waiting for BT service to 'start', so we don't race for boot mode flag */
- furi_record_open("bt");
- furi_record_close("bt");
-
if(boot_mode == FuriHalRtcBootModePreUpdate) {
success = update_task_pre_update(update_task);
} else if(boot_mode == FuriHalRtcBootModePostUpdate) {
diff --git a/firmware/targets/f7/Src/update.c b/firmware/targets/f7/Src/update.c
index bab3b9aa..af247195 100644
--- a/firmware/targets/f7/Src/update.c
+++ b/firmware/targets/f7/Src/update.c
@@ -11,8 +11,7 @@
#include <toolbox/path.h>
#include <toolbox/crc32_calc.h>
-#define FS_ROOT_PATH "/"
-#define UPDATE_POINTER_FILE_PATH FS_ROOT_PATH UPDATE_MANIFEST_POINTER_FILE_NAME
+#define UPDATE_POINTER_FILE_PATH "/" UPDATE_MANIFEST_POINTER_FILE_NAME
static FATFS* pfs = NULL;
@@ -40,7 +39,7 @@ static bool flipper_update_init() {
}
pfs = malloc(sizeof(FATFS));
- CHECK_FRESULT(f_mount(pfs, FS_ROOT_PATH, 1));
+ CHECK_FRESULT(f_mount(pfs, "/", 1));
return true;
}
@@ -119,7 +118,7 @@ static bool flipper_update_get_manifest_path(string_t out_path) {
break;
}
string_set_str(out_path, manifest_name_buf);
- string_right(out_path, strlen("/ext"));
+ string_right(out_path, strlen(STORAGE_EXT_PATH_PREFIX));
} while(0);
f_close(&file);
return !string_empty_p(out_path);
diff --git a/lib/flipper_format/flipper_format.h b/lib/flipper_format/flipper_format.h
index 3f7b71af..09928c18 100644
--- a/lib/flipper_format/flipper_format.h
+++ b/lib/flipper_format/flipper_format.h
@@ -50,7 +50,7 @@
* const uint16_t array_size = 4;
* const uint8_t* array[array_size] = {0x00, 0x01, 0xFF, 0xA3};
*
- * if(!flipper_format_file_open_new(format, "/ext/flipper_format_test")) break;
+ * if(!flipper_format_file_open_new(format, EXT_PATH("flipper_format_test"))) break;
* if(!flipper_format_write_header_cstr(format, "Flipper Test File", version)) break;
* if(!flipper_format_write_comment_cstr(format, "Just test file")) break;
* if(!flipper_format_write_string_cstr(format, "String", string_value)) break;
@@ -78,7 +78,7 @@
* string_init(file_type);
* string_init(string_value);
*
- * if(!flipper_format_file_open_existing(file, "/ext/flipper_format_test")) break;
+ * if(!flipper_format_file_open_existing(file, EXT_PATH("flipper_format_test"))) break;
* if(!flipper_format_read_header(file, file_type, &version)) break;
* if(!flipper_format_read_string(file, "String", string_value)) break;
* if(!flipper_format_read_uint32(file, "UINT", &uint32_value, 1)) break;
diff --git a/lib/infrared/worker/infrared_worker.c b/lib/infrared/worker/infrared_worker.c
index becd8d88..2b4e3cdb 100644
--- a/lib/infrared/worker/infrared_worker.c
+++ b/lib/infrared/worker/infrared_worker.c
@@ -236,7 +236,7 @@ InfraredWorker* infrared_worker_alloc() {
instance->infrared_decoder = infrared_alloc_decoder();
instance->infrared_encoder = infrared_alloc_encoder();
instance->blink_enable = false;
- instance->notification = furi_record_open("notification");
+ instance->notification = furi_record_open(RECORD_NOTIFICATION);
instance->state = InfraredWorkerStateIdle;
return instance;
@@ -246,7 +246,7 @@ void infrared_worker_free(InfraredWorker* instance) {
furi_assert(instance);
furi_assert(instance->state == InfraredWorkerStateIdle);
- furi_record_close("notification");
+ furi_record_close(RECORD_NOTIFICATION);
infrared_free_decoder(instance->infrared_decoder);
infrared_free_encoder(instance->infrared_encoder);
vStreamBufferDelete(instance->stream);
diff --git a/lib/subghz/protocols/raw.c b/lib/subghz/protocols/raw.c
index ebc84c11..6a75d159 100644
--- a/lib/subghz/protocols/raw.c
+++ b/lib/subghz/protocols/raw.c
@@ -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;
diff --git a/lib/subghz/subghz_file_encoder_worker.c b/lib/subghz/subghz_file_encoder_worker.c
index 457c8b02..8f65ea00 100644
--- a/lib/subghz/subghz_file_encoder_worker.c
+++ b/lib/subghz/subghz_file_encoder_worker.c
@@ -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);
}
diff --git a/lib/subghz/subghz_keystore.c b/lib/subghz/subghz_keystore.c
index d3903bc5..0abd2d5e 100644
--- a/lib/subghz/subghz_keystore.c
+++ b/lib/subghz/subghz_keystore.c
@@ -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);
diff --git a/lib/subghz/types.h b/lib/subghz/types.h
index 49f971f0..46e5ec24 100644
--- a/lib/subghz/types.h
+++ b/lib/subghz/types.h
@@ -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
diff --git a/lib/toolbox/dir_walk.c b/lib/toolbox/dir_walk.c
index 2efbc0f1..348bd544 100644
--- a/lib/toolbox/dir_walk.c
+++ b/lib/toolbox/dir_walk.c
@@ -55,7 +55,7 @@ static bool dir_walk_filter(DirWalk* dir_walk, const char* name, FileInfo* filei
static DirWalkResult dir_walk_iter(DirWalk* dir_walk, string_t return_path, FileInfo* fileinfo) {
DirWalkResult result = DirWalkError;
- char* name = malloc(256);
+ char* name = malloc(256); // FIXME: remove magic number
FileInfo info;
bool end = false;
diff --git a/lib/toolbox/path.c b/lib/toolbox/path.c
index 767742ac..38af1efe 100644
--- a/lib/toolbox/path.c
+++ b/lib/toolbox/path.c
@@ -56,7 +56,7 @@ void path_extract_basename(const char* path, string_t basename) {
path_cleanup(basename);
size_t pos = string_search_rchar(basename, '/');
if(pos != STRING_FAILURE) {
- string_right(basename, pos);
+ string_right(basename, pos + 1);
}
}
diff --git a/lib/toolbox/saved_struct.c b/lib/toolbox/saved_struct.c
index ef7dbcf7..65b761f8 100644
--- a/lib/toolbox/saved_struct.c
+++ b/lib/toolbox/saved_struct.c
@@ -22,7 +22,7 @@ bool saved_struct_save(const char* path, void* data, size_t size, uint8_t magic,
FURI_LOG_I(TAG, "Saving \"%s\"", path);
// Store
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(storage);
bool result = true;
bool saved = storage_file_open(file, path, FSAM_WRITE, FSOM_CREATE_ALWAYS);
@@ -58,7 +58,7 @@ bool saved_struct_save(const char* path, void* data, size_t size, uint8_t magic,
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
@@ -68,7 +68,7 @@ bool saved_struct_load(const char* path, void* data, size_t size, uint8_t magic,
SavedStructHeader header;
uint8_t* data_read = malloc(size);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
File* file = storage_file_alloc(storage);
bool result = true;
bool loaded = storage_file_open(file, path, FSAM_READ, FSOM_OPEN_EXISTING);
@@ -120,7 +120,7 @@ bool saved_struct_load(const char* path, void* data, size_t size, uint8_t magic,
storage_file_close(file);
storage_file_free(file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
free(data_read);
return result;
diff --git a/lib/toolbox/stream/file_stream.c b/lib/toolbox/stream/file_stream.c
index 70db8af9..f7363c6b 100644
--- a/lib/toolbox/stream/file_stream.c
+++ b/lib/toolbox/stream/file_stream.c
@@ -176,8 +176,9 @@ static bool file_stream_delete_and_insert(
string_t scratch_name;
string_t tmp_name;
string_init(tmp_name);
- storage_get_next_filename(_stream->storage, "/any", ".scratch", ".pad", tmp_name, 255);
- string_init_printf(scratch_name, "/any/%s.pad", string_get_cstr(tmp_name));
+ storage_get_next_filename(
+ _stream->storage, STORAGE_ANY_PATH_PREFIX, ".scratch", ".pad", tmp_name, 255);
+ string_init_printf(scratch_name, ANY_PATH("%s.pad"), string_get_cstr(tmp_name));
string_clear(tmp_name);
do {
diff --git a/lib/toolbox/tar/tar_archive.c b/lib/toolbox/tar/tar_archive.c
index cc107530..5ac89a0f 100644
--- a/lib/toolbox/tar/tar_archive.c
+++ b/lib/toolbox/tar/tar_archive.c
@@ -165,12 +165,12 @@ bool tar_archive_file_finalize(TarArchive* archive) {
typedef struct {
TarArchive* archive;
const char* work_dir;
+ Storage_name_converter converter;
} TarArchiveDirectoryOpParams;
static int archive_extract_foreach_cb(mtar_t* tar, const mtar_header_t* header, void* param) {
TarArchiveDirectoryOpParams* op_params = param;
TarArchive* archive = op_params->archive;
- string_t fname;
bool skip_entry = false;
if(archive->unpack_cb) {
@@ -183,12 +183,14 @@ static int archive_extract_foreach_cb(mtar_t* tar, const mtar_header_t* header,
return 0;
}
+ string_t full_extracted_fname;
if(header->type == MTAR_TDIR) {
- string_init(fname);
- path_concat(op_params->work_dir, header->name, fname);
+ string_init(full_extracted_fname);
+ path_concat(op_params->work_dir, header->name, full_extracted_fname);
- bool create_res = storage_simply_mkdir(archive->storage, string_get_cstr(fname));
- string_clear(fname);
+ bool create_res =
+ storage_simply_mkdir(archive->storage, string_get_cstr(full_extracted_fname));
+ string_clear(full_extracted_fname);
return create_res ? 0 : -1;
}
@@ -197,8 +199,16 @@ static int archive_extract_foreach_cb(mtar_t* tar, const mtar_header_t* header,
return 0;
}
- string_init(fname);
- path_concat(op_params->work_dir, header->name, fname);
+ string_init(full_extracted_fname);
+
+ string_t converted_fname;
+ string_init_set(converted_fname, header->name);
+ if(op_params->converter) {
+ op_params->converter(converted_fname);
+ }
+ path_concat(op_params->work_dir, string_get_cstr(converted_fname), full_extracted_fname);
+ string_clear(converted_fname);
+
FURI_LOG_I(TAG, "Extracting %d bytes to '%s'", header->size, header->name);
File* out_file = storage_file_alloc(archive->storage);
uint8_t* readbuf = malloc(FILE_BLOCK_SIZE);
@@ -208,10 +218,17 @@ static int archive_extract_foreach_cb(mtar_t* tar, const mtar_header_t* header,
do {
while(n_tries-- > 0) {
if(storage_file_open(
- out_file, string_get_cstr(fname), FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
+ out_file,
+ string_get_cstr(full_extracted_fname),
+ FSAM_WRITE,
+ FSOM_CREATE_ALWAYS)) {
break;
}
- FURI_LOG_W(TAG, "Failed to open '%s', reties: %d", string_get_cstr(fname), n_tries);
+ FURI_LOG_W(
+ TAG,
+ "Failed to open '%s', reties: %d",
+ string_get_cstr(full_extracted_fname),
+ n_tries);
storage_file_close(out_file);
furi_delay_ms(FILE_OPEN_RETRY_DELAY);
}
@@ -232,15 +249,19 @@ static int archive_extract_foreach_cb(mtar_t* tar, const mtar_header_t* header,
storage_file_free(out_file);
free(readbuf);
- string_clear(fname);
+ string_clear(full_extracted_fname);
return failed ? -1 : 0;
}
-bool tar_archive_unpack_to(TarArchive* archive, const char* destination) {
+bool tar_archive_unpack_to(
+ TarArchive* archive,
+ const char* destination,
+ Storage_name_converter converter) {
furi_assert(archive);
TarArchiveDirectoryOpParams param = {
.archive = archive,
.work_dir = destination,
+ .converter = converter,
};
FURI_LOG_I(TAG, "Restoring '%s'", destination);
@@ -313,6 +334,7 @@ bool tar_archive_add_dir(TarArchive* archive, const char* fs_full_path, const ch
string_t element_name, element_fs_abs_path;
string_init(element_name);
string_init(element_fs_abs_path);
+
path_concat(fs_full_path, name, element_fs_abs_path);
if(strlen(path_prefix)) {
path_concat(path_prefix, name, element_name);
diff --git a/lib/toolbox/tar/tar_archive.h b/lib/toolbox/tar/tar_archive.h
index d9b0f321..88cb3dd4 100644
--- a/lib/toolbox/tar/tar_archive.h
+++ b/lib/toolbox/tar/tar_archive.h
@@ -2,6 +2,8 @@
#include <stdbool.h>
#include <stdint.h>
+#include <m-string.h>
+#include <storage/storage.h>
#ifdef __cplusplus
extern "C" {
@@ -24,7 +26,10 @@ bool tar_archive_open(TarArchive* archive, const char* path, TarOpenMode mode);
void tar_archive_free(TarArchive* archive);
/* High-level API - assumes archive is open */
-bool tar_archive_unpack_to(TarArchive* archive, const char* destination);
+bool tar_archive_unpack_to(
+ TarArchive* archive,
+ const char* destination,
+ Storage_name_converter converter);
bool tar_archive_add_file(
TarArchive* archive,
diff --git a/lib/update_util/lfs_backup.c b/lib/update_util/lfs_backup.c
index fa9141df..b7e7dd89 100644
--- a/lib/update_util/lfs_backup.c
+++ b/lib/update_util/lfs_backup.c
@@ -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;
}
diff --git a/lib/update_util/update_manifest.c b/lib/update_util/update_manifest.c
index d1ac0d7d..1b205d9c 100644
--- a/lib/update_util/update_manifest.c
+++ b/lib/update_util/update_manifest.c
@@ -157,14 +157,14 @@ bool update_manifest_has_obdata(UpdateManifest* update_manifest) {
}
bool update_manifest_init(UpdateManifest* update_manifest, const char* manifest_filename) {
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* flipper_file = flipper_format_file_alloc(storage);
if(flipper_format_file_open_existing(flipper_file, manifest_filename)) {
update_manifest_init_from_ff(update_manifest, flipper_file);
}
flipper_format_free(flipper_file);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return update_manifest->valid;
}
diff --git a/lib/update_util/update_manifest.h b/lib/update_util/update_manifest.h
index 2b0c9179..8f385947 100644
--- a/lib/update_util/update_manifest.h
+++ b/lib/update_util/update_manifest.h
@@ -9,8 +9,7 @@ extern "C" {
#include <m-string.h>
#include <furi_hal_flash.h>
-/* Paths don't include /ext -- because at startup SD card is mounted as root */
-#define UPDATE_DIR_DEFAULT_REL_PATH "/update"
+/* Paths don't include /ext -- because at startup SD card is mounted as FS root */
#define UPDATE_MANIFEST_DEFAULT_NAME "update.fuf"
#define UPDATE_MANIFEST_POINTER_FILE_NAME ".fupdate"
diff --git a/lib/update_util/update_operation.c b/lib/update_util/update_operation.c
index 9082d262..138828ff 100644
--- a/lib/update_util/update_operation.c
+++ b/lib/update_util/update_operation.c
@@ -9,9 +9,8 @@
#include <lib/toolbox/path.h>
#include <lib/toolbox/crc32_calc.h>
-#define UPDATE_ROOT_DIR "/ext" UPDATE_DIR_DEFAULT_REL_PATH
-#define UPDATE_PREFIX "/ext" UPDATE_DIR_DEFAULT_REL_PATH "/"
-#define UPDATE_SUFFIX "/" UPDATE_MANIFEST_DEFAULT_NAME
+#define UPDATE_ROOT_DIR EXT_PATH("update")
+
/* Need at least 4 free LFS pages before update */
#define UPDATE_MIN_INT_FREE_SPACE 4 * 4 * 1024
@@ -70,7 +69,7 @@ static bool update_operation_get_current_package_path_rtc(Storage* storage, stri
return found;
}
-#define UPDATE_FILE_POINTER_FN "/ext/" UPDATE_MANIFEST_POINTER_FILE_NAME
+#define UPDATE_FILE_POINTER_FN EXT_PATH(UPDATE_MANIFEST_POINTER_FILE_NAME)
#define UPDATE_MANIFEST_MAX_PATH_LEN 256u
bool update_operation_get_current_package_manifest_path(Storage* storage, string_t out_path) {
@@ -137,7 +136,7 @@ static bool update_operation_persist_manifest_path(Storage* storage, const char*
UpdatePrepareResult update_operation_prepare(const char* manifest_file_path) {
UpdatePrepareResult result = UpdatePrepareResultIntFull;
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
UpdateManifest* manifest = update_manifest_alloc();
File* file = storage_file_alloc(storage);
@@ -145,7 +144,8 @@ UpdatePrepareResult update_operation_prepare(const char* manifest_file_path) {
string_t stage_path;
string_init(stage_path);
do {
- if((storage_common_fs_info(storage, "/int", NULL, &free_int_space) != FSE_OK) ||
+ if((storage_common_fs_info(storage, STORAGE_INT_PATH_PREFIX, NULL, &free_int_space) !=
+ FSE_OK) ||
(free_int_space < UPDATE_MIN_INT_FREE_SPACE)) {
break;
}
@@ -197,7 +197,7 @@ UpdatePrepareResult update_operation_prepare(const char* manifest_file_path) {
storage_file_free(file);
update_manifest_free(manifest);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return result;
}
@@ -206,10 +206,10 @@ bool update_operation_is_armed() {
FuriHalRtcBootMode boot_mode = furi_hal_rtc_get_boot_mode();
const uint32_t rtc_upd_index =
furi_hal_rtc_get_register(FuriHalRtcRegisterUpdateFolderFSIndex);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
const bool upd_fn_ptr_exists =
(storage_common_stat(storage, UPDATE_FILE_POINTER_FN, NULL) == FSE_OK);
- furi_record_close("storage");
+ furi_record_close(RECORD_STORAGE);
return (boot_mode >= FuriHalRtcBootModePreUpdate) &&
(boot_mode <= FuriHalRtcBootModePostUpdate) &&
((rtc_upd_index != INT_MAX) || upd_fn_ptr_exists);
@@ -218,7 +218,7 @@ bool update_operation_is_armed() {
void update_operation_disarm() {
furi_hal_rtc_set_boot_mode(FuriHalRtcBootModeNormal);
furi_hal_rtc_set_register(FuriHalRtcRegisterUpdateFolderFSIndex, INT_MAX);
- Storage* storage = furi_record_open("storage");
+ Storage* storage = furi_record_open(RECORD_STORAGE);
storage_simply_remove(storage, UPDATE_FILE_POINTER_FN);
- furi_record_close("storage");
-} \ No newline at end of file
+ furi_record_close(RECORD_STORAGE);
+}
diff --git a/site_scons/site_tools/fbt_apps.py b/site_scons/site_tools/fbt_apps.py
index 1c2e0167..2ffdcae3 100644
--- a/site_scons/site_tools/fbt_apps.py
+++ b/site_scons/site_tools/fbt_apps.py
@@ -17,7 +17,7 @@ from fbt.appmanifest import (
def LoadApplicationManifests(env):
appmgr = env["APPMGR"] = AppManager()
- for entry in env.Glob("#/applications/*"):
+ for entry in env.Glob("#/applications/*", source=True):
if isinstance(entry, SCons.Node.FS.Dir) and not str(entry).startswith("."):
try:
appmgr.load_manifest(entry.File("application.fam").abspath, entry.name)