Define macros to access thread local object of type pagecache_t storead in threadcontext_t.
PageCacheMacros | Define macros to access thread local object of type pagecache_t storead in threadcontext_t. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file PageCacheMacros. |
C-kern/ | Implementation file PageCacheMacros impl. |
Functions | |
alloc | |
ALLOC_PAGECACHE | Allocates a single memory page of size pgsize (see pagesize_e) and returns it in page. |
RELEASE_PAGECACHE | Releases previously allocated memory page. |
ALLOCSTATIC_PAGECACHE | Allocates static block of memory and returns it in memblock. |
FREESTATIC_PAGECACHE | Frees static block of memory and clears memblock. |
query | |
SIZEALLOCATED_PAGECACHE | Returns sum of size of all allocated pages. |
SIZESTATIC_PAGECACHE | Returns size of static allocated memory. |
cache | |
EMPTYCACHE_PAGECACHE | Returns unused memory blocks back to OS. |
test | |
unittest_memory_pagecache_macros | Test pagecache_t functionality. |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2013 Jörg Seebohn
Header file PageCacheMacros.
Implementation file PageCacheMacros impl.
alloc | |
ALLOC_PAGECACHE | Allocates a single memory page of size pgsize (see pagesize_e) and returns it in page. |
RELEASE_PAGECACHE | Releases previously allocated memory page. |
ALLOCSTATIC_PAGECACHE | Allocates static block of memory and returns it in memblock. |
FREESTATIC_PAGECACHE | Frees static block of memory and clears memblock. |
query | |
SIZEALLOCATED_PAGECACHE | Returns sum of size of all allocated pages. |
SIZESTATIC_PAGECACHE | Returns size of static allocated memory. |
cache | |
EMPTYCACHE_PAGECACHE | Returns unused memory blocks back to OS. |
test | |
unittest_memory_pagecache_macros | Test pagecache_t functionality. |
#define ALLOC_PAGECACHE( pgsize, page ) (allocpage_pagecache(pagecache_maincontext(), (pgsize), (page)))
Allocates a single memory page of size pgsize (see pagesize_e) and returns it in page. See pagecache_it.allocpage for a description.
#define RELEASE_PAGECACHE( page ) (releasepage_pagecache(pagecache_maincontext(), (page)))
Releases previously allocated memory page. See pagecache_it.releasepage for a description.
#define ALLOCSTATIC_PAGECACHE( bytesize, memblock ) (allocstatic_pagecache(pagecache_maincontext(), (bytesize), (memblock)))
Allocates static block of memory and returns it in memblock. See pagecache_it.allocstatic for a description.
#define FREESTATIC_PAGECACHE( memblock ) (freestatic_pagecache(pagecache_maincontext(), (memblock)))
Frees static block of memory and clears memblock. See pagecache_it.freestatic for a description.
#define SIZEALLOCATED_PAGECACHE( ) (sizeallocated_pagecache(pagecache_maincontext()))
Returns sum of size of all allocated pages. See pagecache_it.sizeallocated for a description.
#define SIZESTATIC_PAGECACHE( ) (sizestatic_pagecache(pagecache_maincontext()))
Returns size of static allocated memory. See pagecache_it.sizestatic for a description.
#define EMPTYCACHE_PAGECACHE( ) (emptycache_pagecache(pagecache_maincontext()))
Returns unused memory blocks back to OS. See pagecache_it.emptycache for a description.
int unittest_memory_pagecache_macros( void )
Test pagecache_t functionality.
Uses iobj_DECLARE to declare interfaceable object.
iobj_DECLARE( pagecache_t, pagecache )
Allocates a single memory page of size pgsize (see pagesize_e) and returns it in page.
#define ALLOC_PAGECACHE( pgsize, page ) (allocpage_pagecache(pagecache_maincontext(), (pgsize), (page)))
Releases previously allocated memory page.
#define RELEASE_PAGECACHE( page ) (releasepage_pagecache(pagecache_maincontext(), (page)))
Allocates static block of memory and returns it in memblock.
#define ALLOCSTATIC_PAGECACHE( bytesize, memblock ) (allocstatic_pagecache(pagecache_maincontext(), (bytesize), (memblock)))
Frees static block of memory and clears memblock.
#define FREESTATIC_PAGECACHE( memblock ) (freestatic_pagecache(pagecache_maincontext(), (memblock)))
Returns sum of size of all allocated pages.
#define SIZEALLOCATED_PAGECACHE( ) (sizeallocated_pagecache(pagecache_maincontext()))
Returns size of static allocated memory.
#define SIZESTATIC_PAGECACHE( ) (sizestatic_pagecache(pagecache_maincontext()))
Returns unused memory blocks back to OS.
#define EMPTYCACHE_PAGECACHE( ) (emptycache_pagecache(pagecache_maincontext()))
Test pagecache_t functionality.
int unittest_memory_pagecache_macros( void )
Allocates a single memory page of size pgsize.
int ( * allocpage ) (pagecache_t * pgcache, uint8_t pgsize, /*out*/struct memblock_t * page)
Releases a single memory page.
int ( * releasepage ) (pagecache_t * pgcache, struct memblock_t * page)
Allocates static memory which should live as long as pgcache.
int ( * allocstatic ) (pagecache_t * pgcache, size_t bytesize, /*out*/struct memblock_t * memblock)
Frees static memory.
int ( * freestatic ) (pagecache_t * pgcache, struct memblock_t * memblock)
Returns the sum of the size of all allocated pages.
size_t ( * sizeallocated ) (const pagecache_t * pgcache)
Size of memory allocated with allocstatic.
size_t ( * sizestatic ) (const pagecache_t * pgcache)
Releases all unused memory blocks back to the operating system.
int ( * emptycache ) (pagecache_t * pgcache)