Skip to content

Conversation

@davidsaada
Copy link
Owner

Place holder for kvstore integration. Please ignore for the time.


int ret = MBED_SUCCESS;
char *token = NULL;
char *str = strdup(full_name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARM compiler does not know strdup ... tried every possible include and it didnt work...

if (strcmp(token,full_name) == 0) {
//use default partition if path is empty
*kv_instance = kv_map_table[0].kvstore_instance;
strcpy(key, full_name);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using bounded copy to prevent buffer overflow with accidental/intentional non null terminated input


KVStore *kv_instance = NULL;
char key[KV_MAX_KEY_LENGTH];
kv_lookup(full_name_key, &kv_instance, key);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ITEM_NOT_FOUND not handled, also in other places later on..

ret = kv_instance->iterator_open(inner_it, key);
if (MBED_SUCCESS != ret) {
delete inner_it;
return ret;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*it was not deleted, and I think it wont be deleted in kv_iterator_close() because iterator_is_open = false

free(kv_map_table[i].partition_name);
kv_map_table[i].kvstore_instance->deinit();

memcpy(&kv_map_table[i], &kv_map_table[i + 1], sizeof(kv_map_entry_t) * (MAX_ATTACHED_KVS - i - 1));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd consider a faster implementation without memcpy using a fixed size table, marking empty spaces with NULL partition name (as your already do) - the search is potentially slower, but you save much more on memcpy

for (int i = 0; i < kv_num_attached_kvs; i++ ) {

if (kv_map_table[i].kvstore_instance == NULL) {
goto exit;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to set kv_num_attached_kvs = 0; here?

@offirko
Copy link
Collaborator

offirko commented Nov 5, 2018

@dannybenor , @theamirocohen , @davidsaada , @yossi2le - Added few CR remarks on kv_map and kvstore_global_api

SenRamakri and others added 19 commits November 7, 2018 16:15
Make minor copy edits for active voice, branding and deletion of extra spaces.
Currently the following commands in examples.py,
do_import()
do_deploy()
do_versionning()
do_clone()

all return a success status (ie 0) irrespective of any errors
originating from their sub-functions.

This PR fixes this. Now these commands will return one of:
0 - success
1 - general failure
x - failure returned by a subprocess.call function
subprocess.call() does not by default return a status value.

Update the commands to add shell=True which forces a return value.
Also convert the commands to a single string rather than a list as
this plays more nicely with both linux and windows.

Also fix a spurious :
Transport is a member of TLSSocket which is derived from TLSSocketWrapper.
Make sure that TLSSocketWrapper::close() is called before the transport is
destroyed.
TCP and UDP sockets are automatically available when mbed.h is
included in an application.

This change lets the TLSSocket be used in the same way.
@davidsaada davidsaada closed this Nov 7, 2018
davidsaada pushed a commit that referenced this pull request Dec 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.