- Complete LibLog support into lib & smutil,

- Continue code clean-up.
This commit is contained in:
2024-04-19 18:44:32 +02:00
parent a84d15e238
commit 8a783e09e9
4 changed files with 795 additions and 829 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -99,6 +99,8 @@ SMT_Heap * System_Heap;
NDT_Root * Opened_Heap_List;
/*
Taille par défaut des chunks alloués dans le heap système :
Cette taille est fixée à la taille maximale des chunks pouvant
@@ -115,6 +117,8 @@ NDT_Root * Opened_Heap_List;
#define FREE_CHUNK_LIMIT 3
int SM_Instance;
char * SM_Context;
@@ -168,6 +172,13 @@ typedef union semun
unsigned short int * array;
} semun;
/*------------------------------------------------------------------------------*/
/* */
/*------------------------------------------------------------------------------*/
#define SM_LIBSHMEM_OPEN_CHECK() if( !SM_Base) { LG_LOG_ERROR_0( "LibShMem library is not open"); return( SMS_ERRAPI); }
#define SM_HEAP_NAME_CHECK(ptr) if( !(ptr)) { LG_LOG_ERROR_0( "Heap name is undefined"); return( SMS_ERRAPI); }
#define SM_HEAP_CHECK( ptr) if( !(ptr)) { LG_LOG_ERROR_0( "Heap is undefined"); return( SMS_ERRAPI); }
@@ -176,127 +187,192 @@ typedef union semun
/*------------------------------------------------------------------------------*/
/* Allocation de mémoire dans la base */
/*------------------------------------------------------------------------------*/
NDT_Status SM_Base_Alloc( void **, size_t, void *);
/*------------------------------------------------------------------------------*/
/* Désallocation de mémoire dans la base */
/*------------------------------------------------------------------------------*/
NDT_Status SM_Base_Free( void *, void *);
/*------------------------------------------------------------------------------*/
/* Allocation de mémoire dans le heap système */
/*------------------------------------------------------------------------------*/
NDT_Status SM_System_Alloc( void **, size_t, void *);
/*------------------------------------------------------------------------------*/
/* Désallocation de mémoire dans le heap système */
/*------------------------------------------------------------------------------*/
NDT_Status SM_System_Free( void *, void *);
/*------------------------------------------------------------------------------*/
/* Initialisation de la base */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Base_Init (void);
/*------------------------------------------------------------------------------*/
/* Terminaison de la base */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Base_End (void);
/*------------------------------------------------------------------------------*/
/* Ouverture de la base */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Base_Open (void);
/*------------------------------------------------------------------------------*/
/* Fermeture de la base */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Base_Close (void);
/*------------------------------------------------------------------------------*/
/* Pose d'un verrou sur la base : */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Base_Lock (SMT_Flags);
/*------------------------------------------------------------------------------*/
/* Libération d'un verrou sur la base : */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Base_Unlock (SMT_Flags);
/*------------------------------------------------------------------------------*/
/* Fonction manager de la liste des heaps ouverts */
/*------------------------------------------------------------------------------*/
NDT_Status SM_Opened_Heap_List_Manager ( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list *);
/*------------------------------------------------------------------------------*/
/* Fonction manager du MHR (Memory Heap Root) */
/*------------------------------------------------------------------------------*/
NDT_Status MHR_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list *);
/*------------------------------------------------------------------------------*/
/* Destruction d'un MHH (Memory Heap Header) */
/*------------------------------------------------------------------------------*/
SMT_Status SM_MHH_End (SMT_MHH *);
/*------------------------------------------------------------------------------*/
/* Fonction manager pour un DSR (Data Segment Root) */
/*------------------------------------------------------------------------------*/
NDT_Status SM_DSR_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list *);
/*------------------------------------------------------------------------------*/
/* Ouverture d'un segment de données */
/*------------------------------------------------------------------------------*/
SMT_Status SM_DataSegment_Open (SMT_DSH *);
/*------------------------------------------------------------------------------*/
/* Fermeture d'un segment de données */
/*------------------------------------------------------------------------------*/
SMT_Status SM_DataSegment_Close (SMT_DSH *);
/*------------------------------------------------------------------------------*/
/* Compression d'un segment de données */
/*------------------------------------------------------------------------------*/
size_t SM_DataSegment_Compress (SMT_DSH *, NDT_Root *);
/*------------------------------------------------------------------------------*/
/* Fonction manager pour un ACR (Allocated Chunk Root) */
/*------------------------------------------------------------------------------*/
NDT_Status SM_ACR_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list *);
/*------------------------------------------------------------------------------*/
/* Fonction manager pour un FCR (Free Chunk Root) */
/*------------------------------------------------------------------------------*/
NDT_Status SM_FCR_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list *);
/*------------------------------------------------------------------------------*/
/* Pose d'un verrou sur un heap : */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Heap_Lock_Set (SMT_MHH *, SMT_Flags);
/*------------------------------------------------------------------------------*/
/* Changement d'un verrou sur un heap : */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Heap_Lock_Change (SMT_MHH *, SMT_Flags);
/*------------------------------------------------------------------------------*/
/* Libération d'un verrou sur un heap : */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Heap_Lock_Release (SMT_MHH *, SMT_Flags);
/*------------------------------------------------------------------------------*/
/* Opération sur un sémaphore */
/*------------------------------------------------------------------------------*/
SMT_Status SM_Semaphore_Operate (int, struct sembuf *, unsigned int);
/*------------------------------------------------------------------------------*/
/* Récupère sous forme explicite l'état d'un verrou */
/*------------------------------------------------------------------------------*/
char * SM_Lock_Status_Get (const char *, void *);
/*------------------------------------------------------------------------------*/
/* Routine d'affichage d'un message d'erreur */
/*------------------------------------------------------------------------------*/
void SM_Error_Print (void);
char * SM_Lock_Status_Get (const char *, void *);