Smrender
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Macros
src
smem.h
1
/* Copyright 2012 Bernhard R. Fischer, 2048R/5C5FFD47 <bf@abenteuerland.at>
2
*
3
* This file is part of Smrender.
4
*
5
* Smrender is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, version 3 of the License.
8
*
9
* Smrender is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with Smrender. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef SMEM_H
19
#define SMEM_H
20
21
#define DEF_PAGESIZE (4096 - sizeof(sm_memlist_t))
22
#define SM_PAGES(x) ((x) / (page_size_ + 1) + 1)
23
24
25
typedef
struct
sm_memlist
sm_memlist_t;
26
typedef
struct
sm_mem
sm_mem_t;
27
28
29
struct
sm_memlist
30
{
31
size_t
size;
32
struct
sm_memlist
*next, *prev;
33
};
34
35
struct
sm_memblock
36
{
37
struct
sm_memblock
*next;
38
int
size;
39
void
*addr;
40
};
41
42
struct
sm_mem
43
{
44
struct
sm_memblock
*alloc_list;
45
struct
sm_memblock
*free_list;
46
};
47
48
49
void
*sm_alloc(
int
);
50
void
sm_free(
void
*);
51
char
*sm_strdup(
const
char
*);
52
53
#endif
54
sm_memlist
Definition:
smem.h:29
sm_mem
Definition:
smem.h:42
sm_memblock
Definition:
smem.h:35
Generated on Tue Oct 4 2016 13:30:40 for Smrender by
1.8.8