L4Re/departure

paging.cc

9:ebe5228f5056
2021-01-24 Paul Boddie Introduced usage of an opener to obtain a file pager.
     1 #include "paging.h"     2      3 bool Paging::reserve(Accessor *accessor)     4 {     5     _lock.lock();     6      7     return _mappers.find(accessor) != _mappers.end();     8 }     9     10 PageMapper *Paging::get(Accessor *accessor)    11 {    12     AccessorMapping::iterator entry = _mappers.find(accessor);    13     PageMapper *mapper;    14     15     if (entry == _mappers.end())    16         mapper = NULL;    17     else    18         mapper = entry->second;    19     20     _lock.unlock();    21     return mapper;    22 }    23     24 void Paging::set(Accessor *accessor, PageMapper *mapper)    25 {    26     AccessorMapping::iterator entry = _mappers.find(accessor);    27     28     if (entry == _mappers.end())    29         _mappers[accessor] = mapper;    30     31     _lock.unlock();    32 }    33     34 // vim: tabstop=4 expandtab shiftwidth=4