1.1 --- a/files/host_file_accessor.cc Thu Mar 18 00:59:55 2021 +0100
1.2 +++ b/files/host_file_accessor.cc Fri Mar 19 00:28:31 2021 +0100
1.3 @@ -32,13 +32,14 @@
1.4 _fp = fopen(_path, "r");
1.5 }
1.6
1.7 -/* Data transfer methods. */
1.8 +/* Data transfer helper methods. */
1.9
1.10 -void HostFileAccessor::fill(Flexpage *flexpage)
1.11 +void HostFileAccessor::fill_populated(Flexpage *flexpage)
1.12 {
1.13 - /* Obtain the offset and seek in the file. */
1.14 + offset_t filepos = flexpage->base_offset;
1.15 + offset_t addr = flexpage->base_addr;
1.16
1.17 - offset_t filepos = flexpage->base_offset;
1.18 + /* Seek to the offset in the file. */
1.19
1.20 fseek(_fp, filepos, SEEK_SET);
1.21
1.22 @@ -48,8 +49,6 @@
1.23
1.24 /* Fill the region with file content. */
1.25
1.26 - offset_t addr = flexpage->base_addr;
1.27 -
1.28 size_t nread = fread((void *) addr, sizeof(char), flexpage->size, _fp);
1.29
1.30 /* Pad the flexpage with zero. */
1.31 @@ -57,11 +56,8 @@
1.32 memset((void *) (addr + nread), 0, flexpage->size - nread);
1.33 }
1.34
1.35 -void HostFileAccessor::flush(Flexpage *flexpage)
1.36 +void HostFileAccessor::flush_populated(Flexpage *flexpage)
1.37 {
1.38 - /* NOTE: A real flush operation would store the memory content and update
1.39 - the file size, if appropriate. */
1.40 -
1.41 flexpage->region->flush();
1.42 }
1.43