paul@8 | 1 | #pragma once |
paul@8 | 2 | |
paul@9 | 3 | #include "mapped_file_object_interface.h" |
paul@8 | 4 | #include "pager.h" |
paul@81 | 5 | #include "file_paging.h" |
paul@8 | 6 | |
paul@8 | 7 | /* A pager abstraction for a file. */ |
paul@8 | 8 | |
paul@9 | 9 | class FilePager : public Pager, public MappedFileObject |
paul@8 | 10 | { |
paul@79 | 11 | protected: |
paul@81 | 12 | FilePaging *_paging; |
paul@79 | 13 | |
paul@8 | 14 | public: |
paul@8 | 15 | fileid_t fileid; |
paul@8 | 16 | |
paul@79 | 17 | explicit FilePager(fileid_t fileid, PageMapper *mapper, flags_t flags, |
paul@81 | 18 | FilePaging *paging); |
paul@79 | 19 | |
paul@79 | 20 | virtual void close(); |
paul@8 | 21 | |
paul@10 | 22 | /* Server details. */ |
paul@10 | 23 | |
paul@10 | 24 | int expected_items(); |
paul@10 | 25 | |
paul@10 | 26 | ipc_server_handler_type handler(); |
paul@10 | 27 | |
paul@10 | 28 | void *interface() |
paul@10 | 29 | { return static_cast<MappedFileObject *>(this); } |
paul@10 | 30 | |
paul@53 | 31 | /* File methods. */ |
paul@53 | 32 | |
paul@53 | 33 | virtual long flush(offset_t populated_size, offset_t *size); |
paul@53 | 34 | |
paul@55 | 35 | virtual long resize(offset_t *size); |
paul@55 | 36 | |
paul@10 | 37 | /* Pager and mapped file methods. */ |
paul@10 | 38 | |
paul@92 | 39 | virtual long map(offset_t offset, address_t hot_spot, flags_t flags, |
paul@90 | 40 | l4_snd_fpage_t *region); |
paul@9 | 41 | |
paul@90 | 42 | virtual long mmap(offset_t position, offset_t length, offset_t *start_pos, |
paul@90 | 43 | offset_t *end_pos, offset_t *size); |
paul@8 | 44 | }; |
paul@8 | 45 | |
paul@8 | 46 | // vim: tabstop=4 expandtab shiftwidth=4 |