📄 cat.h
字号:
/******************************************************************************File Name : cat.hDescription: Master/Local CAT support routines******************************************************************************/#ifndef MCAT_H#define MCAT_H /* Includes ------------------------------------------------------------ */#include "avdevice.h" /* Exported Constants -------------------------------------------------- */#define M_CAT_ENTRIES_PER_BLOCK (4000)#define NULL_LBA (0X00000000) /* Should be 0X0000000000000000 */#define INVALID_LBA (0XFFFFFFFF) /* Should be 0XFFFFFFFFFFFFFFFF */#define LOCAL_CAT_SIZE (sizeof(stavfs_LocalCat_t)/DISK_SECTOR_SIZE) /* Exported Types ------------------------------------------------------ *//* THIS TYPE stavfs_MCatBlock_t MUST BE A MULTIPLE OF SECTORS */typedef struct{ U64 LBA; U32 Unused[20]; U8 M_CatData[M_CAT_ENTRIES_PER_BLOCK]; U32 Unused2; /* Used internally for the Cache Flags but set to zero on disk */ U32 CRC;}stavfs_MCatBlock_t;typedef struct{ U64 PrevLBA; U64 NextLBA;}stavfs_LocalCatEntry_t;/* THIS STRUCTURE stavfs_LocalCat_t MUST BE A MULTIPLE OF SECTORS */typedef struct{ U64 LBA; stavfs_LocalCatEntry_t Cat[MAX_CLUSTERS_PER_BLOCK]; U8 FreeClusters; U8 Unused[3]; U32 CRC; }stavfs_LocalCat_t;typedef struct{ U64 LBA; U32 ClusterBlockId; U32 RefCount; /* Count of references in use to this Local CAT */ U16 TimeStamp; /* The 'Time' at which this was last used */ U8 InvalidData; /* Is the Local CAT data valid */ stavfs_LocalCat_t Data;}stavfs_LocalCatCache_t; /* Exported Variables -------------------------------------------------- */ /* Exported Macros ----------------------------------------------------- */#define M_CAT_BLOCK_SIZE (sizeof(stavfs_MCatBlock_t)/DISK_SECTOR_SIZE) /* Exported Function Prototypes ---------------------------------------- */ST_ErrorCode_t stavfs_InitCat (stavfs_Device_t *Device_p);ST_ErrorCode_t stavfs_OpenCat (stavfs_Device_t *Device_p);ST_ErrorCode_t stavfs_CloseCat (stavfs_Device_t *Device_p);ST_ErrorCode_t stavfs_FlushCat (stavfs_Device_t *Device_p);ST_ErrorCode_t stavfs_GetNumFreeClusters(stavfs_Device_t *Device_p, U64 *FreeClusters);ST_ErrorCode_t stavfs_SetClusterNext (stavfs_Device_t *Device_p, U64 const *LBA_p, U64 const *NextLBA_p);U8 stavfs_GetFreeClusters (stavfs_Device_t *Device_p, U8 InUnits, U64 const *PrevLBA_p, U64 *FreeLBA_p);U32 stavfs_AllocFreeClusters (stavfs_Device_t *Device_p, U32 NumClusters, U8 InUnits, U64 *PrevLBA_p, U64 *FreeLBA_p);U32 stavfs_FreeClusterChain (stavfs_Device_t *Device_p, U64 *EndLBA_p);ST_ErrorCode_t stavfs_GetLocalCat (stavfs_Device_t *Device_p, U32 ClusterBlockId, stavfs_LocalCatCache_t **LocalCat_p);ST_ErrorCode_t stavfs_SetLocalCat (stavfs_LocalCatCache_t *LocalCat_p, stavfs_Device_t *Device_p);ST_ErrorCode_t stavfs_InvalidLocalCat(stavfs_LocalCatCache_t *LocalCat_p);ST_ErrorCode_t stavfs_ReleaseLocalCat(stavfs_LocalCatCache_t *LocalCat_p);void stavfs_UpdateMasterCAT (stavfs_Device_t *Device_p, U32 ClusterBlockId, stavfs_LocalCatCache_t *LocalCat_p);ST_ErrorCode_t stavfs_RebuildLocalCAT (stavfs_Device_t *Device_p, stavfs_LocalCatCache_t *LocalCat_p, BOOL Force);void stavfs_ClearUnusedMasterCAT(stavfs_Device_t *Device_p, stavfs_LocalCatCache_t *LocalCat_p);ST_ErrorCode_t stavfs_WalkTheChain(stavfs_Device_t *Device_p, BOOL CheckMCat, U64 *LBA_p, U32 *Count_p);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -