Commit d76ac327 authored by Thomas Laurent's avatar Thomas Laurent

remove public/protected macros in lists, mem_blocks

parent 45599fe4
......@@ -38,30 +38,14 @@
extern "C" {
#endif
# ifdef COMPONENT_CLI
# ifdef COMPONENT_CLI_IF
# define private_cli_if(x) x
# define friend_cli_if(x) x
# define public_cli_if(x) x
# else
# define private_cli_if(x)
# define friend_cli_if(x) extern x
# define public_cli_if(x) extern x
# endif
# else
# define private_cli_if(x)
# define friend_cli_if(x)
# define public_cli_if(x) extern x
# endif
/** @defgroup _cli_if Interfaces of CLI
* @{*/
public_cli_if( void cli_init (void); )
public_cli_if( int cli_server_init(cli_handler_t handler); )
public_cli_if(void cli_server_cleanup(void);)
public_cli_if(void cli_server_recv(const void * data, socklen_t len);)
void cli_init (void);
int cli_server_init(cli_handler_t handler);
void cli_server_cleanup(void);
void cli_server_recv(const void * data, socklen_t len);
/* @}*/
#ifdef __cplusplus
......
......@@ -32,21 +32,6 @@
#include "types.h"
//-----------------------------------------------------------------------------
# ifdef list_C
# define private_list(x) x
# define public_list(x) x
# else
# define private_list(x)
# define public_list(x) extern x
# endif
# ifdef LIST2_C
# define private_list2(x) x
# define public_list2(x) x
# else
# define private_list2(x)
# define public_list2(x) extern x
# endif
//-----------------------------------------------------------------------------
typedef struct Job_List_s {
Job_elt_t *head;
......@@ -67,36 +52,36 @@ typedef struct Packet_OTG_List_s {
} Packet_OTG_List_t;
//-----------------------------------------------------------------------------
public_list( void job_list_init (Job_List_t*);)
public_list( void job_list_free (Job_List_t* listP);)
public_list( Job_elt_t* job_list_get_head (Job_List_t*);)
public_list( Job_elt_t* job_list_remove_head (Job_List_t* );)
public_list( Job_elt_t* job_list_remove_element (Job_elt_t*, Job_List_t*);)
public_list( void job_list_add_head (Job_elt_t* , Job_List_t* );)
public_list( void job_list_add_tail_eurecom (Job_elt_t* , Job_List_t* );)
public_list( void job_list_add_list (Job_List_t* , Job_List_t* );)
public_list( void job_list_display (Job_List_t* );)
void job_list_init (Job_List_t*);
void job_list_free (Job_List_t* listP);
Job_elt_t* job_list_get_head (Job_List_t*);
Job_elt_t* job_list_remove_head (Job_List_t* );
Job_elt_t* job_list_remove_element (Job_elt_t*, Job_List_t*);
void job_list_add_head (Job_elt_t* , Job_List_t* );
void job_list_add_tail_eurecom (Job_elt_t* , Job_List_t* );
void job_list_add_list (Job_List_t* , Job_List_t* );
void job_list_display (Job_List_t* );
public_list( void event_list_init (Event_List_t*);)
public_list( void event_list_free (Event_List_t* listP);)
public_list( Event_elt_t* event_list_get_head (Event_List_t*);)
public_list( Event_elt_t* event_list_remove_head (Event_List_t* );)
public_list( Event_elt_t* event_list_remove_element (Event_elt_t*, Event_List_t*);)
public_list( void event_list_add_head (Event_elt_t* , Event_List_t* );)
public_list( void event_list_add_element (Event_elt_t* , Event_elt_t* , Event_List_t* );)
public_list( void event_list_add_tail_eurecom (Event_elt_t* , Event_List_t* );)
public_list( void event_list_add_list (Event_List_t* , Event_List_t* );)
public_list( void event_list_display (Event_List_t* );)
void event_list_init (Event_List_t*);
void event_list_free (Event_List_t* listP);
Event_elt_t* event_list_get_head (Event_List_t*);
Event_elt_t* event_list_remove_head (Event_List_t* );
Event_elt_t* event_list_remove_element (Event_elt_t*, Event_List_t*);
void event_list_add_head (Event_elt_t* , Event_List_t* );
void event_list_add_element (Event_elt_t* , Event_elt_t* , Event_List_t* );
void event_list_add_tail_eurecom (Event_elt_t* , Event_List_t* );
void event_list_add_list (Event_List_t* , Event_List_t* );
void event_list_display (Event_List_t* );
public_list( void pkt_list_init (Packet_OTG_List_t*);)
public_list( void pkt_list_free (Packet_OTG_List_t* listP);)
public_list( Packet_otg_elt_t* pkt_list_get_head (Packet_OTG_List_t*);)
public_list( Packet_otg_elt_t* pkt_list_remove_head (Packet_OTG_List_t* );)
public_list( Packet_otg_elt_t* pkt_list_remove_element (Packet_otg_elt_t*, Packet_OTG_List_t*);)
public_list( void pkt_list_add_head (Packet_otg_elt_t* , Packet_OTG_List_t* );)
public_list( void pkt_list_add_element (Packet_otg_elt_t* , Packet_otg_elt_t* , Packet_OTG_List_t* );)
public_list( void pkt_list_add_tail_eurecom (Packet_otg_elt_t* , Packet_OTG_List_t* );)
public_list( void pkt_list_add_list (Packet_OTG_List_t* , Packet_OTG_List_t* );)
public_list( void pkt_list_display (Packet_OTG_List_t* );)
void pkt_list_init (Packet_OTG_List_t*);
void pkt_list_free (Packet_OTG_List_t* listP);
Packet_otg_elt_t* pkt_list_get_head (Packet_OTG_List_t*);
Packet_otg_elt_t* pkt_list_remove_head (Packet_OTG_List_t* );
Packet_otg_elt_t* pkt_list_remove_element (Packet_otg_elt_t*, Packet_OTG_List_t*);
void pkt_list_add_head (Packet_otg_elt_t* , Packet_OTG_List_t* );
void pkt_list_add_element (Packet_otg_elt_t* , Packet_otg_elt_t* , Packet_OTG_List_t* );
void pkt_list_add_tail_eurecom (Packet_otg_elt_t* , Packet_OTG_List_t* );
void pkt_list_add_list (Packet_OTG_List_t* , Packet_OTG_List_t* );
void pkt_list_display (Packet_OTG_List_t* );
#endif
......@@ -39,66 +39,36 @@
#ifndef __LIST_H__
# define __LIST_H__
# include "UTIL/MEM/mem_block.h"
//-----------------------------------------------------------------------------
# ifdef LIST_C
# define private_list(x) x
# define public_list(x) x
# else
# define private_list(x)
# define public_list(x) extern x
# endif
# ifdef LIST2_C
# define private_list2(x) x
# define public_list2(x) x
# else
# define private_list2(x)
# define public_list2(x) extern x
# endif
//-----------------------------------------------------------------------------
#include "platform_constants.h"
#include<linux/types.h>
#include<stdlib.h>
#include<sys/queue.h>
#define LIST_NAME_MAX_CHAR 32
#include "UTIL/MEM/mem_block.h"
typedef struct {
struct mem_block_t *head;
struct mem_block_t *tail;
int nb_elements;
char name[LIST_NAME_MAX_CHAR];
} list2_t;
//-----------------------------------------------------------------------------
typedef struct {
struct mem_block_t *head;
struct mem_block_t *tail;
int nb_elements;
char name[LIST_NAME_MAX_CHAR];
} list_t;
//-----------------------------------------------------------------------------
public_list( void list_init (list_t* , char *);)
public_list( void list_free (list_t* listP);)
public_list( mem_block_t* list_get_head (list_t*);)
public_list( mem_block_t* list_remove_head (list_t* );)
public_list( mem_block_t* list_remove_element (mem_block_t*, list_t*);)
public_list( void list_add_head (mem_block_t* , list_t* );)
public_list( void list_add_tail_eurecom (mem_block_t* , list_t* );)
public_list( void list_add_list (list_t* , list_t* );)
public_list( void list_display (list_t* );)
void list_init (list_t* , char *);
void list_free (list_t* listP);
mem_block_t* list_get_head (list_t*);
mem_block_t* list_remove_head (list_t* );
mem_block_t* list_remove_element (mem_block_t*, list_t*);
void list_add_head (mem_block_t* , list_t* );
void list_add_tail_eurecom (mem_block_t* , list_t* );
void list_add_list (list_t* , list_t* );
void list_display (list_t* );
//-----------------------------------------------------------------------------
public_list2( void list2_init (list2_t*, char*);)
public_list2( void list2_free (list2_t* );)
public_list2( mem_block_t* list2_get_head (list2_t*);)
public_list2( mem_block_t* list2_get_tail (list2_t*);)
public_list2( mem_block_t* list2_remove_element (mem_block_t* , list2_t* );)
public_list2( mem_block_t* list2_remove_head (list2_t* );)
public_list2( mem_block_t* list2_remove_tail (list2_t* );)
public_list2( void list2_add_head (mem_block_t* , list2_t* );)
public_list2( void list2_add_tail (mem_block_t* , list2_t* );)
public_list2( void list2_add_list (list2_t* , list2_t* );)
public_list2( void list2_display (list2_t* );)
void list2_init (list2_t*, char*);
void list2_free (list2_t* );
mem_block_t* list2_get_head (list2_t*);
mem_block_t* list2_get_tail (list2_t*);
mem_block_t* list2_remove_element (mem_block_t* , list2_t* );
mem_block_t* list2_remove_head (list2_t* );
mem_block_t* list2_remove_tail (list2_t* );
void list2_add_head (mem_block_t* , list2_t* );
void list2_add_tail (mem_block_t* , list2_t* );
void list2_add_list (list2_t* , list2_t* );
void list2_display (list2_t* );
//-----------------------------------------------------------------------------
/* The following lists are used for sorting numbers */
#ifndef LINUX_LIST
......@@ -126,11 +96,11 @@ struct list {
};
#endif
//-----------------------------------------------------------------------------
public_list2( void push_front (struct list*, double); )
public_list2( void initialize (struct list*); )
public_list2( void del (struct list*); )
public_list2( void totable (double*, struct list*);)
public_list2( int compare (const void * a, const void * b);)
public_list2( int32_t calculate_median(struct list *loc_list);)
void push_front (struct list*, double);
void initialize (struct list*);
void del (struct list*);
void totable (double*, struct list*);
int compare (const void * a, const void * b);
int32_t calculate_median(struct list *loc_list);
#endif
......@@ -32,13 +32,7 @@
# define __MEM_BLOCK_H__
#include <stdint.h>
#ifdef MEM_BLOCK_C
# define public_mem_block(x) x
# define private_mem_block(x) x
#else
# define public_mem_block(x) extern x
# define private_mem_block(x)
#endif
#include "openair2/COMMON/platform_constants.h"
//-----------------------------------------------------------------------------
typedef struct mem_block_t {
......@@ -47,21 +41,20 @@ typedef struct mem_block_t {
unsigned char pool_id;
unsigned char *data;
} mem_block_t;
#include "UTIL/LISTS/list.h"
//-----------------------------------------------------------------------------
public_mem_block(void *pool_buffer_init (void);)
public_mem_block(void *pool_buffer_clean (void *arg);)
public_mem_block(void free_mem_block (mem_block_t * leP, const char* caller);)
public_mem_block(mem_block_t* get_free_mem_block (uint32_t sizeP, const char* caller);)
public_mem_block(mem_block_t *get_free_copy_mem_block (void);)
public_mem_block(mem_block_t *get_free_copy_mem_block_up (void);)
public_mem_block(mem_block_t *copy_mem_block (mem_block_t * leP, mem_block_t * destP);)
public_mem_block(void display_mem_load (void);)
public_mem_block(void check_mem_area (void);)
private_mem_block(void check_free_mem_block (mem_block_t * leP);)
void *pool_buffer_init (void);
void *pool_buffer_clean (void *arg);
void free_mem_block (mem_block_t * leP, const char* caller);
mem_block_t* get_free_mem_block (uint32_t sizeP, const char* caller);
mem_block_t *get_free_copy_mem_block (void);
mem_block_t *get_free_copy_mem_block_up (void);
mem_block_t *copy_mem_block (mem_block_t * leP, mem_block_t * destP);
void display_mem_load (void);
void check_mem_area (void);
void check_free_mem_block (mem_block_t * leP);
# define MEM_SCALE MAX_MOBILES_PER_ENB
// definition of the size of the allocated memory area
# define MEM_MNGT_MB0_BLOCK_SIZE 64
......@@ -139,9 +132,26 @@ private_mem_block(void check_free_mem_block (mem_block_t * leP);)
# define MEM_MNGT_NB_ELEMENTS MEM_MNGT_MB0_NB_BLOCKS + MEM_MNGT_MB1_NB_BLOCKS + MEM_MNGT_MB2_NB_BLOCKS + MEM_MNGT_MB3_NB_BLOCKS + MEM_MNGT_MB4_NB_BLOCKS + MEM_MNGT_MB5_NB_BLOCKS + MEM_MNGT_MB6_NB_BLOCKS + MEM_MNGT_MB7_NB_BLOCKS + MEM_MNGT_MB8_NB_BLOCKS + MEM_MNGT_MB9_NB_BLOCKS + MEM_MNGT_MB10_NB_BLOCKS + MEM_MNGT_MB11_NB_BLOCKS + MEM_MNGT_MB12_NB_BLOCKS + MEM_MNGT_MBCOPY_NB_BLOCKS
# define MEM_MNGT_POOL_ID_COPY 13
#define LIST_NAME_MAX_CHAR 32
typedef struct {
struct mem_block_t *head;
struct mem_block_t *tail;
int nb_elements;
char name[LIST_NAME_MAX_CHAR];
} list2_t;
//-----------------------------------------------------------------------------
typedef struct {
struct mem_block_t *head;
struct mem_block_t *tail;
int nb_elements;
char name[LIST_NAME_MAX_CHAR];
} list_t;
private_mem_block(typedef struct {
typedef struct {
//-----------------------------------------------------------
// basic memory management
//-----------------------------------------------------------
......@@ -161,9 +171,9 @@ private_mem_block(typedef struct {
mem_block_t mem_blocks[MEM_MNGT_NB_ELEMENTS];
list_t mem_lists[14];
} mem_pool;)
} mem_pool;
private_mem_block(mem_pool mem_block_var;)
mem_pool mem_block_var;
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment