- Add support ND_Allocator_Exec() & ND_Deallocator_Exec() new NDT_Root pointer parameter,
- Add NDT_Root pointer to SM_Base_Alloc(), SM_Base_Free(), SM_System_Alloc() & SM_System_Free() API.
This commit is contained in:
parent
a5bac4e578
commit
493568b9fb
@ -749,16 +749,16 @@ SMT_Status SM_Heap_Open_I( const char *Heap_Name, SMT_Heap **Heap_Ptr_Ptr, si
|
|||||||
ND_Value_Free( MHH->DSR, New_DSH);
|
ND_Value_Free( MHH->DSR, New_DSH);
|
||||||
|
|
||||||
Error7:
|
Error7:
|
||||||
ND_Deallocator_Exec( MHH->FCR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( MHH->FCR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
Error6:
|
Error6:
|
||||||
ND_Deallocator_Exec( MHH->ACR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( MHH->ACR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
Error5:
|
Error5:
|
||||||
ND_Deallocator_Exec( MHH->DSR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( MHH->DSR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
Error4:
|
Error4:
|
||||||
ND_Deallocator_Exec( MHH, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( MHH, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
Error3:
|
Error3:
|
||||||
semctl( SemId, 0, IPC_RMID, Sem_Ctl);
|
semctl( SemId, 0, IPC_RMID, Sem_Ctl);
|
||||||
@ -1681,7 +1681,7 @@ SMT_Status SM_Chunk_Alloc_I( SMT_Heap *Heap, size_t Alloc_Size, void **Ptr )
|
|||||||
ND_Value_Alloc pour éviter que ce noeud soit alloué dans le nouveau segment.
|
ND_Value_Alloc pour éviter que ce noeud soit alloué dans le nouveau segment.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SM_System_Alloc( (void **)(&New_Node), sizeof (NDT_Node), NULL);
|
SM_System_Alloc( (void **)(&New_Node), NULL, sizeof (NDT_Node), NULL);
|
||||||
New_Node->Root = NULL;
|
New_Node->Root = NULL;
|
||||||
New_Node->Parent = NULL;
|
New_Node->Parent = NULL;
|
||||||
New_Node->Left = NULL;
|
New_Node->Left = NULL;
|
||||||
@ -2275,7 +2275,7 @@ SMT_Status SM_Chunk_Free_C( SMT_Heap *Heap_Ptr, void *Ptr)
|
|||||||
/* Allocation de mémoire dans la base */
|
/* Allocation de mémoire dans la base */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NDT_Status SM_Base_Alloc( void **Ptr, size_t Size, void *Data_Ptr)
|
NDT_Status SM_Base_Alloc( void **Ptr, NDT_Root *ND_Root_Ptr, size_t Size, void *Data_Ptr)
|
||||||
{
|
{
|
||||||
*Ptr = SM_Base->Free;
|
*Ptr = SM_Base->Free;
|
||||||
SM_Base->Free = (void *)( (size_t)(SM_Base->Free) + Size);
|
SM_Base->Free = (void *)( (size_t)(SM_Base->Free) + Size);
|
||||||
@ -2291,7 +2291,7 @@ NDT_Status SM_Base_Alloc( void **Ptr, size_t Size, void *Data_Ptr)
|
|||||||
/* Désallocation de mémoire dans la base */
|
/* Désallocation de mémoire dans la base */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NDT_Status SM_Base_Free( void *Ptr, void *Data_Ptr)
|
NDT_Status SM_Base_Free( void *Ptr, NDT_Root *ND_Root_Ptr, void *Data_Ptr)
|
||||||
{
|
{
|
||||||
if( !Ptr) return( SMS_ERRAPI);
|
if( !Ptr) return( SMS_ERRAPI);
|
||||||
|
|
||||||
@ -2306,7 +2306,7 @@ NDT_Status SM_Base_Free( void *Ptr, void *Data_Ptr)
|
|||||||
/* Allocation de mémoire dans le heap système */
|
/* Allocation de mémoire dans le heap système */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NDT_Status SM_System_Alloc( void **Ptr, size_t Size, void *Data_Ptr)
|
NDT_Status SM_System_Alloc( void **Ptr, NDT_Root *ND_Root_Ptr, size_t Size, void *Data_Ptr)
|
||||||
{
|
{
|
||||||
return( SM_Chunk_Alloc_I( System_Heap, Size, Ptr));
|
return( SM_Chunk_Alloc_I( System_Heap, Size, Ptr));
|
||||||
}
|
}
|
||||||
@ -2319,7 +2319,7 @@ NDT_Status SM_System_Alloc( void **Ptr, size_t Size, void *Data_Ptr)
|
|||||||
/* Désallocation de mémoire dans le heap système */
|
/* Désallocation de mémoire dans le heap système */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NDT_Status SM_System_Free( void *Ptr, void *Data_Ptr)
|
NDT_Status SM_System_Free( void *Ptr, NDT_Root *ND_Root_Ptr, void *Data_Ptr)
|
||||||
{
|
{
|
||||||
return( SM_Chunk_Free_I( System_Heap, Ptr));
|
return( SM_Chunk_Free_I( System_Heap, Ptr));
|
||||||
}
|
}
|
||||||
@ -3426,7 +3426,7 @@ NDT_Status MHR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
|
|||||||
|
|
||||||
/* Réservation du MHH (dans la base pour le heap système, dans le heap système pour les autres heaps) */
|
/* Réservation du MHH (dans la base pour le heap système, dans le heap système pour les autres heaps) */
|
||||||
|
|
||||||
if( ND_Allocator_Exec( (void **)(MHH_Ptr_Ptr), sizeof( SMT_MHH), SM_Base->MHR->Allocator_Name, SM_Base->MHR->Allocator_Ptr, NULL) != NDS_OK)
|
if( ND_Allocator_Exec( (void **)(MHH_Ptr_Ptr), SM_Base->MHR, sizeof( SMT_MHH), SM_Base->MHR->Allocator_Name, SM_Base->MHR->Allocator_Ptr, NULL) != NDS_OK)
|
||||||
{
|
{
|
||||||
LG_LOG_ERROR_0( "Unable to allocate memory for the heap header");
|
LG_LOG_ERROR_0( "Unable to allocate memory for the heap header");
|
||||||
|
|
||||||
@ -3520,16 +3520,16 @@ NDT_Status MHR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
|
|||||||
ND_Value_Free( ( *MHH_Ptr_Ptr)->DSR, DSH_Ptr);
|
ND_Value_Free( ( *MHH_Ptr_Ptr)->DSR, DSH_Ptr);
|
||||||
|
|
||||||
Error7:
|
Error7:
|
||||||
ND_Deallocator_Exec( ( *MHH_Ptr_Ptr)->FCR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( ( *MHH_Ptr_Ptr)->FCR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
Error6:
|
Error6:
|
||||||
ND_Deallocator_Exec( ( *MHH_Ptr_Ptr)->ACR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( ( *MHH_Ptr_Ptr)->ACR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
Error5:
|
Error5:
|
||||||
ND_Deallocator_Exec( ( *MHH_Ptr_Ptr)->DSR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( ( *MHH_Ptr_Ptr)->DSR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
Error4:
|
Error4:
|
||||||
ND_Deallocator_Exec( *MHH_Ptr_Ptr, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( *MHH_Ptr_Ptr, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
Error3:
|
Error3:
|
||||||
semctl( SemId, 0, IPC_RMID, Sem_Ctl);
|
semctl( SemId, 0, IPC_RMID, Sem_Ctl);
|
||||||
@ -3633,13 +3633,13 @@ NDT_Status MHR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
|
|||||||
leur racine.
|
leur racine.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rc = ND_Deallocator_Exec( MHH_Ptr->ACR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
rc = ND_Deallocator_Exec( MHH_Ptr->ACR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
if( rc != NDS_OK)
|
if( rc != NDS_OK)
|
||||||
{
|
{
|
||||||
LG_LOG_ERROR_1( "Unable to free the ACR root of heap: [%s]", MHH_Ptr->Name);
|
LG_LOG_ERROR_1( "Unable to free the ACR root of heap: [%s]", MHH_Ptr->Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ND_Deallocator_Exec( MHH_Ptr->FCR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
rc = ND_Deallocator_Exec( MHH_Ptr->FCR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
if( rc != NDS_OK)
|
if( rc != NDS_OK)
|
||||||
{
|
{
|
||||||
LG_LOG_ERROR_1( "Unable to free the FCR root of heap: [%s]", MHH_Ptr->Name);
|
LG_LOG_ERROR_1( "Unable to free the FCR root of heap: [%s]", MHH_Ptr->Name);
|
||||||
@ -3675,7 +3675,7 @@ NDT_Status MHR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
|
|||||||
|
|
||||||
/* Désallocation de la structure du MHH */
|
/* Désallocation de la structure du MHH */
|
||||||
|
|
||||||
rc = ND_Deallocator_Exec( MHH_Ptr, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
rc = ND_Deallocator_Exec( MHH_Ptr, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
if( rc != SMS_OK)
|
if( rc != SMS_OK)
|
||||||
{
|
{
|
||||||
LG_LOG_ERROR_1( "Unable to free the header of heap: [%s]", MHH_Ptr->Name);
|
LG_LOG_ERROR_1( "Unable to free the header of heap: [%s]", MHH_Ptr->Name);
|
||||||
@ -4014,13 +4014,13 @@ SMT_Status SM_MHH_End( SMT_MHH *MHH)
|
|||||||
leur racine.
|
leur racine.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rc = ND_Deallocator_Exec( MHH->ACR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
rc = ND_Deallocator_Exec( MHH->ACR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
if( rc != NDS_OK)
|
if( rc != NDS_OK)
|
||||||
{
|
{
|
||||||
LG_LOG_ERROR_1( "Unable to free the ACR root of heap: [%s]", MHH->Name);
|
LG_LOG_ERROR_1( "Unable to free the ACR root of heap: [%s]", MHH->Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ND_Deallocator_Exec( MHH->FCR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
rc = ND_Deallocator_Exec( MHH->FCR, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
if( rc != NDS_OK)
|
if( rc != NDS_OK)
|
||||||
{
|
{
|
||||||
LG_LOG_ERROR_1( "Unable to free the FCR root of heap: [%s]", MHH->Name);
|
LG_LOG_ERROR_1( "Unable to free the FCR root of heap: [%s]", MHH->Name);
|
||||||
@ -4056,7 +4056,7 @@ SMT_Status SM_MHH_End( SMT_MHH *MHH)
|
|||||||
|
|
||||||
/* Désallocation de la structure du MHH */
|
/* Désallocation de la structure du MHH */
|
||||||
|
|
||||||
rc = ND_Deallocator_Exec( MHH, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
rc = ND_Deallocator_Exec( MHH, SM_Base->MHR, SM_Base->MHR->Deallocator_Name, SM_Base->MHR->Deallocator_Ptr, NULL);
|
||||||
if( rc != SMS_OK)
|
if( rc != SMS_OK)
|
||||||
{
|
{
|
||||||
LG_LOG_ERROR_1( "Unable to free the header of heap: [%s]", MHH->Name);
|
LG_LOG_ERROR_1( "Unable to free the header of heap: [%s]", MHH->Name);
|
||||||
@ -4187,7 +4187,7 @@ NDT_Status SM_DSR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
|
|||||||
|
|
||||||
/* Création de l'entête */
|
/* Création de l'entête */
|
||||||
|
|
||||||
if( ND_Allocator_Exec( (void **)DSH_Ptr_Ptr, sizeof (SMT_DSH), MHH_Ptr->DSR->Allocator_Name, MHH_Ptr->DSR->Allocator_Ptr, NULL) != NDS_OK)
|
if( ND_Allocator_Exec( (void **)DSH_Ptr_Ptr, MHH_Ptr->DSR, sizeof (SMT_DSH), MHH_Ptr->DSR->Allocator_Name, MHH_Ptr->DSR->Allocator_Ptr, NULL) != NDS_OK)
|
||||||
{
|
{
|
||||||
LG_LOG_ERROR_0( "Unable to allocate memory for the new data segment header");
|
LG_LOG_ERROR_0( "Unable to allocate memory for the new data segment header");
|
||||||
|
|
||||||
@ -4225,7 +4225,7 @@ NDT_Status SM_DSR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ND_Deallocator_Exec( ( *DSH_Ptr_Ptr), MHH_Ptr->DSR->Deallocator_Name, MHH_Ptr->DSR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( ( *DSH_Ptr_Ptr), MHH_Ptr->DSR, MHH_Ptr->DSR->Deallocator_Name, MHH_Ptr->DSR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
return( NDS_KO);
|
return( NDS_KO);
|
||||||
}
|
}
|
||||||
@ -4244,7 +4244,7 @@ NDT_Status SM_DSR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
|
|||||||
|
|
||||||
shmctl( ( *DSH_Ptr_Ptr)->MemId, IPC_RMID, 0);
|
shmctl( ( *DSH_Ptr_Ptr)->MemId, IPC_RMID, 0);
|
||||||
|
|
||||||
ND_Deallocator_Exec( *DSH_Ptr_Ptr, MHH_Ptr->DSR->Deallocator_Name, MHH_Ptr->DSR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( *DSH_Ptr_Ptr, MHH_Ptr->DSR, MHH_Ptr->DSR->Deallocator_Name, MHH_Ptr->DSR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
return( NDS_KO);
|
return( NDS_KO);
|
||||||
}
|
}
|
||||||
@ -4278,7 +4278,7 @@ NDT_Status SM_DSR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
|
|||||||
|
|
||||||
shmctl ( ( *DSH_Ptr_Ptr)->MemId, IPC_RMID, 0);
|
shmctl ( ( *DSH_Ptr_Ptr)->MemId, IPC_RMID, 0);
|
||||||
|
|
||||||
ND_Deallocator_Exec( ( *DSH_Ptr_Ptr), MHH_Ptr->DSR->Deallocator_Name, MHH_Ptr->DSR->Deallocator_Ptr, NULL);
|
ND_Deallocator_Exec( ( *DSH_Ptr_Ptr), MHH_Ptr->DSR, MHH_Ptr->DSR->Deallocator_Name, MHH_Ptr->DSR->Deallocator_Ptr, NULL);
|
||||||
|
|
||||||
return( NDS_KO);
|
return( NDS_KO);
|
||||||
}
|
}
|
||||||
@ -4337,7 +4337,7 @@ NDT_Status SM_DSR_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node
|
|||||||
|
|
||||||
/* Désallocation de l'entête */
|
/* Désallocation de l'entête */
|
||||||
|
|
||||||
rc = ND_Deallocator_Exec( DSH_Ptr, Root_Ptr->Deallocator_Name, Root_Ptr->Deallocator_Ptr, NULL);
|
rc = ND_Deallocator_Exec( DSH_Ptr, Root_Ptr, Root_Ptr->Deallocator_Name, Root_Ptr->Deallocator_Ptr, NULL);
|
||||||
if( rc != NDS_OK)
|
if( rc != NDS_OK)
|
||||||
{
|
{
|
||||||
LG_LOG_ERROR_0( "The data segment header is nul");
|
LG_LOG_ERROR_0( "The data segment header is nul");
|
||||||
@ -5575,7 +5575,7 @@ SMT_Status SM_Name_Prefix( char *Prefixed, const char *Unprefixed)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf( Prefixed, SMD_NAME_LEN, "%s/%s", SM_Context, Unprefixed);
|
snprintf( Prefixed, SMD_NAME_SIZE, "%s/%s", SM_Context, Unprefixed);
|
||||||
}
|
}
|
||||||
|
|
||||||
return( SMS_OK);
|
return( SMS_OK);
|
||||||
|
@ -188,7 +188,7 @@ typedef union semun
|
|||||||
/* Allocation de mémoire dans la base */
|
/* Allocation de mémoire dans la base */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NDT_Status SM_Base_Alloc( void **, size_t, void *);
|
NDT_Status SM_Base_Alloc( void **, NDT_Root *ND_Root_Ptr, size_t, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ NDT_Status SM_Base_Alloc( void **, size_t, void *);
|
|||||||
/* Désallocation de mémoire dans la base */
|
/* Désallocation de mémoire dans la base */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NDT_Status SM_Base_Free( void *, void *);
|
NDT_Status SM_Base_Free( void *, NDT_Root *ND_Root_Ptr, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ NDT_Status SM_Base_Free( void *, void *);
|
|||||||
/* Allocation de mémoire dans le heap système */
|
/* Allocation de mémoire dans le heap système */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NDT_Status SM_System_Alloc( void **, size_t, void *);
|
NDT_Status SM_System_Alloc( void **, NDT_Root *ND_Root_Ptr, size_t, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ NDT_Status SM_System_Alloc( void **, size_t, void *);
|
|||||||
/* Désallocation de mémoire dans le heap système */
|
/* Désallocation de mémoire dans le heap système */
|
||||||
/*------------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
NDT_Status SM_System_Free( void *, void *);
|
NDT_Status SM_System_Free( void *, NDT_Root *ND_Root_Ptr, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user