paul@65 | 1 | #pragma once |
paul@65 | 2 | |
paul@65 | 3 | #include "pipe_accessor.h" |
paul@65 | 4 | #include "pipe_object_interface.h" |
paul@65 | 5 | #include "pipe_paging.h" |
paul@65 | 6 | #include "pager.h" |
paul@65 | 7 | |
paul@65 | 8 | /* A pager abstraction for a pipe. */ |
paul@65 | 9 | |
paul@65 | 10 | class PipePager : public Pager, public PipeObject |
paul@65 | 11 | { |
paul@65 | 12 | protected: |
paul@65 | 13 | PipePaging *_paging; |
paul@66 | 14 | bool _writing; |
paul@65 | 15 | |
paul@65 | 16 | /* Helper methods. */ |
paul@65 | 17 | |
paul@65 | 18 | virtual long next_region_for_reader(offset_t *populated_size, offset_t *size); |
paul@65 | 19 | |
paul@65 | 20 | virtual long next_region_for_writer(offset_t *populated_size, offset_t *size); |
paul@65 | 21 | |
paul@65 | 22 | public: |
paul@66 | 23 | explicit PipePager(PipePaging *paging, bool writer); |
paul@65 | 24 | |
paul@67 | 25 | virtual void close(); |
paul@67 | 26 | |
paul@65 | 27 | /* Server details. */ |
paul@65 | 28 | |
paul@65 | 29 | int expected_items(); |
paul@65 | 30 | |
paul@65 | 31 | ipc_server_handler_type handler(); |
paul@65 | 32 | |
paul@65 | 33 | void *interface() |
paul@65 | 34 | { return static_cast<PipeObject *>(this); } |
paul@65 | 35 | |
paul@65 | 36 | /* Pager methods. */ |
paul@65 | 37 | |
paul@92 | 38 | virtual long map(offset_t offset, address_t hot_spot, flags_t flags, l4_snd_fpage_t *region); |
paul@65 | 39 | |
paul@65 | 40 | /* Pipe methods. */ |
paul@65 | 41 | |
paul@65 | 42 | virtual long current_region(offset_t *populated_size, offset_t *size); |
paul@65 | 43 | |
paul@65 | 44 | virtual long next_region(offset_t *populated_size, offset_t *size); |
paul@65 | 45 | }; |
paul@65 | 46 | |
paul@65 | 47 | // vim: tabstop=4 expandtab shiftwidth=4 |