Skip to content

Commit 4efe890

Browse files
committed
Changed return of virtual fat create_file function
1 parent cafe886 commit 4efe890

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

klib/filesystem/virtual_fat.hpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ namespace klib::filesystem {
751751
}
752752
}
753753
else {
754-
// check if we have a read function registered
754+
// check if we have a write function registered
755755
if (virtual_media[i].write) {
756756
virtual_media[i].write(media_offset, &data[data_offset], count);
757757
}
@@ -862,12 +862,13 @@ namespace klib::filesystem {
862862
* @param size
863863
* @param read
864864
* @param write
865+
* @return status
865866
*/
866-
static void create_file(const char* file_name, const uint32_t size, const read_callback read = nullptr, const write_callback write = nullptr) {
867+
static bool create_file(const char* file_name, const uint32_t size, const read_callback read = nullptr, const write_callback write = nullptr) {
867868
// make sure we can create a file
868869
if ((directory_index + 1) >= (sizeof(virtual_media) / sizeof(virtual_media[0]))) {
869870
// we cannot create more files
870-
return;
871+
return false;
871872
}
872873

873874
const uint32_t clusters = (
@@ -882,7 +883,7 @@ namespace klib::filesystem {
882883
// check if we have enough clusters to allocate for the file
883884
if ((cluster_index + clusters) > ((sizeof(fat) * 8) / cluster::bits)) {
884885
// we do not have enough clusters for the file exit
885-
return;
886+
return false;
886887
}
887888

888889
// set the clusters in use
@@ -939,6 +940,8 @@ namespace klib::filesystem {
939940

940941
// increment the amount of files we have
941942
directory_index++;
943+
944+
return true;
942945
}
943946

944947
/**

0 commit comments

Comments
 (0)