1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/file_pager.cc Sun Jan 24 01:29:41 2021 +0100
1.3 @@ -0,0 +1,27 @@
1.4 +#include "file_pager.h"
1.5 +
1.6 +/* Initialise a pager for a file with a unique file identifier and shared page
1.7 + mapper for moderating access to loaded pages. */
1.8 +
1.9 +FilePager::FilePager(fileid_t fileid, PageMapper *mapper)
1.10 +: Pager(mapper), fileid(fileid)
1.11 +{
1.12 +}
1.13 +
1.14 +long FilePager::mmap(size_t position, size_t length, size_t *start_pos, size_t *end_pos, size_t *data_end)
1.15 +{
1.16 + /* Set the limits of the paged region. */
1.17 +
1.18 + Pager::mmap(position, length, start_pos, end_pos, data_end);
1.19 +
1.20 + /* Obtain the amount of the region that is populated with file data. */
1.21 +
1.22 + *data_end = get_data_size() - _start;
1.23 +
1.24 + if (*data_end > _size)
1.25 + *data_end = _size;
1.26 +
1.27 + return L4_EOK;
1.28 +}
1.29 +
1.30 +// vim: tabstop=4 expandtab shiftwidth=4