-
Notifications
You must be signed in to change notification settings - Fork 1
Kvstore integration #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
212c12d to
7c044ff
Compare
|
|
||
| int ret = MBED_SUCCESS; | ||
| char *token = NULL; | ||
| char *str = strdup(full_name); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
|
@dannybenor , @theamirocohen , @davidsaada , @yossi2le - Added few CR remarks on kv_map and kvstore_global_api |
7c044ff to
09f36f3
Compare
09f36f3 to
fdbebac
Compare
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.
Remove _thread suffix and rename threads.
Simplify the document. More information is provided on our documentation portal, link it here
If read timeout happens, the _deselect will get called twice causing a hard fault happening when mutex is released without being locked. The SDBlockDevice::read is calling the _deselect in every case.
Remove unnecessary commas, and standardize heading capitalization.
Remove unnecessary comma.
Place holder for kvstore integration. Please ignore for the time.