From: Hao Wu <hao.a.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>, Paulo Alcantara <pcacjr@zytor.com>,
Ruiyu Ni <ruiyu.ni@intel.com>, Star Zeng <star.zeng@intel.com>,
Eric Dong <eric.dong@intel.com>, Dandan Bi <dandan.bi@intel.com>
Subject: [PATCH 7/7] MdeModulePkg/UdfDxe: Refine enum member naming style
Date: Fri, 15 Sep 2017 12:57:53 +0800 [thread overview]
Message-ID: <20170915045753.588-8-hao.a.wu@intel.com> (raw)
In-Reply-To: <20170915045753.588-1-hao.a.wu@intel.com>
Similar to the naming style for variables, it's better for the name of
members in a enum type to avoid using only upper-case letters.
Cc: Paulo Alcantara <pcacjr@zytor.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c | 62 ++++++++++----------
MdeModulePkg/Universal/Disk/UdfDxe/Udf.h | 28 ++++-----
2 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
index dfbf6b3f95..5df267761f 100644
--- a/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
+++ b/MdeModulePkg/Universal/Disk/UdfDxe/FileSystemOperations.c
@@ -710,9 +710,9 @@ GetLongAdFromAds (
// If it's either an indirect AD (Extended Alllocation Descriptor) or an
// allocated AD, then return it.
//
- ExtentFlags = GET_EXTENT_FLAGS (LONG_ADS_SEQUENCE, LongAd);
- if (ExtentFlags == EXTENT_IS_NEXT_EXTENT ||
- ExtentFlags == EXTENT_RECORDED_AND_ALLOCATED) {
+ ExtentFlags = GET_EXTENT_FLAGS (LongAdsSequence, LongAd);
+ if (ExtentFlags == ExtentIsNextExtent ||
+ ExtentFlags == ExtentRecordedAndAllocated) {
break;
}
@@ -720,7 +720,7 @@ GetLongAdFromAds (
// This AD is either not recorded but allocated, or not recorded and not
// allocated. Skip it.
//
- *Offset += AD_LENGTH (LONG_ADS_SEQUENCE);
+ *Offset += AD_LENGTH (LongAdsSequence);
}
*FoundLongAd = LongAd;
@@ -766,9 +766,9 @@ GetShortAdFromAds (
// If it's either an indirect AD (Extended Alllocation Descriptor) or an
// allocated AD, then return it.
//
- ExtentFlags = GET_EXTENT_FLAGS (SHORT_ADS_SEQUENCE, ShortAd);
- if (ExtentFlags == EXTENT_IS_NEXT_EXTENT ||
- ExtentFlags == EXTENT_RECORDED_AND_ALLOCATED) {
+ ExtentFlags = GET_EXTENT_FLAGS (ShortAdsSequence, ShortAd);
+ if (ExtentFlags == ExtentIsNextExtent ||
+ ExtentFlags == ExtentRecordedAndAllocated) {
break;
}
@@ -776,7 +776,7 @@ GetShortAdFromAds (
// This AD is either not recorded but allocated, or not recorded and not
// allocated. Skip it.
//
- *Offset += AD_LENGTH (SHORT_ADS_SEQUENCE);
+ *Offset += AD_LENGTH (ShortAdsSequence);
}
*FoundShortAd = ShortAd;
@@ -808,14 +808,14 @@ GetAllocationDescriptor (
OUT VOID **FoundAd
)
{
- if (RecordingFlags == LONG_ADS_SEQUENCE) {
+ if (RecordingFlags == LongAdsSequence) {
return GetLongAdFromAds (
Data,
Offset,
Length,
(UDF_LONG_ALLOCATION_DESCRIPTOR **)FoundAd
);
- } else if (RecordingFlags == SHORT_ADS_SEQUENCE) {
+ } else if (RecordingFlags == ShortAdsSequence) {
return GetShortAdFromAds (
Data,
Offset,
@@ -846,9 +846,9 @@ GetAllocationDescriptorLsn (
IN VOID *Ad
)
{
- if (RecordingFlags == LONG_ADS_SEQUENCE) {
+ if (RecordingFlags == LongAdsSequence) {
return GetLongAdLsn (Volume, (UDF_LONG_ALLOCATION_DESCRIPTOR *)Ad);
- } else if (RecordingFlags == SHORT_ADS_SEQUENCE) {
+ } else if (RecordingFlags == ShortAdsSequence) {
return GetShortAdLsn (
GetPdFromLongAd (Volume, ParentIcb),
(UDF_SHORT_ALLOCATION_DESCRIPTOR *)Ad
@@ -1115,8 +1115,8 @@ ReadFile (
Data = NULL;
switch (ReadFileInfo->Flags) {
- case READ_FILE_GET_FILESIZE:
- case READ_FILE_ALLOCATE_AND_READ:
+ case ReadFileGetFileSize:
+ case ReadFileAllocateAndRead:
//
// Initialise ReadFileInfo structure for either getting file size, or
// reading file's recorded data.
@@ -1124,7 +1124,7 @@ ReadFile (
ReadFileInfo->ReadLength = 0;
ReadFileInfo->FileData = NULL;
break;
- case READ_FILE_SEEK_AND_READ:
+ case ReadFileSeekAndRead:
//
// About to seek a file and/or read its data.
//
@@ -1149,15 +1149,15 @@ ReadFile (
RecordingFlags = GET_FE_RECORDING_FLAGS (FileEntryData);
switch (RecordingFlags) {
- case INLINE_DATA:
+ case InlineData:
//
// There are no extents for this FE/EFE. All data is inline.
//
GetFileEntryData (FileEntryData, &Data, &Length);
- if (ReadFileInfo->Flags == READ_FILE_GET_FILESIZE) {
+ if (ReadFileInfo->Flags == ReadFileGetFileSize) {
ReadFileInfo->ReadLength = Length;
- } else if (ReadFileInfo->Flags == READ_FILE_ALLOCATE_AND_READ) {
+ } else if (ReadFileInfo->Flags == ReadFileAllocateAndRead) {
//
// Allocate buffer for starting read data.
//
@@ -1171,7 +1171,7 @@ ReadFile (
//
CopyMem (ReadFileInfo->FileData, Data, (UINTN) Length);
ReadFileInfo->ReadLength = Length;
- } else if (ReadFileInfo->Flags == READ_FILE_SEEK_AND_READ) {
+ } else if (ReadFileInfo->Flags == ReadFileSeekAndRead) {
//
// If FilePosition is non-zero, seek file to FilePosition, read
// FileDataSize bytes and then updates FilePosition.
@@ -1191,8 +1191,8 @@ ReadFile (
Status = EFI_SUCCESS;
break;
- case LONG_ADS_SEQUENCE:
- case SHORT_ADS_SEQUENCE:
+ case LongAdsSequence:
+ case ShortAdsSequence:
//
// This FE/EFE contains a run of Allocation Descriptors. Get data + size
// for start reading them out.
@@ -1220,7 +1220,7 @@ ReadFile (
// Check if AD is an indirect AD. If so, read Allocation Extent
// Descriptor and its extents (ADs).
//
- if (GET_EXTENT_FLAGS (RecordingFlags, Ad) == EXTENT_IS_NEXT_EXTENT) {
+ if (GET_EXTENT_FLAGS (RecordingFlags, Ad) == ExtentIsNextExtent) {
if (!DoFreeAed) {
DoFreeAed = TRUE;
} else {
@@ -1254,10 +1254,10 @@ ReadFile (
Ad);
switch (ReadFileInfo->Flags) {
- case READ_FILE_GET_FILESIZE:
+ case ReadFileGetFileSize:
ReadFileInfo->ReadLength += ExtentLength;
break;
- case READ_FILE_ALLOCATE_AND_READ:
+ case ReadFileAllocateAndRead:
//
// Increase FileData (if necessary) to read next extent.
//
@@ -1288,7 +1288,7 @@ ReadFile (
ReadFileInfo->ReadLength += ExtentLength;
break;
- case READ_FILE_SEEK_AND_READ:
+ case ReadFileSeekAndRead:
//
// Seek file first before reading in its data.
//
@@ -1364,7 +1364,7 @@ ReadFile (
}
break;
- case EXTENDED_ADS_SEQUENCE:
+ case ExtendedAdsSequence:
// FIXME: Not supported. Got no volume with it, yet.
ASSERT (FALSE);
Status = EFI_UNSUPPORTED;
@@ -1388,7 +1388,7 @@ Done:
Error_Read_Disk_Blk:
Error_Alloc_Buffer_To_Next_Ad:
- if (ReadFileInfo->Flags != READ_FILE_SEEK_AND_READ) {
+ if (ReadFileInfo->Flags != ReadFileSeekAndRead) {
FreePool (ReadFileInfo->FileData);
}
@@ -1911,7 +1911,7 @@ ReadDirectoryEntry (
// The directory's recorded data has not been read yet. So let's cache it
// into memory and the next calls won't need to read it again.
//
- ReadFileInfo.Flags = READ_FILE_ALLOCATE_AND_READ;
+ ReadFileInfo.Flags = ReadFileAllocateAndRead;
Status = ReadFile (
BlockIo,
@@ -2061,7 +2061,7 @@ ResolveSymlink (
// all its data here -- usually the data will be inline with the FE/EFE for
// lower filenames.
//
- ReadFileInfo.Flags = READ_FILE_ALLOCATE_AND_READ;
+ ReadFileInfo.Flags = ReadFileAllocateAndRead;
Status = ReadFile (
BlockIo,
@@ -2284,7 +2284,7 @@ GetFileSize (
EFI_STATUS Status;
UDF_READ_FILE_INFO ReadFileInfo;
- ReadFileInfo.Flags = READ_FILE_GET_FILESIZE;
+ ReadFileInfo.Flags = ReadFileGetFileSize;
Status = ReadFile (
BlockIo,
@@ -2610,7 +2610,7 @@ ReadFileData (
EFI_STATUS Status;
UDF_READ_FILE_INFO ReadFileInfo;
- ReadFileInfo.Flags = READ_FILE_SEEK_AND_READ;
+ ReadFileInfo.Flags = ReadFileSeekAndRead;
ReadFileInfo.FilePosition = *FilePosition;
ReadFileInfo.FileData = Buffer;
ReadFileInfo.FileDataSize = *BufferSize;
diff --git a/MdeModulePkg/Universal/Disk/UdfDxe/Udf.h b/MdeModulePkg/Universal/Disk/UdfDxe/Udf.h
index 641e0ae267..44c843fd4d 100644
--- a/MdeModulePkg/Universal/Disk/UdfDxe/Udf.h
+++ b/MdeModulePkg/Universal/Disk/UdfDxe/Udf.h
@@ -106,10 +106,10 @@
!IS_FID_PARENT_FILE (_Pointer)))
typedef enum {
- SHORT_ADS_SEQUENCE,
- LONG_ADS_SEQUENCE,
- EXTENDED_ADS_SEQUENCE,
- INLINE_DATA
+ ShortAdsSequence,
+ LongAdsSequence,
+ ExtendedAdsSequence,
+ InlineData
} UDF_FE_RECORDING_FLAGS;
#define GET_FE_RECORDING_FLAGS(_Fe) \
@@ -118,26 +118,26 @@ typedef enum {
sizeof (UDF_DESCRIPTOR_TAG)))->Flags & 0x07)
typedef enum {
- EXTENT_RECORDED_AND_ALLOCATED,
- EXTENT_NOT_RECORDED_BUT_ALLOCATED,
- EXTENT_NOT_RECORDED_NOT_ALLOCATED,
- EXTENT_IS_NEXT_EXTENT,
+ ExtentRecordedAndAllocated,
+ ExtentNotRecordedButAllocated,
+ ExtentNotRecordedNotAllocated,
+ ExtentIsNextExtent,
} UDF_EXTENT_FLAGS;
#define AD_LENGTH(_RecFlags) \
- ((_RecFlags) == SHORT_ADS_SEQUENCE ? \
+ ((_RecFlags) == ShortAdsSequence ? \
((UINT64)(sizeof (UDF_SHORT_ALLOCATION_DESCRIPTOR))) : \
((UINT64)(sizeof (UDF_LONG_ALLOCATION_DESCRIPTOR))))
#define GET_EXTENT_FLAGS(_RecFlags, _Ad) \
- ((_RecFlags) == SHORT_ADS_SEQUENCE ? \
+ ((_RecFlags) == ShortAdsSequence ? \
((UDF_EXTENT_FLAGS)((((UDF_SHORT_ALLOCATION_DESCRIPTOR *)(_Ad))->ExtentLength >> \
30) & 0x3)) : \
((UDF_EXTENT_FLAGS)((((UDF_LONG_ALLOCATION_DESCRIPTOR *)(_Ad))->ExtentLength >> \
30) & 0x3)))
#define GET_EXTENT_LENGTH(_RecFlags, _Ad) \
- ((_RecFlags) == SHORT_ADS_SEQUENCE ? \
+ ((_RecFlags) == ShortAdsSequence ? \
((UINT32)((((UDF_SHORT_ALLOCATION_DESCRIPTOR *)(_Ad))->ExtentLength & \
~0xC0000000UL))) : \
((UINT32)((((UDF_LONG_ALLOCATION_DESCRIPTOR *)(_Ad))->ExtentLength & \
@@ -169,9 +169,9 @@ typedef struct {
#pragma pack()
typedef enum {
- READ_FILE_GET_FILESIZE,
- READ_FILE_ALLOCATE_AND_READ,
- READ_FILE_SEEK_AND_READ,
+ ReadFileGetFileSize,
+ ReadFileAllocateAndRead,
+ ReadFileSeekAndRead,
} UDF_READ_FILE_FLAGS;
typedef struct {
--
2.12.0.windows.1
next prev parent reply other threads:[~2017-09-15 4:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-15 4:57 [PATCH 0/7] MdeModulePkg/Udf: Code refinements Hao Wu
2017-09-15 4:57 ` [PATCH 1/7] MdeModulePkg/UdfDxe: Add checks to ensure no possible NULL ptr deref Hao Wu
2017-09-15 4:57 ` [PATCH 2/7] MdeModulePkg/UdfDxe: Fix operands of different size in bitwise OP Hao Wu
2017-09-15 4:57 ` [PATCH 3/7] MdeModulePkg/UdfDxe: Use compare operator for non-boolean comparisons Hao Wu
2017-09-15 4:57 ` [PATCH 4/7] MdeModulePkg/Udf: Refine function description comments Hao Wu
2017-09-15 4:57 ` [PATCH 5/7] MdeModulePkg/UdfDxe: Avoid short (single character) variable name Hao Wu
2017-09-15 4:57 ` [PATCH 6/7] MdeModulePkg/Udf: Avoid declaring and initializing local GUID variable Hao Wu
2017-09-15 4:57 ` Hao Wu [this message]
2017-09-15 21:47 ` [PATCH 0/7] MdeModulePkg/Udf: Code refinements Paulo Alcantara
2017-09-19 3:30 ` Zeng, Star
2017-09-19 3:36 ` Wu, Hao A
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=20170915045753.588-8-hao.a.wu@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