FatPkg/EnhancedFatDxe: Use typedef for complex type

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
Dandan Bi 2016-12-08 14:38:26 +08:00 committed by Ruiyu Ni
parent c1680e885d
commit 6b7e4498e8
2 changed files with 27 additions and 19 deletions

View File

@ -184,20 +184,26 @@ typedef struct {
// //
// The directory entry for opened directory // The directory entry for opened directory
// //
typedef struct _FAT_DIRENT {
typedef struct _FAT_DIRENT FAT_DIRENT;
typedef struct _FAT_ODIR FAT_ODIR;
typedef struct _FAT_OFILE FAT_OFILE;
typedef struct _FAT_VOLUME FAT_VOLUME;
struct _FAT_DIRENT {
UINTN Signature; UINTN Signature;
UINT16 EntryPos; // The position of this directory entry in the parent directory file UINT16 EntryPos; // The position of this directory entry in the parent directory file
UINT8 EntryCount; // The count of the directory entry in the parent directory file UINT8 EntryCount; // The count of the directory entry in the parent directory file
BOOLEAN Invalid; // Indicate whether this directory entry is valid BOOLEAN Invalid; // Indicate whether this directory entry is valid
CHAR16 *FileString; // The unicode long file name for this directory entry CHAR16 *FileString; // The unicode long file name for this directory entry
struct _FAT_OFILE *OFile; // The OFile of the corresponding directory entry FAT_OFILE *OFile; // The OFile of the corresponding directory entry
struct _FAT_DIRENT *ShortNameForwardLink; // Hash successor link for short filename FAT_DIRENT *ShortNameForwardLink; // Hash successor link for short filename
struct _FAT_DIRENT *LongNameForwardLink; // Hash successor link for long filename FAT_DIRENT *LongNameForwardLink; // Hash successor link for long filename
LIST_ENTRY Link; // Connection of every directory entry LIST_ENTRY Link; // Connection of every directory entry
FAT_DIRECTORY_ENTRY Entry; // The physical directory entry stored in disk FAT_DIRECTORY_ENTRY Entry; // The physical directory entry stored in disk
} FAT_DIRENT; };
typedef struct _FAT_ODIR { struct _FAT_ODIR {
UINTN Signature; UINTN Signature;
UINT32 CurrentEndPos; // Current end position of the directory UINT32 CurrentEndPos; // Current end position of the directory
UINT32 CurrentPos; // Current position of the directory UINT32 CurrentPos; // Current position of the directory
@ -208,14 +214,14 @@ typedef struct _FAT_ODIR {
UINTN DirCacheTag; // The identification of the directory when in directory cache UINTN DirCacheTag; // The identification of the directory when in directory cache
FAT_DIRENT *LongNameHashTable[HASH_TABLE_SIZE]; FAT_DIRENT *LongNameHashTable[HASH_TABLE_SIZE];
FAT_DIRENT *ShortNameHashTable[HASH_TABLE_SIZE]; FAT_DIRENT *ShortNameHashTable[HASH_TABLE_SIZE];
} FAT_ODIR; };
typedef struct { typedef struct {
UINTN Signature; UINTN Signature;
EFI_FILE_PROTOCOL Handle; EFI_FILE_PROTOCOL Handle;
UINT64 Position; UINT64 Position;
BOOLEAN ReadOnly; BOOLEAN ReadOnly;
struct _FAT_OFILE *OFile; FAT_OFILE *OFile;
LIST_ENTRY Tasks; // List of all FAT_TASKs LIST_ENTRY Tasks; // List of all FAT_TASKs
LIST_ENTRY Link; // Link to other IFiles LIST_ENTRY Link; // Link to other IFiles
} FAT_IFILE; } FAT_IFILE;
@ -242,9 +248,9 @@ typedef struct {
// //
// FAT_OFILE - Each opened file // FAT_OFILE - Each opened file
// //
typedef struct _FAT_OFILE { struct _FAT_OFILE {
UINTN Signature; UINTN Signature;
struct _FAT_VOLUME *Volume; FAT_VOLUME *Volume;
// //
// A permanant error code to return to all accesses to // A permanant error code to return to all accesses to
// this opened file // this opened file
@ -284,7 +290,7 @@ typedef struct _FAT_OFILE {
// //
// The opened parent, full path length and currently opened child files // The opened parent, full path length and currently opened child files
// //
struct _FAT_OFILE *Parent; FAT_OFILE *Parent;
UINTN FullPathLen; UINTN FullPathLen;
LIST_ENTRY ChildHead; LIST_ENTRY ChildHead;
LIST_ENTRY ChildLink; LIST_ENTRY ChildLink;
@ -303,9 +309,9 @@ typedef struct _FAT_OFILE {
// Link in Volume's reference list // Link in Volume's reference list
// //
LIST_ENTRY CheckLink; LIST_ENTRY CheckLink;
} FAT_OFILE; };
typedef struct _FAT_VOLUME { struct _FAT_VOLUME {
UINTN Signature; UINTN Signature;
EFI_HANDLE Handle; EFI_HANDLE Handle;
@ -366,7 +372,7 @@ typedef struct _FAT_VOLUME {
// File Name of root OFile, it is empty string // File Name of root OFile, it is empty string
// //
CHAR16 RootFileString[1]; CHAR16 RootFileString[1];
struct _FAT_OFILE *Root; FAT_OFILE *Root;
// //
// New OFiles are added to this list so they // New OFiles are added to this list so they
@ -385,7 +391,7 @@ typedef struct _FAT_VOLUME {
// //
VOID *CacheBuffer; VOID *CacheBuffer;
DISK_CACHE DiskCache[CacheMaxType]; DISK_CACHE DiskCache[CacheMaxType];
} FAT_VOLUME; };
// //
// Function Prototypes // Function Prototypes

View File

@ -146,12 +146,14 @@ typedef struct {
CHAR8 SystemId[8]; CHAR8 SystemId[8];
} FAT32_BOOT_SECTOR_EXT; } FAT32_BOOT_SECTOR_EXT;
typedef struct { typedef union {
FAT_BOOT_SECTOR_BASIC FatBsb;
union {
FAT_BOOT_SECTOR_EXT FatBse; FAT_BOOT_SECTOR_EXT FatBse;
FAT32_BOOT_SECTOR_EXT Fat32Bse; FAT32_BOOT_SECTOR_EXT Fat32Bse;
} FatBse; } FAT_BSE;
typedef struct {
FAT_BOOT_SECTOR_BASIC FatBsb;
FAT_BSE FatBse;
} FAT_BOOT_SECTOR; } FAT_BOOT_SECTOR;
// //