ReactOS 0.4.16-dev-306-g647d351
memp_priv.h File Reference
#include "lwip/opt.h"
#include "lwip/mem.h"
#include "lwip/priv/mem_priv.h"
Include dependency graph for memp_priv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  memp
 
struct  memp_desc
 

Macros

#define MEMP_SIZE   0
 
#define MEMP_ALIGN_SIZE(x)   (LWIP_MEM_ALIGN_SIZE(x))
 
#define DECLARE_LWIP_MEMPOOL_DESC(desc)
 
#define LWIP_MEMPOOL_DECLARE_STATS_INSTANCE(name)
 
#define LWIP_MEMPOOL_DECLARE_STATS_REFERENCE(name)
 

Functions

void memp_init_pool (const struct memp_desc *desc)
 
voidmemp_malloc_pool (const struct memp_desc *desc)
 
void memp_free_pool (const struct memp_desc *desc, void *mem)
 

Detailed Description

memory pools lwIP internal implementations (do not use in application code)

Definition in file memp_priv.h.

Macro Definition Documentation

◆ DECLARE_LWIP_MEMPOOL_DESC

#define DECLARE_LWIP_MEMPOOL_DESC (   desc)

Definition at line 136 of file memp_priv.h.

◆ LWIP_MEMPOOL_DECLARE_STATS_INSTANCE

#define LWIP_MEMPOOL_DECLARE_STATS_INSTANCE (   name)

Definition at line 143 of file memp_priv.h.

◆ LWIP_MEMPOOL_DECLARE_STATS_REFERENCE

#define LWIP_MEMPOOL_DECLARE_STATS_REFERENCE (   name)

Definition at line 144 of file memp_priv.h.

◆ MEMP_ALIGN_SIZE

#define MEMP_ALIGN_SIZE (   x)    (LWIP_MEM_ALIGN_SIZE(x))

Definition at line 64 of file memp_priv.h.

◆ MEMP_SIZE

#define MEMP_SIZE   0

Definition at line 63 of file memp_priv.h.

Function Documentation

◆ memp_free_pool()

void memp_free_pool ( const struct memp_desc desc,
void mem 
)

Put a custom pool element back into its pool.

Parameters
descthe pool where to put mem
memthe memp element to free

Definition at line 403 of file memp.c.

404{
405 LWIP_ASSERT("invalid pool desc", desc != NULL);
406 if ((desc == NULL) || (mem == NULL)) {
407 return;
408 }
409
411}
#define NULL
Definition: types.h:112
#define LWIP_ASSERT(message, assertion)
Definition: debug.h:116
static void do_memp_free_pool(const struct memp_desc *desc, void *mem)
Definition: memp.c:359
static const WCHAR desc[]
Definition: protectdata.c:36
Definition: mem.c:349

◆ memp_init_pool()

void memp_init_pool ( const struct memp_desc desc)

Initialize custom memory pool. Related functions: memp_malloc_pool, memp_free_pool

Parameters
descpool to initialize

Definition at line 175 of file memp.c.

176{
177#if MEMP_MEM_MALLOC
179#else
180 int i;
181 struct memp *memp;
182
183 *desc->tab = NULL;
184 memp = (struct memp *)LWIP_MEM_ALIGN(desc->base);
185#if MEMP_MEM_INIT
186 /* force memset on pool memory */
187 memset(memp, 0, (size_t)desc->num * (MEMP_SIZE + desc->size
189 + MEM_SANITY_REGION_AFTER_ALIGNED
190#endif
191 ));
192#endif
193 /* create a linked list of memp elements */
194 for (i = 0; i < desc->num; ++i) {
195 memp->next = *desc->tab;
196 *desc->tab = memp;
197#if MEMP_OVERFLOW_CHECK
198 memp_overflow_init_element(memp, desc);
199#endif /* MEMP_OVERFLOW_CHECK */
200 /* cast through void* to get rid of alignment warnings */
201 memp = (struct memp *)(void *)((u8_t *)memp + MEMP_SIZE + desc->size
203 + MEM_SANITY_REGION_AFTER_ALIGNED
204#endif
205 );
206 }
207#if MEMP_STATS
208 desc->stats->avail = desc->num;
209#endif /* MEMP_STATS */
210#endif /* !MEMP_MEM_MALLOC */
211
212#if MEMP_STATS && (defined(LWIP_DEBUG) || LWIP_STATS_DISPLAY)
213 desc->stats->name = desc->desc;
214#endif /* MEMP_STATS && (defined(LWIP_DEBUG) || LWIP_STATS_DISPLAY) */
215}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
uint8_t u8_t
Definition: arch.h:125
#define LWIP_UNUSED_ARG(x)
Definition: arch.h:373
#define LWIP_MEM_ALIGN(addr)
Definition: arch.h:294
#define MEMP_OVERFLOW_CHECK
Definition: opt.h:303
#define MEMP_SIZE
Definition: memp_priv.h:63
#define memset(x, y, z)
Definition: compat.h:39
Definition: memp_priv.h:69
struct memp * next
Definition: memp_priv.h:70

Referenced by memp_init().

◆ memp_malloc_pool()

void * memp_malloc_pool ( const struct memp_desc desc)

Get an element from a custom pool.

Parameters
descthe pool to get an element from
Returns
a pointer to the allocated memory or a NULL pointer on error

Definition at line 311 of file memp.c.

315{
316 LWIP_ASSERT("invalid pool desc", desc != NULL);
317 if (desc == NULL) {
318 return NULL;
319 }
320
321#if !MEMP_OVERFLOW_CHECK
323#else
324 return do_memp_malloc_pool_fn(desc, file, line);
325#endif
326}
static void * do_memp_malloc_pool(const struct memp_desc *desc)
Definition: memp.c:245
Definition: fci.c:127
Definition: parser.c:49