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 virtual void close(); 26 27 /* Server details. */ 28 29 int expected_items(); 30 31 ipc_server_handler_type handler(); 32 33 void *interface() 34 { return static_cast<PipeObject *>(this); } 35 36 /* Pager methods. */ 37 38 virtual long map(address_t offset, address_t hot_spot, flags_t flags, l4_snd_fpage_t *region); 39 40 /* Pipe methods. */ 41 42 virtual long current_region(offset_t *populated_size, offset_t *size); 43 44 virtual long next_region(offset_t *populated_size, offset_t *size); 45 }; 46 47 // vim: tabstop=4 expandtab shiftwidth=4