📄 fs80entitydata.c
字号:
p_Srce = p_Dst - 1; do { p_Dst->v_RtkID = p_Srce->v_RtkID; p_Dst->v_FsID = p_Srce->v_FsID; p_Dst--; p_Srce--; } while ( -- vl_Size == 0 ); } /* Increment number of entity's */ s_EntityDataBaseStruct.v_NbrEntitys++; /* Place RTK-Id in table */ p_Id[vp_InsertIndex].v_RtkID = vp_RtkId; p_Id[vp_InsertIndex].v_FsID = vl_FsEntityId; /* Updates beginning index */ s_EntityDataBaseStruct.v_BeginningIndex = Fs05_01DetermineDichoBeginIndex (s_EntityDataBaseStruct.v_NbrEntitys); }}/**//*P(***************************************************************************//* Procedure name : Fs80_04EDDeleteEntity *//* Object : Delete an entity from entitys' data *//*----------------------------------------------------------------------------*//* Input parameters : *//* ------------------- *//* t_RtkID vp_RtkId : Real time kernel's entity ID *//* *//* *//* Output parameters : *//* ------------------- *//* *//* Used variables : *//* ------------------- *//* *//* *//* Used procedures : *//* ------------------- *//* *//* *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//* DESCRIPTION *//* *//* Deletes the entity from entitys' data, for this: *//* - releases path attached to the entity *//* - releases entity's CB *//* - suppress entity from the RTK to FS ID translation table *//* - suppress entity form the entitys' pointer table *//* indexed by Fs ID *//* *//* WARNING: File and Dir structures attached to the entity are not *//* released, this is to make before calling *//* of this procedure *//* *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 4void Fs80_04EDDeleteEntity( t_RtkID vp_RtkId ){ u16 vl_IndexInTable; t_fsEntityStruct * pl_Entity; u16 vl_FsID = 0; /* Suppress entity in translation table */ { /* Load address of table who is indexed by volume ID */ t_IDTranslStruct * p_IDPtr = s_EntityDataBaseStruct.p_TabTranslRtkFs; u16 vl_NbrEntitys = s_EntityDataBaseStruct.v_NbrEntitys; /* Search position in translation table */ for ( vl_IndexInTable = 0 ; vl_IndexInTable < vl_NbrEntitys; vl_IndexInTable++) { if ( p_IDPtr->v_RtkID == vp_RtkId ) { /* Note FS ID to prepare delete in entity pointer table indexed by FS ID */ vl_FsID = p_IDPtr->v_FsID; /* If it is not the last table entry, end of table is to shift */ if ( vl_IndexInTable != s_EntityDataBaseStruct.v_NbrEntitys - 1 ) { /* End of table is to shift */ memcpy( p_IDPtr+1, p_IDPtr, (vl_NbrEntitys - vl_IndexInTable - 1) * sizeof (t_IDTranslStruct)); } /* Decrement number of volumes mounted */ s_EntityDataBaseStruct.v_NbrEntitys--; break; } /* point on next entry in table */ p_IDPtr++; } } /* Point on entity's structure */ pl_Entity = s_EntityDataBaseStruct.p_EntityIndexedByFsId[vl_FsID]; /* Release entity's path if exist */ if ( pl_Entity -> p_Path != 0 ) MC_FS_FREE_MEMORY(pl_Entity -> p_Path); /* Release entity's structure */ MC_FS_FREE_MEMORY(pl_Entity); /* Suppress entity in entity pointer table */ s_EntityDataBaseStruct.p_EntityIndexedByFsId[vl_FsID] = 0; /* Decrement number of entitys */ s_EntityDataBaseStruct.v_NbrEntitys--; /* Updates beginning index */ s_EntityDataBaseStruct.v_BeginningIndex = Fs05_01DetermineDichoBeginIndex (s_EntityDataBaseStruct.v_NbrEntitys);}/**//*P(***************************************************************************//* Procedure name : Fs80_05EDMemorizePath *//* Object : Memorize the new path in Entity's data structure *//*----------------------------------------------------------------------------*//* Input parameters : *//* ------------------- *//* s_fs_Entity p_Entity : A pointer on the structure of the entity *//* to update *//* *//* ascii * p_Path : A pointer on the new path string *//* *//* Output parameters : *//* ------------------- *//* returned value: none *//* *//* Used variables : *//* ------------------- *//* v_Rtk_PoolDroit: acces right of different pools *//* *//* Used procedures : *//* ------------------- *//* *//* *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//* DESCRIPTION *//* *//* This primitive memorize the new path in entity's structure *//* *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 5void Fs80_05EDMemorizePath ( t_fsEntityStruct * pp_Entity, t_EntityPathInfo * pp_EntityPathInfo ){ /* If an old path exist release it */ if ( pp_Entity -> p_Path != 0 ) MC_FS_FREE_MEMORY( pp_Entity -> p_Path ); /* Else reserve memory to receive string */ pp_Entity -> p_Path = (ascii *) MC_FS_GET_MEMORY ( pp_EntityPathInfo->v_PathLenght + 1 ); /* Update path lenght */ pp_Entity->v_PathLenght = pp_EntityPathInfo->v_PathLenght; /* Update directory IDs, existence flags and volume pointer */ pp_Entity->v_CurrentDirIDLevelN = pp_EntityPathInfo->v_CurrentDirIDLevelN; pp_Entity->v_CurrentDirIDLevelN_1 = pp_EntityPathInfo->v_CurrentDirIDLevelN_1; pp_Entity->v_DirLevelNExist = pp_EntityPathInfo->v_DirLevelNExist; pp_Entity->v_DirLevelN_1Exist = pp_EntityPathInfo->v_DirLevelN_1Exist; pp_Entity->p_CurrentVolume = pp_EntityPathInfo->p_CurrVolume; pp_Entity -> v_CurrPathValid = TRUE; /* And transfer path in it */ strcpy ( pp_Entity->p_Path, pp_EntityPathInfo->p_Path );}/**//*P(***************************************************************************//* Procedure name : Fs80_06EDGetPath *//* Object : Copy current path in destination buffer *//*----------------------------------------------------------------------------*//* Input parameters : *//* ------------------- *//* t_fsEntityStruct * pp_Entity: Pointer on entity's CB which path is *//* is getted *//* ascii *pp_Dest: Pointer on destination buffer of path */ /* u16 vp_BuffSize: Size of destination buffer *//* *//* *//* Output parameters : *//* ------------------- *//* returned value: - FALSE if destination buffer too small to receive *//* totality of path *//* - TRUE if enough place in destination buffer and path *//* copied *//* *//* Used variables : *//* ------------------- *//* *//* *//* Used procedures : *//* ------------------- *//* *//* *//*----------------------------------------------------------------------------*//*----------------------------------------------------------------------------*//* DESCRIPTION *//* *//* This primitive transfers current path of an entity in a destination buffer *//* If not enough place in buffer FALSE is returned *//* else path is copied in destination buffer and TRUE is returned *//* *//*----------------------------------------------------------------------------*//***************************************************************************)P*//* #*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 6u8 Fs80_06EDGetPath ( t_fsEntityStruct * pp_Entity, ascii *pp_Dest, u16 vp_BuffSize ){ /* Suppose status is not OK */ u16 vl_Status = FALSE; /* Determine if enough place in buffer to transfer totality of path */ if ( vp_BuffSize >= pp_Entity->v_PathLenght+1 ) { /* Enough place in buffer ->copy path in destination buffer + \0*/ strncpy (pp_Dest, pp_Entity->p_Path, pp_Entity->v_PathLenght+1); /* Set status to OK */ vl_Status = TRUE; } return (vl_Status); } /**//*P(***************************************************************************//* Procedure name : Fs80_07EDGetEntityPointer *//* Object : Returns a pointer on the fs control block of the entity *//*----------------------------------------------------------------------------*//* Input parameters : *//* ------------------- *//* vp_RtkId : RTK-E identifier of the entity *//* *//* *//* Output parameters : *//* ------------------- *//* returned value: t_fsEntityStruct * Pointer on the fs entity's *//* control block *//* *//* Used variables : *//* ------------------- *//* *//* *//* Used procedures : *//* ------------------- *//* *//* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -