|
TF-M Reference Manual
1.2.0
TrustedFirmware-M
|
Internal Trusted Storage service filesystem abstraction APIs. The purpose of this abstraction is to have the ability to plug-in other filesystems or filesystem proxies (supplicant). More...
#include <stddef.h>#include <stdint.h>#include "its_flash_fs_mblock.h"#include "psa/error.h"#include "flash/its_flash.h"

Go to the source code of this file.
Data Structures | |
| struct | its_file_info_t |
| Structure to store the file information. More... | |
Macros | |
| #define | ITS_FLASH_FS_USER_FLAGS_MASK ((1U << 16) - 1) |
| #define | ITS_FLASH_FS_WRITE_FLAGS_MASK ((1U << 24) - (1U << 16)) |
| #define | ITS_FLASH_FS_FLAG_CREATE (1U << 16) |
| #define | ITS_FLASH_FS_FLAG_TRUNCATE (1U << 17) |
Typedefs | |
| typedef struct its_flash_fs_ctx_t | its_flash_fs_ctx_t |
| ITS flash filesystem context type, used to maintain state across FS operations. More... | |
Functions | |
| psa_status_t | its_flash_fs_prepare (its_flash_fs_ctx_t *fs_ctx, const struct its_flash_info_t *flash_info) |
| Prepares the filesystem to accept operations on the files. More... | |
| psa_status_t | its_flash_fs_wipe_all (its_flash_fs_ctx_t *fs_ctx) |
| Wipes all files from the filesystem. More... | |
| psa_status_t | its_flash_fs_file_exist (its_flash_fs_ctx_t *fs_ctx, const uint8_t *fid) |
| Checks if a file exists in the filesystem. More... | |
| psa_status_t | its_flash_fs_file_get_info (its_flash_fs_ctx_t *fs_ctx, const uint8_t *fid, struct its_file_info_t *info) |
| Gets the file information referenced by the file ID. More... | |
| psa_status_t | its_flash_fs_file_write (its_flash_fs_ctx_t *fs_ctx, const uint8_t *fid, uint32_t flags, size_t max_size, size_t data_size, size_t offset, const uint8_t *data) |
| Writes data to a file. More... | |
| psa_status_t | its_flash_fs_file_read (its_flash_fs_ctx_t *fs_ctx, const uint8_t *fid, size_t size, size_t offset, uint8_t *data) |
| Reads data from an existing file. More... | |
| psa_status_t | its_flash_fs_file_delete (its_flash_fs_ctx_t *fs_ctx, const uint8_t *fid) |
| Deletes file referenced by the file ID. More... | |
| psa_status_t | its_flash_fs_validate_params (const struct its_flash_info_t *info) |
| Validates the configuration of the flash filesystem. More... | |
Internal Trusted Storage service filesystem abstraction APIs. The purpose of this abstraction is to have the ability to plug-in other filesystems or filesystem proxies (supplicant).
Definition in file its_flash_fs.h.
| #define ITS_FLASH_FS_FLAG_CREATE (1U << 16) |
Definition at line 39 of file its_flash_fs.h.
| #define ITS_FLASH_FS_FLAG_TRUNCATE (1U << 17) |
Definition at line 41 of file its_flash_fs.h.
| #define ITS_FLASH_FS_USER_FLAGS_MASK ((1U << 16) - 1) |
Definition at line 34 of file its_flash_fs.h.
| #define ITS_FLASH_FS_WRITE_FLAGS_MASK ((1U << 24) - (1U << 16)) |
Definition at line 37 of file its_flash_fs.h.
| typedef struct its_flash_fs_ctx_t its_flash_fs_ctx_t |
ITS flash filesystem context type, used to maintain state across FS operations.
The user should allocate a variable of this type, initialised to zero, before calling its_flash_fs_prepare, and then pass it to each subsequent FS operation. The contents are internal to the filesystem.
Definition at line 52 of file its_flash_fs.h.
| psa_status_t its_flash_fs_file_delete | ( | its_flash_fs_ctx_t * | fs_ctx, |
| const uint8_t * | fid | ||
| ) |
Deletes file referenced by the file ID.
| [in,out] | fs_ctx | Filesystem context |
| [in] | fid | File ID |
Definition at line 454 of file its_flash_fs.c.


| psa_status_t its_flash_fs_file_exist | ( | its_flash_fs_ctx_t * | fs_ctx, |
| const uint8_t * | fid | ||
| ) |
Checks if a file exists in the filesystem.
| [in,out] | fs_ctx | Filesystem context |
| [in] | fid | File ID |
Definition at line 98 of file its_flash_fs.c.

| psa_status_t its_flash_fs_file_get_info | ( | its_flash_fs_ctx_t * | fs_ctx, |
| const uint8_t * | fid, | ||
| struct its_file_info_t * | info | ||
| ) |
Gets the file information referenced by the file ID.
| [in,out] | fs_ctx | Filesystem context |
| [in] | fid | File ID |
| [out] | info | Pointer to the information structure to store the file information values its_file_info_t |
Definition at line 112 of file its_flash_fs.c.


| psa_status_t its_flash_fs_file_read | ( | its_flash_fs_ctx_t * | fs_ctx, |
| const uint8_t * | fid, | ||
| size_t | size, | ||
| size_t | offset, | ||
| uint8_t * | data | ||
| ) |
Reads data from an existing file.
| [in,out] | fs_ctx | Filesystem context |
| [in] | fid | File ID |
| [in] | size | Size to be read |
| [in] | offset | Offset in the file |
| [out] | data | Pointer to buffer to store the data |
Definition at line 469 of file its_flash_fs.c.


| psa_status_t its_flash_fs_file_write | ( | its_flash_fs_ctx_t * | fs_ctx, |
| const uint8_t * | fid, | ||
| uint32_t | flags, | ||
| size_t | max_size, | ||
| size_t | data_size, | ||
| size_t | offset, | ||
| const uint8_t * | data | ||
| ) |
Writes data to a file.
| [in,out] | fs_ctx | Filesystem context |
| [in] | fid | File ID |
| [in] | flags | Flags of the file |
| [in] | max_size | Maximum size of the file to be created. Ignored if the file is not being created. |
| [in] | data_size | Size of the incoming write data. |
| [in] | offset | Offset in the file to write. Must be less than or equal to the current file size. |
| [in] | data | Pointer to buffer containing data to be written |
Definition at line 144 of file its_flash_fs.c.


| psa_status_t its_flash_fs_prepare | ( | its_flash_fs_ctx_t * | fs_ctx, |
| const struct its_flash_info_t * | flash_info | ||
| ) |
Prepares the filesystem to accept operations on the files.
| [in,out] | fs_ctx | Filesystem context to prepare. Must have been initialised by the caller. |
| [in] | flash_info | Struct containing information about the flash device to associate with the context. |
Definition at line 58 of file its_flash_fs.c.


| psa_status_t its_flash_fs_validate_params | ( | const struct its_flash_info_t * | info | ) |
Validates the configuration of the flash filesystem.
This function checks that the flash block provided is compatible with the flash_fs described by the info parameter
| [in] | info | Filesystem information |
Definition at line 541 of file its_flash_fs.c.

| psa_status_t its_flash_fs_wipe_all | ( | its_flash_fs_ctx_t * | fs_ctx | ) |
Wipes all files from the filesystem.
| [in,out] | fs_ctx | Filesystem context to wipe. Must be prepared again before further use. |
Definition at line 92 of file its_flash_fs.c.

