qos_memory.c File Reference

#include <linux/aquosa/rres_config.h>
#include "qos_debug.h"
#include <stdlib.h>
#include <string.h>
#include "qos_memory.h"

Go to the source code of this file.

Defines

#define QOS_DEBUG_LEVEL   QOS_LEVEL_INFO

Functions

int qos_mem_valid (void *ptr)
 Check whether the supplied pointer is found within any of the chunks allocated through qos_malloc().
static void * qos_ll_malloc (long size)
static void qos_ll_free (void *ptr)
void * qos_malloc (long size)
 Allocates a memory segment either in user-space or in kernel-space.
void * qos_malloc_named (long size, const char *name)
 Like qos_malloc(), but adds a name for the chunk useful when debugging.
void qos_free (void *ptr)
 Deallocates a memory segment.
int qos_mem_clean ()
 If memory check enabled, return 1 if all allocated memory chunks have been freed, and no chunk-related errors occurred ever during qos_malloc() / qos_free().

Define Documentation

#define QOS_DEBUG_LEVEL   QOS_LEVEL_INFO

Definition at line 2 of file qos_memory.c.


Function Documentation

void qos_free ( void *  ptr  ) 

Deallocates a memory segment.

Definition at line 176 of file qos_memory.c.

References qos_ll_free(), qos_log_crit, and qos_log_debug.

Referenced by qos_func_define(), qsup_cleanup(), qsup_create_server(), qsup_destroy_server(), rres_cleanup(), rres_del(), and rres_destroy_server().

static void qos_ll_free ( void *  ptr  )  [inline, static]

Definition at line 139 of file qos_memory.c.

Referenced by qos_free(), and qos_malloc_named().

static void* qos_ll_malloc ( long  size  )  [inline, static]

Definition at line 131 of file qos_memory.c.

Referenced by qos_malloc_named().

void* qos_malloc ( long  size  ) 

Allocates a memory segment either in user-space or in kernel-space.

In case of no memory available returns 0.

Note:
Another possible implementation of allocation function can be:
   #define qos_malloc(x) do { x = xalloc(sizeof (*(x))); } while (0)

Definition at line 147 of file qos_memory.c.

References qos_malloc_named().

Referenced by get_user_info(), qres_setup_qsup_for_rres(), and qsup_add_user_constraints().

void* qos_malloc_named ( long  size,
const char *  name 
)

Like qos_malloc(), but adds a name for the chunk useful when debugging.

Definition at line 151 of file qos_memory.c.

References qos_ll_free(), qos_ll_malloc(), qos_log_crit, and qos_log_debug.

Referenced by qos_malloc().

int qos_mem_clean ( void   ) 

If memory check enabled, return 1 if all allocated memory chunks have been freed, and no chunk-related errors occurred ever during qos_malloc() / qos_free().

Definition at line 198 of file qos_memory.c.

References qos_log_debug.

Referenced by rres_cleanup_module().

int qos_mem_valid ( void *  ptr  ) 

Check whether the supplied pointer is found within any of the chunks allocated through qos_malloc().

Check if the supplied pointer is within allocated segments.

Definition at line 125 of file qos_memory.c.

Referenced by hrt_callback(), rres_any_blocked_task(), rres_any_ready_task(), rres_detach_task_nosched(), rres_schedule(), and timer_callback().

Generated on Mon Aug 2 22:39:17 2010 for qosres by  doxygen 1.6.3