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