1 #include "file_pager.h" 2 #include "mapped_file_object_server.h" 3 4 /* Initialise a pager for a file with a unique file identifier and shared page 5 mapper for moderating access to loaded pages. */ 6 7 FilePager::FilePager(fileid_t fileid, PageMapper *mapper) 8 : Pager(mapper), fileid(fileid) 9 { 10 } 11 12 int FilePager::expected_items() 13 { 14 return MappedFileObject_expected_items; 15 } 16 17 ipc_server_handler_type FilePager::handler() 18 { 19 return (ipc_server_handler_type) handle_MappedFileObject; 20 } 21 22 long FilePager::mmap(size_t position, size_t length, size_t *start_pos, size_t *end_pos, size_t *data_end) 23 { 24 /* Set the limits of the paged region. */ 25 26 Pager::mmap(position, length, start_pos, end_pos, data_end); 27 28 /* Obtain the amount of the region that is populated with file data. */ 29 30 *data_end = get_data_size() - _start; 31 32 if (*data_end > _size) 33 *data_end = _size; 34 35 return L4_EOK; 36 } 37 38 long FilePager::map(unsigned long offset, l4_addr_t hot_spot, unsigned long flags, l4_snd_fpage_t *region) 39 { 40 return Pager::map(offset, hot_spot, flags, region); 41 } 42 43 // vim: tabstop=4 expandtab shiftwidth=4