Rtos API example
mbed Microcontroller Library Copyright (c) 2006-2016 ARM Limited More...
Go to the source code of this file.
Typedefs | |
typedef struct cfstore_area_header_t | cfstore_area_header_t |
Functions | |
static ARM_CFSTORE_SIZE | cfstore_ctx_get_kv_total_len (void) |
helper function to compute the total size of the KVs stored in the sram area in bytes. | |
static int32_t | cfstore_uvisor_is_client_kv_owner (char *key_name, int32_t *cfstore_uvisor_box_id) |
check that a client (cfstore-uvisor client box) is the "owner" of the KV. | |
static int32_t | cfstore_uvisor_security_context_prefix_check (const char *key_name) |
check that the cfstore client (caller, which is a uvisor box) is only trying to access its own namespace. | |
static int32_t | cfstore_flash_set_tail (void) |
Set the context tail pointer area_0_tail to point to the end of the last KV in the memory area. | |
static int32_t | cfstore_realloc_ex (ARM_CFSTORE_SIZE size, uint64_t *allocated_size) |
Function to realloc the SRAM area used to store KVs. | |
static int32_t | cfstore_fsm_format_on_entry (void *context) |
fsm handler when entering the formatting state | |
int32_t | cfstore_fsm_formatting (void *context) |
fsm handler when in formatting state | |
static int32_t | cfstore_file_update (uint8_t *head, int32_t size_diff) |
After a cfstore KV area memmove() operation, update the file pointers to reflect the new location in memory of KVs. | |
static bool | cfstore_file_is_valid (ARM_CFSTORE_HANDLE hkey, cfstore_ctx_t *ctx) |
check whether this is an valid buffer | |
static bool | cfstore_file_is_empty (ARM_CFSTORE_HANDLE hkey) |
check whether this is an empty buffer, or whether it has valid data | |
static CFSTORE_INLINE int32_t | cfstore_validate_len_ptr (ARM_CFSTORE_SIZE *len) |
check the key_len pointer is valid | |
static CFSTORE_INLINE int32_t | cfstore_validate_value_len (ARM_CFSTORE_SIZE value_len) |
check the value length field is valid | |
static int32_t | cfstore_find_ex (const char *key_name_query, cfstore_area_hkvt_t *prev, cfstore_area_hkvt_t *next) |
Internal find function using hkvt's. |
Detailed Description
mbed Microcontroller Library Copyright (c) 2006-2016 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file configuration_store.c.
Typedef Documentation
typedef struct cfstore_area_header_t cfstore_area_header_t |
- Parameters:
-
key_permissions bottom 6 bits contain the ACLs-bits (owner read/write/execute, other read/write/execute). The remaining bits in this field are used for the Device Data Security Protection Features bit field, bits are low-active perm_owner_read if set => this KV is owner readable perm_owner_write if set => this KV is owner writable perm_owner_execute if set => this KV is owner executable perm_other_read if set => this KV is world readable perm_other_write if set => this KV is world writable perm_other_execute if set => this KV is world executable klength key name size including zero-padding vlength this value fragment length refcount Number of handles open on this hkvt delete indicates this KV is being deleted
Function Documentation
static ARM_CFSTORE_SIZE cfstore_ctx_get_kv_total_len | ( | void | ) | [static] |
helper function to compute the total size of the KVs stored in the sram area in bytes.
Note:
- sram_area_size = cfstore_ctx_get_kv_total_len() + padding
- padding rounds up cfstore_ctx_get_kv_total_len() to be a multiple of flash program_unit size.
Definition at line 619 of file configuration_store.c.
static bool cfstore_file_is_empty | ( | ARM_CFSTORE_HANDLE | hkey ) | [static] |
check whether this is an empty buffer, or whether it has valid data
- Parameters:
-
hkey IN: The key handle to be validated
ctx IN: cfstore context block
Definition at line 2508 of file configuration_store.c.
static bool cfstore_file_is_valid | ( | ARM_CFSTORE_HANDLE | hkey, |
cfstore_ctx_t * | ctx | ||
) | [static] |
check whether this is an valid buffer
- Parameters:
-
hkey IN: The key handle to be validated
ctx IN: cfstore context block
Definition at line 2485 of file configuration_store.c.
static int32_t cfstore_file_update | ( | uint8_t * | head, |
int32_t | size_diff | ||
) | [static] |
After a cfstore KV area memmove() operation, update the file pointers to reflect the new location in memory of KVs.
- Parameters:
-
head the position at which size_diff bytes have been inserted/deleted size_diff Change in size (size difference) of the KV memory area. - size_diff > 0 => increase in area, |size_diff| bytes have been inserted at head, and the previously following KVs shifted up to higher memory addresses
- size_diff < 0 => decrease in area, |size_diff| bytes have been removed at head, and the previously following KVs shifted down to lower memory addresses
Definition at line 2342 of file configuration_store.c.
static int32_t cfstore_find_ex | ( | const char * | key_name_query, |
cfstore_area_hkvt_t * | prev, | ||
cfstore_area_hkvt_t * | next | ||
) | [static] |
Internal find function using hkvt's.
- Note:
- Not the following:
- Any required locks should be taken before this function is called. This function does not affect refcount for underlying KVs.
- The function assumes the arguments have been validated before calling this function
- No acl policy is enforced by the function.
- Returns:
- return_value On success (finding a KV matching the query) ARM_DRIVER_OK is returned. If a KV is not found matching the description then ARM_CFSTORE_DRIVER_ERROR_KEY_NOT_FOUND is returned.
Definition at line 3139 of file configuration_store.c.
static int32_t cfstore_flash_set_tail | ( | void | ) | [static] |
Set the context tail pointer area_0_tail to point to the end of the last KV in the memory area.
This function walks hkvt entries in the KV area to find the memory address after the end of the last KV, and then sets the area tail pointer area_0_tail to that address. The function therefore relies on the head, key, value, tail fields being correct.
Notes:
- This function should only be called after the memory area is loaded from flash and the area_0_tail pointer needs setting. The only way to do this (at the present time) is to walk the list of KVs, which is what this function does. The only other place the code sets area_0_tail is cfstore_realloc_ex(), and this state of affairs shouldnt change i.e. its unnecessary for other functions to change area_0_tail.
- When loading the area_0 image from falsh, cfstore_realloc_ex() is used to allocate the memory with ctx->expected_blob_size as the size. Thus area_0_tail will be initially set to area_0_tail = area_0_head + expected_blob_size (1) and thereby may include padding used to align the area size to a flash program unit boundary. cfstore_flash_set_tail() is used to set area_0_tail correctly.
Definition at line 1344 of file configuration_store.c.
static int32_t cfstore_fsm_format_on_entry | ( | void * | context ) | [static] |
fsm handler when entering the formatting state
Definition at line 2043 of file configuration_store.c.
int32_t cfstore_fsm_formatting | ( | void * | context ) |
fsm handler when in formatting state
Definition at line 2065 of file configuration_store.c.
static int32_t cfstore_realloc_ex | ( | ARM_CFSTORE_SIZE | size, |
uint64_t * | allocated_size | ||
) | [static] |
Function to realloc the SRAM area used to store KVs.
This function consolidates the code needed to:
- realloc the memory
- when the start of the SRAM area moves, update data structures which point into SRAM area (e.g. open files cfstore_file_t head pointers).
The function assumes:
- the cfstore_file_t::head pointers are valid i.e. point to the correct locations in the KV area for each file.
- Parameters:
-
size total KV size in bytes storage required. Note this does not include padding to round up to the nearest multiple of flash program unit as this is computed and added in this function. allocated_size total size in bytes that was allocated (value returned to caller). This may be larger than the requested size due to rounding to align with a flash program unit boundary.
Definition at line 1410 of file configuration_store.c.
static int32_t cfstore_uvisor_is_client_kv_owner | ( | char * | key_name, |
int32_t * | cfstore_uvisor_box_id | ||
) | [static] |
check that a client (cfstore-uvisor client box) is the "owner" of the KV.
Owner means the client that can create or created the KV. This is determined by the clients namespace and whether the KV path name falls within that name space
- Parameters:
-
key_name the name of the KV being created. the validation that the key_name is composed of permissible chars is carried out before this function is called.
- Note:
- Conceptually, cfstore supports the following KV path namespaces:
- com.arm.mbed.
- guids of the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx where x is a hex digit.
In the cfstore implementation, explicit checking of the structure of the namespace string is not required. Cfstore only need enforce that: the root of the KV pathname == cfstore client uvisor namespace.
Definition at line 858 of file configuration_store.c.
static int32_t cfstore_uvisor_security_context_prefix_check | ( | const char * | key_name ) | [static] |
check that the cfstore client (caller, which is a uvisor box) is only trying to access its own namespace.
- Note:
- This function is the cfstore equivalent of "is_calling_box_allowed"
Definition at line 911 of file configuration_store.c.
static CFSTORE_INLINE int32_t cfstore_validate_len_ptr | ( | ARM_CFSTORE_SIZE * | len ) | [static] |
check the key_len pointer is valid
- Parameters:
-
hkey IN: The key handle to be validated
Definition at line 2671 of file configuration_store.c.
static CFSTORE_INLINE int32_t cfstore_validate_value_len | ( | ARM_CFSTORE_SIZE | value_len ) | [static] |
check the value length field is valid
- Parameters:
-
key_name IN: The key name string to be validated
- Note:
- This will be replaced with the actual uvisor call, when available.
Definition at line 2795 of file configuration_store.c.
Generated on Sun Jul 17 2022 08:25:34 by 1.7.2