- Start a new ndbench implementation, based on ndbench,
- Implement DS_Index_Open_I(), DS_Index_Close_I(), DS_Index_Convert_I(), - Convert DST_DataStruct.Name from pointer to array.
This commit is contained in:
parent
813967de98
commit
42ab4c9029
@ -177,6 +177,7 @@ typedef struct DST_RootDesc
|
||||
# define DS_Library_Open DS_Library_Open_I
|
||||
# define DS_Library_Close DS_Library_Close_I
|
||||
# define DS_Library_Stderr_Set DS_Library_Stderr_Set_I
|
||||
|
||||
# define DS_DataStruct_Open DS_DataStruct_Open_I
|
||||
# define DS_DataStruct_Close DS_DataStruct_Close_I
|
||||
# define DS_DataStruct_Reorg DS_DataStruct_Reorg_I
|
||||
@ -188,6 +189,11 @@ typedef struct DST_RootDesc
|
||||
# define DS_DataStruct_Check DS_DataStruct_Check_I
|
||||
# define DS_DataStruct_Lock DS_DataStruct_Lock_I
|
||||
# define DS_DataStruct_Unlock DS_DataStruct_Unlock_I
|
||||
|
||||
# define DS_Index_Open DS_Index_Open_I
|
||||
# define DS_Index_Close DS_Index_Close_I
|
||||
# define DS_Index_Convert DS_Index_Convert_I
|
||||
|
||||
# define DS_Node_Root_Get DS_Node_Root_Get_I
|
||||
# define DS_Node_First_Get DS_Node_First_Get_I
|
||||
# define DS_Node_Last_Get DS_Node_Last_Get_I
|
||||
@ -196,10 +202,12 @@ typedef struct DST_RootDesc
|
||||
# define DS_Node_Add DS_Node_Add_I
|
||||
# define DS_Node_Remove DS_Node_Remove_I
|
||||
# define DS_Node_Find DS_Node_Find_I
|
||||
|
||||
# define DS_Value_Alloc DS_Value_Alloc_I
|
||||
# define DS_Value_Add DS_Value_Add_I
|
||||
# define DS_Value_Remove DS_Value_Remove_I
|
||||
# define DS_Value_Free DS_Value_Free_I
|
||||
|
||||
# define DS_Alloc DS_Alloc_I
|
||||
# define DS_Free DS_Free_I
|
||||
|
||||
@ -213,6 +221,7 @@ typedef struct DST_RootDesc
|
||||
# define DS_Library_Open DS_Library_Open_L
|
||||
# define DS_Library_Close DS_Library_Close_L
|
||||
# define DS_Library_Stderr_Set DS_Library_Stderr_Set_L
|
||||
|
||||
# define DS_DataStruct_Open DS_DataStruct_Open_L
|
||||
# define DS_DataStruct_Close DS_DataStruct_Close_L
|
||||
# define DS_DataStruct_Reorg DS_DataStruct_Reorg_L
|
||||
@ -224,6 +233,11 @@ typedef struct DST_RootDesc
|
||||
# define DS_DataStruct_Check DS_DataStruct_Check_L
|
||||
# define DS_DataStruct_Lock DS_DataStruct_Lock_L
|
||||
# define DS_DataStruct_Unlock DS_DataStruct_Unlock_L
|
||||
|
||||
# define DS_Index_Open DS_Index_Open_L
|
||||
# define DS_Index_Close DS_Index_Close_L
|
||||
# define DS_Index_Convert DS_Index_Convert_L
|
||||
|
||||
# define DS_Node_Root_Get DS_Node_Root_Get_L
|
||||
# define DS_Node_First_Get DS_Node_First_Get_L
|
||||
# define DS_Node_Last_Get DS_Node_Last_Get_L
|
||||
@ -232,10 +246,12 @@ typedef struct DST_RootDesc
|
||||
# define DS_Node_Add DS_Node_Add_L
|
||||
# define DS_Node_Remove DS_Node_Remove_L
|
||||
# define DS_Node_Find DS_Node_Find_L
|
||||
|
||||
# define DS_Value_Alloc DS_Value_Alloc_L
|
||||
# define DS_Value_Add DS_Value_Add_L
|
||||
# define DS_Value_Remove DS_Value_Remove_L
|
||||
# define DS_Value_Free DS_Value_Free_L
|
||||
|
||||
# define DS_Alloc DS_Alloc_L
|
||||
# define DS_Free DS_Free_L
|
||||
|
||||
@ -249,6 +265,7 @@ typedef struct DST_RootDesc
|
||||
# define DS_Library_Open DS_Library_Open_CL
|
||||
# define DS_Library_Close DS_Library_Close_CL
|
||||
# define DS_Library_Stderr_Set DS_Library_Stderr_Set_CL
|
||||
|
||||
# define DS_DataStruct_Open DS_DataStruct_Open_CL
|
||||
# define DS_DataStruct_Close DS_DataStruct_Close_CL
|
||||
# define DS_DataStruct_Reorg DS_DataStruct_Reorg_CL
|
||||
@ -260,6 +277,11 @@ typedef struct DST_RootDesc
|
||||
# define DS_DataStruct_Check DS_DataStruct_Check_CL
|
||||
# define DS_DataStruct_Lock DS_DataStruct_Lock_CL
|
||||
# define DS_DataStruct_Unlock DS_DataStruct_Unlock_CL
|
||||
|
||||
# define DS_Index_Open DS_Index_Open_CL
|
||||
# define DS_Index_Close DS_Index_Close_CL
|
||||
# define DS_Index_Convert DS_Index_Convert_CL
|
||||
|
||||
# define DS_Node_Root_Get DS_Node_Root_Get_CL
|
||||
# define DS_Node_First_Get DS_Node_First_Get_CL
|
||||
# define DS_Node_Last_Get DS_Node_Last_Get_CL
|
||||
@ -268,10 +290,12 @@ typedef struct DST_RootDesc
|
||||
# define DS_Node_Add DS_Node_Add_CL
|
||||
# define DS_Node_Remove DS_Node_Remove_CL
|
||||
# define DS_Node_Find DS_Node_Find_CL
|
||||
|
||||
# define DS_Value_Alloc DS_Value_Alloc_CL
|
||||
# define DS_Value_Add DS_Value_Add_CL
|
||||
# define DS_Value_Remove DS_Value_Remove_CL
|
||||
# define DS_Value_Free DS_Value_Free_CL
|
||||
|
||||
# define DS_Alloc DS_Alloc_CL
|
||||
# define DS_Free DS_Free_CL
|
||||
|
||||
@ -396,11 +420,14 @@ DSD_API DST_Status DS_DataStruct_Close_CL( NDT_Root *Root_Ptr, DST_Flags Clo
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Stream: Output stream */
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Recursive_Mode: Child or Parent */
|
||||
/* (I) Recursive_Depth: Curent recursion depth */
|
||||
/* (I) Recursive_Offset: Curent print out offset */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DSD_API DST_Status DS_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr);
|
||||
DSD_API DST_Status DS_DataStruct_Info_Print_L( FILE *Out, NDT_Root *Root_Ptr);
|
||||
DSD_API DST_Status DS_DataStruct_Info_Print_CL( FILE *Out, NDT_Root *Root_Ptr);
|
||||
DSD_API DST_Status DS_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset);
|
||||
DSD_API DST_Status DS_DataStruct_Info_Print_L( FILE *Out, NDT_Root *Root_Ptr, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset);
|
||||
DSD_API DST_Status DS_DataStruct_Info_Print_CL( FILE *Out, NDT_Root *Root_Ptr, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset);
|
||||
|
||||
|
||||
|
||||
@ -491,6 +518,47 @@ DSD_API DST_Status DS_DataStruct_Value_Print_CL( FILE *Out_Ptr, NDT_Root *Roo
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Create a new index */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Index_Id: Id of the index */
|
||||
/* (I) Index_Type: Index type (List, tree, ...) */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DSD_API NDT_Status DS_Index_Open_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Index_Type Index_Type);
|
||||
DSD_API NDT_Status DS_Index_Open_L( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Index_Type Index_Type);
|
||||
DSD_API NDT_Status DS_Index_Open_CL( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Index_Type Index_Type);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Remove an Index */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Index_Id: Id of the index */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DSD_API NDT_Status DS_Index_Close_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id);
|
||||
DSD_API NDT_Status DS_Index_Close_L( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id);
|
||||
DSD_API NDT_Status DS_Index_Close_CL( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Convert a data structure index to another type */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Index_Id: Id of the index */
|
||||
/* (I) Index_Type: Index type (List, tree, ...) */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DSD_API NDT_Status DS_Index_Convert_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Index_Type Index_Type);
|
||||
DSD_API NDT_Status DS_Index_Convert_L( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Index_Type Index_Type);
|
||||
DSD_API NDT_Status DS_Index_Convert_CL( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Index_Type Index_Type);
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Récupération du premier noeud d'une structure */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
125
lib/libdatastr.c
125
lib/libdatastr.c
@ -563,7 +563,7 @@ Strange: why end the heap here ?
|
||||
|
||||
/* On ajoute la data structure à la liste des structures ouvertes par le processus courant */
|
||||
|
||||
if( ( nd_status = ND_Value_Alloc( (void **)&opened_datastruct_ptr, OpenedDS_List, DS_Name, Root_Ptr_Ptr)) != NDS_OK)
|
||||
if( ( nd_status = ND_Value_Alloc( (void **)&opened_datastruct_ptr, OpenedDS_List, DS_Name, *Root_Ptr_Ptr)) != NDS_OK)
|
||||
{
|
||||
LG_LOG_ERROR_2( "Unable to alloc a new opened data structure element: [%s], status: (%d)", DS_Name, nd_status);
|
||||
|
||||
@ -882,9 +882,9 @@ DST_Status DS_DataStruct_Close_I( NDT_Root *Root_Ptr, DST_Flags Close_Mode)
|
||||
|
||||
/* Suppression de la data structure de la liste des structures ouvertes */
|
||||
|
||||
to_remove.Name = ds_name;
|
||||
strncpy( to_remove.Name, ds_name, DSD_NAME_LEN);
|
||||
|
||||
if( ( nd_status = ND_DataStruct_Value_Find( ( void **)&opened_datastruct_ptr, OpenedDS_List, &to_remove)) != NDS_OK)
|
||||
if( ( ( nd_status = ND_DataStruct_Value_Find( ( void **)&opened_datastruct_ptr, OpenedDS_List, &to_remove)) != NDS_OK) || ( opened_datastruct_ptr == NULL))
|
||||
{
|
||||
LG_LOG_ERROR_2( "Unable to find data struct element: [%s] from opened structure list, status: (%d)", ds_name, nd_status);
|
||||
|
||||
@ -919,9 +919,12 @@ DST_Status DS_DataStruct_Close_I( NDT_Root *Root_Ptr, DST_Flags Close_Mode)
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Stream: Output stream */
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Recursive_Mode: Child or Parent */
|
||||
/* (I) Recursive_Depth: Curent recursion depth */
|
||||
/* (I) Recursive_Offset: Curent print out offset */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
DST_Status DS_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr)
|
||||
DST_Status DS_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr, NDT_Recursive_Mode Recursive_Mode, NDT_Recursive_Depth Recursive_Depth, NDT_Recursive_Offset Recursive_Offset)
|
||||
{
|
||||
DST_RootDesc *RootDesc_Ptr = (DST_RootDesc *)( Root_Ptr->User_Ptr);
|
||||
|
||||
@ -957,7 +960,7 @@ DST_Status DS_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr)
|
||||
|
||||
/* Affichage des informations sur la structure */
|
||||
|
||||
if( ( nd_status = ND_DataStruct_Info_Print( Out, Root_Ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 99, 0)) != NDS_OK)
|
||||
if( ( nd_status = ND_DataStruct_Info_Print( Out, Root_Ptr, Recursive_Mode, Recursive_Depth, Recursive_Offset)) != NDS_OK)
|
||||
{
|
||||
LG_LOG_ERROR_1( "Unable to print info about the data structure: (%d)", nd_status);
|
||||
|
||||
@ -965,6 +968,24 @@ DST_Status DS_DataStruct_Info_Print_I( FILE *Out, NDT_Root *Root_Ptr)
|
||||
}
|
||||
|
||||
|
||||
/* Opened DS Print */
|
||||
|
||||
if( ( nd_status = ND_DataStruct_Info_Print( Out, OpenedDS_List, Recursive_Mode, Recursive_Depth, Recursive_Offset)) != NDS_OK)
|
||||
{
|
||||
LG_LOG_ERROR_1( "Unable to print info about the data structure: (%d)", nd_status);
|
||||
|
||||
return( DSS_KO);
|
||||
}
|
||||
|
||||
|
||||
if( ( nd_status = ND_DataStruct_Value_Print( Out, OpenedDS_List, Recursive_Mode, Recursive_Depth, Recursive_Offset)) != NDS_OK)
|
||||
{
|
||||
LG_LOG_ERROR_1( "Unable to print values about the data structure: (%d)", nd_status);
|
||||
|
||||
return( DSS_KO);
|
||||
}
|
||||
|
||||
|
||||
/* Dump SM */
|
||||
|
||||
SM_Library_Dump( stderr);
|
||||
@ -1319,6 +1340,92 @@ DST_Status DS_DataStruct_Value_Print_I( FILE *Out_Ptr, NDT_Root *Root_Ptr, ND
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Create a new index */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Index_Id: Id of the index */
|
||||
/* (I) Index_Type: Index type (List, tree, ...) */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
NDT_Status DS_Index_Open_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Index_Type Index_Type)
|
||||
{
|
||||
NDT_Status nd_status;
|
||||
|
||||
|
||||
if( ( nd_status = ND_Index_Open_I( Root_Ptr, Index_Id, Index_Type)) != NDS_OK)
|
||||
{
|
||||
LG_LOG_ERROR_2( "Unable to open index: (%d), status: (%d)", Index_Id, nd_status);
|
||||
|
||||
return( DSS_KO);
|
||||
}
|
||||
else
|
||||
{
|
||||
return( DSS_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Remove an Index */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Index_Id: Id of the index */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
NDT_Status DS_Index_Close_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id)
|
||||
{
|
||||
NDT_Status nd_status;
|
||||
|
||||
|
||||
if( ( nd_status = ND_Index_Close_I( Root_Ptr, Index_Id)) != NDS_OK)
|
||||
{
|
||||
LG_LOG_ERROR_2( "Unable to close index: (%d), status: (%d)", Index_Id, nd_status);
|
||||
|
||||
return( DSS_KO);
|
||||
}
|
||||
else
|
||||
{
|
||||
return( DSS_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Convert a data structure index to another type */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* (I) Root_Ptr: Data structure pointer */
|
||||
/* (I) Index_Id: Id of the index */
|
||||
/* (I) Index_Type: Index type (List, tree, ...) */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
NDT_Status DS_Index_Convert_I( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Index_Type Index_Type)
|
||||
{
|
||||
NDT_Status nd_status;
|
||||
|
||||
|
||||
if( ( nd_status = ND_Index_Convert_I( Root_Ptr, Index_Id, Index_Type)) != NDS_OK)
|
||||
{
|
||||
LG_LOG_ERROR_2( "Unable to convert index: (%d), status: (%d)", Index_Id, nd_status);
|
||||
|
||||
return( DSS_KO);
|
||||
}
|
||||
else
|
||||
{
|
||||
return( DSS_OK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Récupération du premier noeud d'une structure */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@ -3207,7 +3314,7 @@ DST_Status DS_DataStruct_IsOpen( NDT_Root **Root_Ptr_Ptr, char *DS_Name)
|
||||
DST_DataStruct to_find, *found_ptr;
|
||||
|
||||
|
||||
to_find.Name = DS_Name;
|
||||
strncpy( to_find.Name, DS_Name, DSD_NAME_LEN);
|
||||
|
||||
if( ( nd_status = ND_DataStruct_Value_Find( (void **)&found_ptr, OpenedDS_List, &to_find)) != NDS_OK)
|
||||
{
|
||||
@ -3629,7 +3736,7 @@ NDT_Status DS_OpenedDS_List_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id
|
||||
|
||||
LG_LOG_TRACE_1( LGD_LOG_LEVEL_DEFAULT, "Command: [%s] called", Command_Name);
|
||||
|
||||
if( ( *Opened_DataStruct_Ptr_Ptr = (DST_DataStruct *)malloc( sizeof( DST_DataStruct))) == NULL)
|
||||
if( ( *Opened_DataStruct_Ptr_Ptr = ( DST_DataStruct *)malloc( sizeof( DST_DataStruct))) == NULL)
|
||||
{
|
||||
LG_LOG_ERROR_1( "Can't allocate value zise: (%d)", sizeof( DST_DataStruct));
|
||||
|
||||
@ -3637,9 +3744,11 @@ NDT_Status DS_OpenedDS_List_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id
|
||||
}
|
||||
else
|
||||
{
|
||||
( *Opened_DataStruct_Ptr_Ptr)->Name = DS_Name;
|
||||
strncpy( ( *Opened_DataStruct_Ptr_Ptr)->Name, DS_Name, DSD_NAME_LEN);
|
||||
( *Opened_DataStruct_Ptr_Ptr)->Root_Ptr = Root_Ptr;
|
||||
|
||||
LG_LOG_TRACE_2( LGD_LOG_LEVEL_DEFAULT, "Allocate new DS: Name: [%s] Root_Ptr: (%p)", DS_Name, Root_Ptr);
|
||||
|
||||
return( DSS_OK);
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ NDT_Root *OpenedDS_List;
|
||||
|
||||
typedef struct DST_DataStruct
|
||||
{
|
||||
char *Name;
|
||||
char Name[ DSD_NAME_SIZE];
|
||||
NDT_Root *Root_Ptr;
|
||||
} DST_DataStruct;
|
||||
|
||||
|
1721
util/dsbench.c
1721
util/dsbench.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user