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 8 /* A pager abstraction for a pipe. */ 9 10 class PipePager : public Pager, public PipeObject 11 { 12 protected: 13 PipePaging *_paging; 14 bool _writing; 15 16 /* Helper methods. */ 17 18 virtual long next_region_for_reader(offset_t *populated_size, offset_t *size); 19 20 virtual long next_region_for_writer(offset_t *populated_size, offset_t *size); 21 22 public: 23 explicit PipePager(PipePaging *paging, bool writer); 24 25 /* Server details. */ 26 27 int expected_items(); 28 29 ipc_server_handler_type handler(); 30 31 void *interface() 32 { return static_cast<PipeObject *>(this); } 33 34 /* Pager methods. */ 35 36 virtual long map(unsigned long offset, l4_addr_t hot_spot, flags_t flags, l4_snd_fpage_t *region); 37 38 /* Pipe methods. */ 39 40 virtual long current_region(offset_t *populated_size, offset_t *size); 41 42 virtual long next_region(offset_t *populated_size, offset_t *size); 43 }; 44 45 // vim: tabstop=4 expandtab shiftwidth=4