Skip to content

Commit

Permalink
fixed issue with fs stat call
Browse files Browse the repository at this point in the history
  • Loading branch information
rundb committed Nov 5, 2023
1 parent bd64e2a commit 1946d2f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions firmware/src/lib/myfs/myfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ int myfs_mount(myfs_t *myfs, const myfs_config *config)
// TODO: check if previous write has been completed.
if (is_first_descriptor_processed)
{
NRF_LOG_INFO("prev d 0x%x %d", prev_d.start_address, prev_d.file_size);
NRF_LOG_DEBUG("prev d 0x%x %d", prev_d.start_address, prev_d.file_size);
const auto next_file_start_address = prev_d.start_address + ((prev_d.file_size / page_size) + 1) * page_size; // todo: pad it to the %256==0
myfs->files_count = ((current_descriptor_address - (myfs->fs_start_address))) / single_file_descriptor_size_bytes - 1;
// TODO: it is set off by 1 or 2, check it at the first round of tests
Expand Down Expand Up @@ -489,7 +489,7 @@ int myfs_file_get_size(myfs_t& myfs, const myfs_config& config, uint8_t * file_i
return -1;
}

int myfs_get_fs_stat(myfs_t& myfs, const myfs_config& config, uint32_t& files_count, uint32_t occupied_space)
int myfs_get_fs_stat(myfs_t& myfs, const myfs_config& config, uint32_t& files_count, uint32_t& occupied_space)
{
if (!myfs.is_mounted)
{
Expand Down Expand Up @@ -521,6 +521,7 @@ int myfs_get_fs_stat(myfs_t& myfs, const myfs_config& config, uint32_t& files_co
{
NRF_LOG_WARNING("get fs stat: discovered an not-closed file, might need a repair");
}
current_descriptor_address += single_file_descriptor_size_bytes;
}
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion firmware/src/lib/myfs/myfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,5 @@ int myfs_rewind_dir(myfs_t& myfs);
int myfs_get_next_id(myfs_t& myfs, const myfs_config& config, uint8_t * file_id);

// "stat"-related call
int myfs_get_fs_stat(myfs_t& myfs, const myfs_config& config, uint32_t& files_count, uint32_t occupied_space);
int myfs_get_fs_stat(myfs_t& myfs, const myfs_config& config, uint32_t& files_count, uint32_t& occupied_space);
}
2 changes: 1 addition & 1 deletion firmware/src/targets/dictofun/config/sdk_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -7838,7 +7838,7 @@
// <4=> Debug

#ifndef NRF_LOG_DEFAULT_LEVEL
#define NRF_LOG_DEFAULT_LEVEL 4
#define NRF_LOG_DEFAULT_LEVEL 3
#endif

// <q> NRF_LOG_DEFERRED - Enable deffered logger.
Expand Down

0 comments on commit 1946d2f

Please sign in to comment.