dir.h
来自「ST5518机顶盒系统文件系统源代码!绝对超值!」· C头文件 代码 · 共 95 行
H
95 行
/******************************************************************************File Name : dir.hDescription: Directory management.******************************************************************************/#ifndef DIR_H#define DIR_H /* Includes ------------------------------------------------------------ */#include "avdevice.h" /* Exported Constants -------------------------------------------------- */#define MAX_FILE_NAME_LEN (59) /* max # chars in file name (without terminating 0) */#define FILE_FLAG_ENTRY_UNUSED (0X00000000)#define FILE_FLAG_ENTRY_USED (0X00000001)#define FILE_FLAG_DIRECTORY (0X00000100)#define FILE_FLAG_STREAM_MODE (0X00000200)#define FILE_FLAG_BOOT_FILE (0X00000400)#define FILE_FLAG_CYCLIC_FILE (0X00000800)#define FILE_FLAG_BEING_DELETED (0X00000010)#define FILE_FLAG_OPEN_FOR_WRITE (0X00000020)#define RESERVED_FILE_CHAR "/\\;:"#define THIS_DIRECTORY "."#define PARENT_DIRECTORY ".." /* Exported Types ------------------------------------------------------ */typedef struct{ U32 LoopCount; /* The number of time the file has looped */ U32 TopOffset; /* The offset to the top of file */}stavfs_CyclicSize_t;/* * The stavfs_DirEntry_t is made an exact fraction of a sector so that when it fits * into a Cluster the entries don't cross a sector boundary. Then writing to disk * any given sector will be written correctly (on some disks). So by not spanning * sectors no single entry will be corrupted. * We need to make 'holes' in the structure to make room for the fields added * to the cluster by back up on write. */typedef struct{ U64 DummyLBA; /* Provides space for the Backup on write LBA Value */ U64 StartLBA; /* LBA of first allocated Cluster */ U64 EndLBA; /* LBA of last allocated Cluster */ U64 AllocSize; /* Allocated Size in Clusters */ union { U64 File; stavfs_CyclicSize_t Cyclic; } Size; /* Amount of data in the file */ U32 Flags; U32 Unused; U64 MetaData[2]; U8 Name[MAX_FILE_NAME_LEN+1]; U32 DummyCRC; /* Provides space for the Backup on write CRC Value */}stavfs_DirEntry_t; /* Exported Variables -------------------------------------------------- */ /* Exported Macros ----------------------------------------------------- */ /* Exported Function Prototypes ---------------------------------------- */ST_ErrorCode_t stavfs_InitRootDir (stavfs_Device_t *Device_p); /* Open and format the root directory */ST_ErrorCode_t stavfs_OpenRootDir (stavfs_Device_t *Device_p); /* Open the root directory */ST_ErrorCode_t stavfs_CloseRootDir (stavfs_Device_t *Device_p);ST_ErrorCode_t stavfs_FormatRootDir (stavfs_Device_t *Device_p);ST_ErrorCode_t stavfs_FlushDir (stavfs_Device_t *Device_p, stavfs_DirEntry_t *Dir_p);ST_ErrorCode_t stavfs_ModifyDirEntry (stavfs_Device_t *Device_p, stavfs_DirEntry_t *DirEntry_p);ST_ErrorCode_t stavfs_FindFileEntry (stavfs_Device_t *Device_p, stavfs_DirEntry_t *Dir_p, char *Name, stavfs_DirEntry_t **Entry_p);ST_ErrorCode_t stavfs_FindFreeEntry (stavfs_Device_t *Device_p, stavfs_DirEntry_t *Dir_p, stavfs_DirEntry_t **Entry_p);ST_ErrorCode_t stavfs_NextEntry (stavfs_Device_t *Device_p, stavfs_DirEntry_t *Dir_p, stavfs_DirEntry_t **Entry_p);ST_ErrorCode_t stavfs_ReleaseFileEntry (stavfs_Device_t *Device_p, stavfs_DirEntry_t *Entry_p);#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?