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

📄 davsrecl.c

📁 FDI Intel开发的FLASH文件系统,功能很强大
💻 C
字号:
/* Copyright (c) 1995-2002 Intel Corporation */
/* Intel Confidential                        */

/* ###########################################################################
###  DAV - Direct Access Volume Enhancement to FDI
###
###  Module: dav_srecl.c - DAV Interface Function: Set Reclaim Level Module
###
###  $Workfile: davsrecl.c $
###  $Revision: 50 $
###  $NoKeywords: $
########################################################################### */

/*                                                               
 *****************************************************************
 * NOTICE OF LICENSE AGREEMENT                                    
 *                                                                
 * This code is provided by Intel Corp., and the use is governed  
 * under the terms of a license agreement. See license agreement  
 * for complete terms of license.                                 
 *                                                                
 * YOU MAY ONLY USE THE SOFTWARE WITH INTEL FLASH PRODUCTS.  YOUR 
 * USE OF THE SOFTWARE WITH ANY OTHER FLASH PRODUCTS IS EXPRESSLY 
 * PROHIBITED UNLESS AND UNTIL YOU APPLY FOR, AND ARE GRANTED IN  
 * INTEL'S SOLE DISCRETION, A SEPARATE WRITTEN SOFTWARE LICENSE   
 * FROM INTEL LICENSING ANY SUCH USE.                             
 *****************************************************************
 */
 

/*### Include Files
#########################*/
#include "dav.h"
#if (DIRECT_ACCESS_VOLUME == TRUE)

/*### Local Declarations
#########################*/

/*### Global Declarations
#########################*/

/*### Local Functions
#########################*/

/*### Global Functions
#########################*/

/*###################################################################
  ### FDI_SetReclaimLevel
  ###
  ### DESCRIPTION:
  ###   This function allows the system to determine how often it
  ###   should perform a reclaim.  It does so to minimize the impact
  ###   of reclaiming a large amount of space.  Numbers between 
  ###   0 and 10 perform reclaim on the basis of the ratio of invalid
  ###   to available space.  A level of 0 would tell the DAV to 
  ###   perform a reclaim whenever the ratio of invalid to 
  ###   available memory is greater than 0%, which would be true 
  ###   every time an object is deallocated.  A level of 10 would
  ###   tell the DAV to perform a reclaim whenever the ratio of 
  ###   invalid to total available was greater than 100%, which 
  ###   would be true only when all available memory is invalid.
  ###
  ### PARAMETERS:
  ###   level    - A level between 0 and 10 representing the 
  ###              threshold value perform a reclaim. 0 represents
  ###              0% and would trigger a reclaim whenever an object
  ###              is deallocated and 10 represents 100% and would
  ###              trigger a reclaim only when all memory was invalid.
  ###
  ### RETURNS:
  ###   When this function passes with no errors a value of 0 is
  ###   returned otherwise, it returns a status of type ERR_CODE.
  ###*/
ERR_CODE FDI_SetReclaimLevel( UINT8 level )
{
    /* Validate level is between 0 and 10.  Since UINT8 is */ 
    /* unsigned integer, we only need to check for values */
    /* over 10.                                           */
    if (level > 10)
    {
       return ERR_PARAM;
    }
    
    /* The privilege will most likely need to be validated here. */

    /* Set ReclaimLevel to level. */
    FDI_ReclaimLevel = level;
    return(ERR_NONE);
}



/*###################################################################
  ### DAVSRECL_CheckReclaimLevel
  ###
  ### DESCRIPTION:
  ###   This function will check total invalid and total available
  ###   memory and trigger a full reclaim if needed.  This function
  ###   assumes all global memory statistics are valid.
  ###
  ### PARAMETERS:
  ###   None.
  ###
  ### RETURNS:
  ###   When this function passes with no errors a value of 0 is
  ###   returned otherwise, it returns a status of type ERR_CODE.
  ###*/
ERR_CODE DAVSRECL_CheckReclaimLevel(void)
{


   ERR_CODE status = ERR_NONE;

   RECOVER_MarkDatabaseBusy();

   /* Reclaim both page and paragraph object space */
   status = RECLAIM_Cleanup(ReclaimAllObjects, FALSE);
   if(!status)
   {
      /* Reclaim both page and paragraph object space one *
       * more time to cleanup the reserved space used. *
       * Fore eg: WIP object on a reallocate when marked invalid */
      status = RECLAIM_Cleanup(ReclaimAllObjects, FALSE);
   }

   RECOVER_MarkDatabaseReady();

   return(status);
}  

#endif /* DIRECT_ACCESS_VOLUME */

⌨️ 快捷键说明

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