⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fs58setsize.c

📁 我今天开始上传5份TI、NXP、MTK的手机开发全套资料。希望对大家有很大的帮助
💻 C
字号:
#ifdef FSS_FTR/***************************************************************************** ........................................................................                COPYRIGHT (c) Philips Semiconductors Nuremberg 2003    ..     All rights are reserved. Reproduction in whole or in part is      ..     prohibited without the written consent of the copyright owner.    . ......................................................................... File name :    Fs58SetSize.c.. Project :      SSYOL3 WAP/MMS.. Module :       OSFS.. %version:      4 %.. Compiler name and release:...............:........:..........:............:...............................* *----------------------------------------------------------------------------* *                              DESCRIPTION *                   SET THE SIZE OF A FILE TO A NEW SIZE *                     (EITHER EXTENDING OR TRUNCATING) *                       *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* *                           FUNCTIONS DEFINED IN THIS FILE *----------------------------------------------------------------------------* * Name                                 | Object *----------------------------------------------------------------------------* * Fs58_01SetSize                       |  SetSize function  * Fs58_02ProcessSetSize                |  send request for setsize to FSS *----------------------------------------------------------------------------* *                                    EVOLUTION *----------------------------------------------------------------------------* * Date      | Author      | Description *----------------------------------------------------------------------------* * 29.01.02  | L. KEANE    |  Creation * 13.03.03  | tcmc_sgp    |  implementation * 31.03.03  | tcmc_sgp    |  addition of exception handle and commments *----------------------------------------------------------------------------* *****************************************************************************/#ifdef SYNCHRONOUS_FILE_SYSTEM_FTR#define ACCESS_RIGHTS_INTERNAL_FS#define FS58SETSIZE_C#define	MODULE_NUMBER	MODULE_OSFS#undef  FILE_NUMBER#define FILE_NUMBER     58/*inc - INCLUDE---------------*/#include "Fs.h"/*lc - LOCAL CONSTANTS DECLARATION-----------------------------------*//*lm - LOCAL MACROS DEFINITION------------------------------*//*ld - LOCAL LITERAL DEFINITION--------------------------------*//*ls - LOCAL STRUCTURE DEFINITION----------------------------------*//*lp - LOCAL PROCEDURES DECLARATION------------------------------------*//*lv - LOCAL VARIABLES DEFINITION---------------------------------*//*S(*************************************************************************** * Semantic name : Fs58_01SetSize() * Object :  FSetSize function * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters  : * ------------------- *    pp_Param * * Output parameters : * ------------------- *    Return  *                        *                    * Used variables    : * ------------------- *    GLOBAL: * * * Used procedures   : * ------------------- *                   - MC_FS_BF_RESIZE_FILE * *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* *                                    DESCRIPTION *                *        Set the file size. It can: only truncate the file size *        Extending file is not performed by this function! *   *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 1void Fs58_01SetSize(void *pp_Param){  register t_FsCmdSetSize * pl_Param = (t_FsCmdSetSize *) pp_Param;    u32 vl_ObjID = pl_Param->p_Stream->v_FileID;  s32 vl_NewSize = pl_Param->v_NewSize;  s32 vl_Status = FS_OK;  /* Verify if file would open in write */    if ( pl_Param->p_Stream->s_OpenMode.v_WriteEnabled == FALSE )    {	/* Err -> File not open for write */	MC_FS_STATUS(pl_Param) = FS_EBADF;	MC_DIN_ERROR(NO_BLOCKING,0x00);	return;    }    /* If size of the elements < 0 */    if ( vl_NewSize < 0 )    {	/* Input parameters are uncoherent */	MC_FS_STATUS(pl_Param) = FS_EINVAL;	MC_DIN_ERROR(NO_BLOCKING,0x01);	return;    }        MC_FS_BF_RESIZE_FILE(vl_ObjID, vl_NewSize, &vl_Status);    /* If error in setting the size */    if ( vl_Status != FS_OK )    {	    /* set the error code */	    MC_FS_STATUS(pl_Param) = vl_Status;	    return;    }        /* update the file size */    pl_Param->p_Stream->v_FileSize = vl_NewSize;    /* if the file position ends up outside the limits of new file size then       set the new file position to end of new file size */    if ( (pl_Param->p_Stream->v_FilePosition) >	 (pl_Param->p_Stream->v_FileSize) )    {	pl_Param->p_Stream->v_FilePosition = pl_Param->p_Stream->v_FileSize;    }	}/*S(*************************************************************************** * Semantic name : Fs58_02ProcessSetSize * Object :  Request for setsize function by application * Finite state machine : * Event : * Transition : *----------------------------------------------------------------------------* * * Input parameters  : * ------------------- *    vp_Behaviour - Conf message is needed or not *    pp_Stream - file handle *    vp_NewSize - new size of the file * * Output parameters : * ------------------- *    Return - Request ID *                        *                    * Used variables    : * ------------------- *    GLOBAL: * * * Used procedures   : * ------------------- *                   - MC_FS_GET_MEMORY *                   - MC_FS_MA_SEND_CMD_MSG_TO_FS *----------------------------------------------------------------------------* *----------------------------------------------------------------------------* *                                    DESCRIPTION *                *        Set the file size. It can: *          - truncate the file size *          - extend the file size *   *----------------------------------------------------------------------------* **************************************************************************)S*/#undef PROCEDURE_NUMBER #define PROCEDURE_NUMBER 2u32 Fs58_02ProcessSetSize( u8 vp_Behaviour,			   t_fsFILE * pp_Stream, t_fs_size_t vp_NewSize){   /* Reserve message space */   t_FsCmdSetSize * pl_SetSize =       (t_FsCmdSetSize *) MC_FS_GET_MEMORY(sizeof(t_FsCmdSetSize *));    /* Fill message with input parameters */    pl_SetSize->p_Stream = pp_Stream;    pl_SetSize->v_NewSize = vp_NewSize;    /* Send message by setting operation and return command identifier */    return( MC_FS_MA_SEND_CMD_MSG_TO_FS(vp_Behaviour,				      (void*)pl_SetSize, FS_CMD_SETSIZE_REQ));}#endif#endif /* FSS_FTR */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -