aboutsummaryrefslogtreecommitdiff
path: root/include/apos/mem_nodes.h
blob: 164d04a56ef99d9196c1428261064f7c9321f9ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* SPDX-License-Identifier: GPL-3.0-or-later */
/* Copyright 2021 - 2022, Kim Kuparinen < kimi.h.kuparinen@gmail.com > */

#ifndef APOS_MM_NODES_H
#define APOS_MM_NODES_H

/**
 * @file mem_nodes.h
 * Memory node subsystem. Used by the memory region subsystem.
 */

#include <apos/vmem.h>
#include <apos/nodes.h>

/**
 * Initialize memory node subsystem.
 *
 * @pre Physical memory subsystem has been initialized.
 */
void init_mem_nodes();

/**
 * Destroy memory node subsystem.
 * Free all associated allocations.
 */
void destroy_mem_nodes();

/**
 * Fetch a new memory node.
 *
 * @return Pointer to \ref mem_region node on success, \c NULL otherwise.
 */
struct mem_region *get_mem_node();

/**
 * Free a memory node.
 *
 * @param m Pointer to \ref mem_region node to free.
 */
void free_mem_node(struct mem_region *m);

#endif /* APOS_MM_NODES_H */