From 3abbc617576232ca9696f69100c3b32eea274e54 Mon Sep 17 00:00:00 2001 From: H1ghBre4k3r Date: Mon, 3 May 2021 23:52:56 +0200 Subject: [PATCH] Storage: Add 3 byte for metadata to record_t and use it in initialization for ens_fs --- src/ens/storage.c | 3 +-- src/ens/storage.h | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ens/storage.c b/src/ens/storage.c index 8a6de50..698a2ba 100644 --- a/src/ens/storage.c +++ b/src/ens/storage.c @@ -109,8 +109,7 @@ int init_record_storage(void) { printk("Currently %d contacts stored!\n", record_information.count); printk("Space available: %d\n", FLASH_AREA_SIZE(storage)); - // TODO lome: change size to sizeof(contact_struct) - rc = ens_fs_init(&ens_fs, FLASH_AREA_ID(ens_storage), 32); + rc = ens_fs_init(&ens_fs, FLASH_AREA_ID(ens_storage), sizeof(record_t)); if (rc) { printk("Cannot init ens_fs (err %d)\n", rc); } diff --git a/src/ens/storage.h b/src/ens/storage.h index 28234ee..ecce8a8 100644 --- a/src/ens/storage.h +++ b/src/ens/storage.h @@ -14,6 +14,10 @@ typedef struct record { rssi_t rssi; // TODO: Check correct rolling_proximity_identifier_t rolling_proximity_identifier; associated_encrypted_metadata_t associated_encrypted_metadata; + /** + * Filler space, used for storing up to 3 byte of metadata in the filesystem. + */ + uint8_t meta[3]; } record_t; typedef struct stored_records_information {