11#include "eeprom_directory.h"
22
3- static uint16_t * get_ids (eeprom_directory_t * directory , const uint8_t * key )
3+ static uint16_t * _get_ids (eeprom_directory_t * directory , const uint8_t * key )
44{
55 directory_key_map_t * key_map = directory -> key_map ;
66
@@ -13,7 +13,7 @@ static uint16_t *get_ids(eeprom_directory_t *directory, const uint8_t *key)
1313 return NULL ;
1414}
1515
16- static eeprom_status_t set_key (eeprom_directory_t * directory ,
16+ static eeprom_status_t _set_key (eeprom_directory_t * directory ,
1717 const uint8_t * key , uint16_t * ids )
1818{
1919 m24c32_t * device = directory -> device ;
@@ -33,7 +33,7 @@ static eeprom_status_t set_key(eeprom_directory_t *directory,
3333 return EEPROM_ERROR_ALLOCATION ;
3434}
3535
36- static eeprom_status_t delete_key (eeprom_directory_t * directory ,
36+ static eeprom_status_t _delete_key (eeprom_directory_t * directory ,
3737 const uint8_t * key )
3838{
3939 m24c32_t * device = directory -> device ;
@@ -61,11 +61,11 @@ eeprom_status_t directory_init(m24c32_t *device, eeprom_directory_t *directory)
6161
6262 directory -> device = device ;
6363 eeprom_status_t res ;
64- res = init_alloc_table (directory );
64+ res = _init_alloc_table (directory );
6565 if (res != EEPROM_OK ) {
6666 return res ;
6767 }
68- res = init_storage (directory );
68+ res = _init_storage (directory );
6969 if (res != EEPROM_OK ) {
7070 return res ;
7171 }
@@ -81,12 +81,12 @@ eeprom_status_t get_directory_value(eeprom_directory_t *directory,
8181 return EEPROM_ERROR_NULL_POINTER ;
8282 }
8383
84- uint16_t * ids = get_ids (directory , key );
84+ uint16_t * ids = _get_ids (directory , key );
8585 if (ids == NULL ) {
8686 return EEPROM_ERROR_NOT_FOUND ;
8787 }
8888
89- return get_data (directory , ids , out , out_size );
89+ return _get_data (directory , ids , out , out_size );
9090}
9191
9292eeprom_status_t set_directory_value (eeprom_directory_t * directory ,
@@ -100,7 +100,7 @@ eeprom_status_t set_directory_value(eeprom_directory_t *directory,
100100 return EEPROM_ERROR ;
101101 }
102102
103- uint16_t * existing_ids = get_ids (directory , key );
103+ uint16_t * existing_ids = _get_ids (directory , key );
104104
105105 // If key already exists, delete it first
106106 if (existing_ids != NULL ) {
@@ -122,11 +122,11 @@ eeprom_status_t set_directory_value(eeprom_directory_t *directory,
122122 }
123123
124124 for (int block_idx = 0 ; block_idx < block_count ; block_idx ++ ) {
125- uint16_t id = alloc_block (directory );
125+ uint16_t id = _alloc_block (directory );
126126 if (id == BLOCK_COUNT ) {
127127 // Free already allocated blocks on failure
128128 for (int j = 0 ; j < block_idx ; j ++ ) {
129- free_block (directory , & ids [j ], 1 );
129+ _free_block (directory , & ids [j ], 1 );
130130 }
131131 free (ids );
132132 return EEPROM_ERROR_ALLOCATION ;
@@ -138,19 +138,19 @@ eeprom_status_t set_directory_value(eeprom_directory_t *directory,
138138 }
139139
140140 eeprom_status_t res ;
141- res = set_key (directory , key , ids );
141+ res = _set_key (directory , key , ids );
142142 if (res != EEPROM_OK ) {
143143 // Free allocated blocks on failure
144- free_block (directory , ids , block_count );
144+ _free_block (directory , ids , block_count );
145145 free (ids );
146146 return res ;
147147 }
148148
149- res = put_data (directory , ids , value , value_size );
149+ res = _put_data (directory , ids , value , value_size );
150150 if (res != EEPROM_OK ) {
151151 // Free allocated blocks and remove key on failure
152- free_block (directory , ids , block_count );
153- delete_key (directory , key );
152+ _free_block (directory , ids , block_count );
153+ _delete_key (directory , key );
154154 free (ids );
155155 return res ;
156156 }
@@ -166,15 +166,15 @@ eeprom_status_t delete_directory_value(eeprom_directory_t *directory,
166166 return EEPROM_ERROR_NULL_POINTER ;
167167 }
168168
169- uint16_t * ids = get_ids (directory , key );
169+ uint16_t * ids = _get_ids (directory , key );
170170 if (ids == NULL ) {
171171 return EEPROM_ERROR_NOT_FOUND ;
172172 }
173173
174174 eeprom_status_t res ;
175- res = delete_data (directory , ids );
175+ res = _delete_data (directory , ids );
176176 if (res != EEPROM_OK ) {
177177 return res ;
178178 }
179- return delete_key (directory , key );
179+ return _delete_key (directory , key );
180180}
0 commit comments