1 #pragma once 2 3 #include "page_mapper.h" 4 #include "pages.h" 5 #include "pipe_accessor.h" 6 7 /* Pipe paging support, maintaining the sequence of active regions or sections 8 in a pipe. */ 9 10 class PipePaging 11 { 12 protected: 13 Memory *_memory; 14 Pages *_pages; 15 PageQueue *_queue; 16 17 /* Regions acting as files with their own accessors. */ 18 19 PageMapper *_regions[2]; 20 PipeAccessor _accessors[2]; 21 22 /* The first region is initially exposed to both reader and writer. */ 23 24 int _reading = 0, _writing = 0; 25 26 /* Pipe section/region size. */ 27 28 offset_t _size; 29 30 /* Endpoint status. */ 31 32 unsigned int _endpoints = 2; 33 34 public: 35 explicit PipePaging(Memory *memory, offset_t size); 36 37 virtual void detach(); 38 39 virtual offset_t region_size() 40 { return _size; } 41 42 /* Region management. */ 43 44 virtual PageMapper *add_region(); 45 46 virtual PageMapper *current_region(); 47 48 virtual PageMapper *next_region(); 49 }; 50 51 // vim: tabstop=4 expandtab shiftwidth=4