1.1 --- a/accessor.cc Thu Mar 18 00:59:55 2021 +0100
1.2 +++ b/accessor.cc Fri Mar 19 00:28:31 2021 +0100
1.3 @@ -1,5 +1,9 @@
1.4 #include "accessor.h"
1.5
1.6 +#include <string.h>
1.7 +
1.8 +
1.9 +
1.10 Accessor::Accessor(fileid_t fileid, offset_t size)
1.11 : _size(size), fileid(fileid)
1.12 {
1.13 @@ -31,4 +35,37 @@
1.14 {
1.15 }
1.16
1.17 +/* Data transfer methods. */
1.18 +
1.19 +void Accessor::fill(Flexpage *flexpage)
1.20 +{
1.21 + /* Filling completely beyond the end of file should produce an empty
1.22 + flexpage. This could potentially be a shared read-only flexpage that
1.23 + would be replaced by an independent writable flexpage if ever written. */
1.24 +
1.25 + if (flexpage->base_offset < _size)
1.26 + fill_populated(flexpage);
1.27 + else
1.28 + memset((void *) flexpage->base_addr, 0, flexpage->size);
1.29 +}
1.30 +
1.31 +void Accessor::flush(Flexpage *flexpage)
1.32 +{
1.33 + /* Flushing completely beyond the end of file should discard the
1.34 + flexpage. */
1.35 +
1.36 + if (flexpage->base_offset < _size)
1.37 + flush_populated(flexpage);
1.38 +}
1.39 +
1.40 +/* Data transfer helper methods. */
1.41 +
1.42 +void Accessor::fill_populated(Flexpage *flexpage)
1.43 +{
1.44 +}
1.45 +
1.46 +void Accessor::flush_populated(Flexpage *flexpage)
1.47 +{
1.48 +}
1.49 +
1.50 // vim: tabstop=4 expandtab shiftwidth=4