# HG changeset patch # User Paul Boddie # Date 1619905910 -7200 # Node ID e44c8db8ee3f3f43152e7f31bc8616d90352ca51 # Parent 32c2de3b6a0623851e637f420a6caf33d8672f2c Added documentation strings for various methods. diff -r 32c2de3b6a06 -r e44c8db8ee3f libmem/lib/src/flexpage.cc --- a/libmem/lib/src/flexpage.cc Sat May 01 23:51:28 2021 +0200 +++ b/libmem/lib/src/flexpage.cc Sat May 01 23:51:50 2021 +0200 @@ -61,6 +61,9 @@ page_addr = base_addr + page_offset; } +/* Decrement the usage counter, returning whether the flexpage is now no longer + used. */ + bool Flexpage::decrement() { if (_counter) @@ -72,16 +75,22 @@ return 0; } +/* Increment the usage counter. */ + void Flexpage::increment() { _counter++; } +/* Invalidate the flexpage, meaning that it should not now be in use. */ + void Flexpage::invalidate() { _counter = 0; } +/* Return whether the flexpage is in use and is therefore valid. */ + bool Flexpage::valid() { return _counter != 0; diff -r 32c2de3b6a06 -r e44c8db8ee3f libmem/lib/src/memory_incremental.cc --- a/libmem/lib/src/memory_incremental.cc Sat May 01 23:51:28 2021 +0200 +++ b/libmem/lib/src/memory_incremental.cc Sat May 01 23:51:50 2021 +0200 @@ -23,6 +23,8 @@ #include + + /* Initialise the memory pool with an optional 'limit' in pages. */ MemoryIncremental::MemoryIncremental(unsigned int limit, offset_t region_size) @@ -87,6 +89,9 @@ return NULL; } +/* Allocate a new region having the default region size rounded to the nearest + page. */ + Region *MemoryIncremental::region() { return region(_region_size);