From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Subject: [patch 5/8] FatPkg\EnhancedFatDxe: Use typedef for complex type
Date: Thu, 8 Dec 2016 18:54:24 +0800 [thread overview]
Message-ID: <1481194467-75920-6-git-send-email-dandan.bi@intel.com> (raw)
In-Reply-To: <1481194467-75920-1-git-send-email-dandan.bi@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
FatPkg/EnhancedFatDxe/Fat.h | 36 ++++++++++++++++++++---------------
FatPkg/EnhancedFatDxe/FatFileSystem.h | 10 ++++++----
2 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h
index 42aa647..f49acee 100644
--- a/FatPkg/EnhancedFatDxe/Fat.h
+++ b/FatPkg/EnhancedFatDxe/Fat.h
@@ -182,42 +182,48 @@ typedef struct {
#define HASH_TABLE_MASK (HASH_TABLE_SIZE - 1)
//
// 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;
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
BOOLEAN Invalid; // Indicate whether this directory entry is valid
CHAR16 *FileString; // The unicode long file name for this directory entry
- struct _FAT_OFILE *OFile; // The OFile of the corresponding directory entry
- struct _FAT_DIRENT *ShortNameForwardLink; // Hash successor link for short filename
- struct _FAT_DIRENT *LongNameForwardLink; // Hash successor link for long filename
+ FAT_OFILE *OFile; // The OFile of the corresponding directory entry
+ FAT_DIRENT *ShortNameForwardLink; // Hash successor link for short filename
+ FAT_DIRENT *LongNameForwardLink; // Hash successor link for long filename
LIST_ENTRY Link; // Connection of every directory entry
FAT_DIRECTORY_ENTRY Entry; // The physical directory entry stored in disk
-} FAT_DIRENT;
+};
-typedef struct _FAT_ODIR {
+struct _FAT_ODIR {
UINTN Signature;
UINT32 CurrentEndPos; // Current end position of the directory
UINT32 CurrentPos; // Current position of the directory
LIST_ENTRY *CurrentCursor; // Current directory entry pointer
LIST_ENTRY ChildList; // List of all directory entries
BOOLEAN EndOfDir; // Indicate whether we have reached the end of the directory
LIST_ENTRY DirCacheLink; // Linked in Volume->DirCacheList when discarded
UINTN DirCacheTag; // The identification of the directory when in directory cache
FAT_DIRENT *LongNameHashTable[HASH_TABLE_SIZE];
FAT_DIRENT *ShortNameHashTable[HASH_TABLE_SIZE];
-} FAT_ODIR;
+};
typedef struct {
UINTN Signature;
EFI_FILE_PROTOCOL Handle;
UINT64 Position;
BOOLEAN ReadOnly;
- struct _FAT_OFILE *OFile;
+ FAT_OFILE *OFile;
LIST_ENTRY Tasks; // List of all FAT_TASKs
LIST_ENTRY Link; // Link to other IFiles
} FAT_IFILE;
typedef struct {
@@ -240,13 +246,13 @@ typedef struct {
} FAT_SUBTASK;
//
// FAT_OFILE - Each opened file
//
-typedef struct _FAT_OFILE {
+struct _FAT_OFILE {
UINTN Signature;
- struct _FAT_VOLUME *Volume;
+ FAT_VOLUME *Volume;
//
// A permanant error code to return to all accesses to
// this opened file
//
EFI_STATUS Error;
@@ -282,11 +288,11 @@ typedef struct _FAT_OFILE {
UINT64 PosDisk; // on the disk
UINTN PosRem; // remaining in this disk run
//
// The opened parent, full path length and currently opened child files
//
- struct _FAT_OFILE *Parent;
+ FAT_OFILE *Parent;
UINTN FullPathLen;
LIST_ENTRY ChildHead;
LIST_ENTRY ChildLink;
//
@@ -301,13 +307,13 @@ typedef struct _FAT_OFILE {
//
// Link in Volume's reference list
//
LIST_ENTRY CheckLink;
-} FAT_OFILE;
+};
-typedef struct _FAT_VOLUME {
+struct _FAT_VOLUME {
UINTN Signature;
EFI_HANDLE Handle;
BOOLEAN Valid;
BOOLEAN DiskError;
@@ -364,11 +370,11 @@ typedef struct _FAT_VOLUME {
FAT_DIRENT RootDirEnt;
//
// File Name of root OFile, it is empty string
//
CHAR16 RootFileString[1];
- struct _FAT_OFILE *Root;
+ FAT_OFILE *Root;
//
// New OFiles are added to this list so they
// can be cleaned up if they aren't referenced.
//
@@ -383,11 +389,11 @@ typedef struct _FAT_VOLUME {
//
// Disk Cache for this volume
//
VOID *CacheBuffer;
DISK_CACHE DiskCache[CacheMaxType];
-} FAT_VOLUME;
+};
//
// Function Prototypes
//
EFI_STATUS
diff --git a/FatPkg/EnhancedFatDxe/FatFileSystem.h b/FatPkg/EnhancedFatDxe/FatFileSystem.h
index bcef258..3f89a34 100644
--- a/FatPkg/EnhancedFatDxe/FatFileSystem.h
+++ b/FatPkg/EnhancedFatDxe/FatFileSystem.h
@@ -144,16 +144,18 @@ typedef struct {
CHAR8 Id[4];
CHAR8 FatLabel[11];
CHAR8 SystemId[8];
} FAT32_BOOT_SECTOR_EXT;
-typedef struct {
- FAT_BOOT_SECTOR_BASIC FatBsb;
- union {
+typedef union {
FAT_BOOT_SECTOR_EXT FatBse;
FAT32_BOOT_SECTOR_EXT Fat32Bse;
- } FatBse;
+ } FAT_BSE;
+
+typedef struct {
+ FAT_BOOT_SECTOR_BASIC FatBsb;
+ FAT_BSE FatBse;
} FAT_BOOT_SECTOR;
//
// FAT Info Structure
//
--
1.9.5.msysgit.1
next prev parent reply other threads:[~2016-12-08 10:54 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-08 10:54 [patch 0/8] FatPkg: Fix coding style issues Dandan Bi
2016-12-08 10:54 ` [patch 1/8] FatPkg\EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean Dandan Bi
2016-12-09 1:14 ` Ni, Ruiyu
2016-12-08 10:54 ` [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration Dandan Bi
2016-12-08 17:27 ` Kurt Kennett
2016-12-08 23:11 ` Andrew Fish
2016-12-20 23:26 ` Brian J. Johnson
2016-12-08 23:47 ` Yao, Jiewen
2016-12-09 0:26 ` Kurt Kennett
2016-12-09 0:36 ` Andrew Fish
2016-12-09 0:40 ` Yao, Jiewen
2016-12-09 16:32 ` Kurt Kennett
2016-12-09 0:40 ` Kurt Kennett
2016-12-09 0:57 ` Ni, Ruiyu
2016-12-09 1:18 ` Bi, Dandan
2016-12-08 10:54 ` [patch 3/8] FatPkg\EnhancedFatDxe: Make function prototype align with definition Dandan Bi
2016-12-09 1:13 ` Ni, Ruiyu
2016-12-08 10:54 ` [patch 4/8] FatPkg\EnhancedFatDxe: Make the variable name follow rule Dandan Bi
2016-12-09 1:12 ` Ni, Ruiyu
2016-12-08 10:54 ` Dandan Bi [this message]
2016-12-09 1:11 ` [patch 5/8] FatPkg\EnhancedFatDxe: Use typedef for complex type Ni, Ruiyu
2016-12-08 10:54 ` [patch 6/8] FatPkg\EnhancedFatDxe: Make the comments align with EDKII coding style Dandan Bi
2016-12-09 1:10 ` Ni, Ruiyu
2016-12-08 10:54 ` [patch 7/8] FatPkg\EnhancedFatDxe: Add comments for functions Dandan Bi
2016-12-09 1:10 ` Ni, Ruiyu
2016-12-08 10:54 ` [patch 8/8] FatPkg: Fix format issues in dec/inf/dsc files Dandan Bi
2016-12-09 1:09 ` Ni, Ruiyu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1481194467-75920-6-git-send-email-dandan.bi@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox