[FL-2675] /int space reservation (#1448)
* storage: added global #defines for /int, /ext & /any * storage: introduced PATH_EXT, PATH_INT& PATH_ANY macros * core apps: moved hardcoded config files names to separate headers; prefixed them with "."; updater: added file name migration to new naming convention on backup extraction * storage: fixed storage_merge_recursive handling of complex directory structures; storage_move_to_sd: changed data migration logic to all non-dot files & all folders * core: added macro aliases for core record names * Bumped protobuf commit pointer * storage: reserved 5 pages in /int; denying write&creation of non-dot files when running out of free space Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -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 {
|
||||
|
@@ -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);
|
||||
|
@@ -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)
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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"
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user