📄 fs50opendir.c
字号:
#ifdef FSS_FTR#define ACCESS_RIGHTS_INTERNAL_FS#define FS50OPENDIR_C#include "Fs.h"#undef FILE_NUMBER#define FILE_NUMBER 50 #undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 1void Fs50_01OpenDir( void * pp_Param ){ t_FsCmdOpenDir * pl_Param = (t_FsCmdOpenDir *) pp_Param; fsPath * pl_RestOfPath; /* Point in the path after the volume name or if the current path is available pointer on it */ t_ObjectInfo sl_Info; t_fsEntityStruct * pl_FsEntityPtr; /* Pointer on entity's CB */ t_fsDIR * pl_DirPtr; /* Pointer on directory structure */ void * pl_FmPrivateDirInfo; /* Pointer on private directory information */ t_fsVolStruct * pl_Volume; /* Get entity's context pointer */ pl_FsEntityPtr = MC_FS_ED_GET_ENTITY_PTR( MC_FS_KERNEL_ID(pl_Param) ); /* Get volume of object */ pl_Volume = MC_FS_CO_GIVE_VOLUME_FROM_PATH ( pl_FsEntityPtr, ( fsPath*) pl_Param->p_DirName, &pl_RestOfPath, &sl_Info, &MC_FS_STATUS(pl_Param)); /* If no volume return ( status was update by function ) */ if ( pl_Volume == NIL ) return; /* Set the interlayer table pointer */ MC_FS_LL_SET_NEW_VOL(pl_Volume); /* Take info on object ( dir exist, object exist, ...) at low layers */ MC_FS_LL_GET_OBJECT_INFO (&sl_Info, pl_RestOfPath, &MC_FS_STATUS(pl_Param)); /* If an error in info get return */ if ( MC_FS_STATUS(pl_Param) != FS_OK ) return; /* This file exist do not exist -> error */ if ( sl_Info.s_FileStatus.v_ObjExist == FALSE) { /* Updates status in interface structure and return */ MC_FS_STATUS(pl_Param) = FS_ENOENT; return; } /* If the object is not a directory -> err */ if ( sl_Info.s_FileStatus.v_ObjIsFile ) { /* Object is a file and not a directory error */ MC_FS_STATUS(pl_Param) = FS_ENOTDIR; return; } /* open dir on lower layers */ MC_FS_LL_OPEN_DIR( &sl_Info, &pl_FmPrivateDirInfo, &MC_FS_STATUS(pl_Param)); /* If an error in open dir return */ if ( MC_FS_STATUS(pl_Param) != FS_OK ) return; /* If no error get the directory structure */ pl_DirPtr = ( t_fsDIR *) MC_FS_GET_MEMORY( sizeof ( t_fsDIR ) ); /* Update volume of directory */ pl_DirPtr->p_VolOfDir = pl_Volume; /* Updates ID of directory */ pl_DirPtr->v_DirID = sl_Info.v_ObjID; /* In this structure update pointer on private info */ pl_DirPtr->p_FmPrivateDirInfo = pl_FmPrivateDirInfo; /* Update status of position to first element to read */ pl_DirPtr->v_PosStatus = FS_FIRST_DIR; /* Update directory pattern */ pl_DirPtr->v_Pattern = FS_DIR_PATTERN; /* Insert file in entities list */ MC_FS_ED_INSERT_DIR( pl_FsEntityPtr, pl_DirPtr ); /* Insert file in the volume list */ MC_FS_VD_INSERT_DIR_IN_VOL( pl_Volume, pl_DirPtr ); /* Update file pointer in interface data structure */ pl_Param->p_DirPtr = pl_DirPtr;}#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 2u32 Fs50_02ProcessOpenDir( const fsPath * pp_DirName ){ /* Reserve message space */ t_FsCmdOpenDir * pl_OpenDir = (t_FsCmdOpenDir *) MC_FS_GET_MEMORY(sizeof(t_FsCmdOpenDir)); /* Fill message with input parameters */ pl_OpenDir->p_DirName = pp_DirName; /* Send message by setting operation and return command identifier */ return( MC_FS_MA_SEND_CMD_MSG_TO_FS(FS_WITH_ACK, (void*)pl_OpenDir,FS_CMD_OPENDIR_REQ));}#endif /* FSS_FTR */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -