📄 fs47rmdir.c
字号:
#ifdef FSS_FTR#define ACCESS_RIGHTS_INTERNAL_FS#define FS47RMDIR_C#include "Fs.h"#undef FILE_NUMBER#define FILE_NUMBER 47 #undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 1void Fs47_01RmDir( void * pp_Param ){ t_FsCmdRmDir * pl_Param = (t_FsCmdRmDir *) 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_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_Path, &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; /* See if the directory which will contains the file exist ( this is needed because it is not possible to delete the volume -> err is ENOENT ) */ if ( sl_Info.s_FileStatus.v_DirExist == FALSE ) { /* Updates status in interface structure and return */ MC_FS_STATUS(pl_Param) = FS_ENOENT; return; } /* This file 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; } /* If directory not empty set a non empty error */ if ( sl_Info.s_FileStatus.v_ObjIsEmpty == FALSE ) { /* Object is a file and not a directory error */ MC_FS_STATUS(pl_Param) = FS_ENOTEMPTY; return; } /* If directory is open it can't be deleted */ if ( MC_FS_CO_VERIFY_IF_DIR_OPEN(pl_Volume, sl_Info.v_ObjID ) == TRUE ) { /* Object is a file and not a directory error */ MC_FS_STATUS(pl_Param) = FS_EBUSY; return; } /* Invalid all entity's current paths which point on this directory */ MC_FS_ED_INVALID_CURRENT_DIR( pl_Volume, sl_Info.v_ObjID); /* Remove this object through lower layers ( FM ) */ MC_FS_LL_REMOVE_FILE( &sl_Info, &MC_FS_STATUS(pl_Param) );}#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 2u32 Fs47_02ProcessRmDir( u8 vp_Behaviour, const fsPath * pp_Path ){ /* Reserve message space */ t_FsCmdRmDir * pl_RmDir = (t_FsCmdRmDir*) MC_FS_GET_MEMORY(sizeof(t_FsCmdRmDir)); /* Fill message with input parameters */ pl_RmDir->p_Path = pp_Path; /* Send message by setting operation and return command identifier */ return( MC_FS_MA_SEND_CMD_MSG_TO_FS(vp_Behaviour, (void*)pl_RmDir,FS_CMD_RMDIR_REQ));}#endif /* FSS_FTR */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -