-/*++\r
+/** @file\r
+ Hash table operations.\r
\r
Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available\r
-under the terms and conditions of the BSD License which accompanies this\r
-distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
\r
+#include "Fat.h"\r
\r
-Module Name:\r
-\r
- Hash.c\r
-\r
-Abstract:\r
-\r
- Hash table operations\r
+/**\r
\r
-Revision History\r
+ Get hash value for long name.\r
\r
---*/\r
+ @param LongNameString - The long name string to be hashed.\r
\r
-#include "Fat.h"\r
+ @return HashValue.\r
\r
+**/\r
STATIC\r
UINT32\r
FatHashLongName (\r
IN CHAR16 *LongNameString\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Get hash value for long name.\r
-\r
-Arguments:\r
-\r
- LongNameString - The long name string to be hashed.\r
-\r
-Returns:\r
-\r
- HashValue.\r
-\r
---*/\r
{\r
UINT32 HashValue;\r
CHAR16 UpCasedLongFileName[EFI_PATH_STRING_LENGTH];\r
StrnCpyS (\r
UpCasedLongFileName,\r
- sizeof (UpCasedLongFileName) / sizeof (UpCasedLongFileName[0]),\r
+ ARRAY_SIZE (UpCasedLongFileName),\r
LongNameString,\r
- sizeof (UpCasedLongFileName) / sizeof (UpCasedLongFileName[0]) - 1\r
+ ARRAY_SIZE (UpCasedLongFileName) - 1\r
);\r
FatStrUpr (UpCasedLongFileName);\r
gBS->CalculateCrc32 (UpCasedLongFileName, StrSize (UpCasedLongFileName), &HashValue);\r
return (HashValue & HASH_TABLE_MASK);\r
}\r
\r
-STATIC\r
-UINT32\r
-FatHashShortName (\r
- IN CHAR8 *ShortNameString\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Get hash value for short name.\r
\r
-Arguments:\r
+ @param ShortNameString - The short name string to be hashed.\r
\r
- ShortNameString - The short name string to be hashed.\r
+ @return HashValue\r
\r
-Returns:\r
-\r
- HashValue\r
-\r
---*/\r
+**/\r
+STATIC\r
+UINT32\r
+FatHashShortName (\r
+ IN CHAR8 *ShortNameString\r
+ )\r
{\r
UINT32 HashValue;\r
gBS->CalculateCrc32 (ShortNameString, FAT_NAME_LEN, &HashValue);\r
return (HashValue & HASH_TABLE_MASK);\r
}\r
\r
-FAT_DIRENT **\r
-FatLongNameHashSearch (\r
- IN FAT_ODIR *ODir,\r
- IN CHAR16 *LongNameString\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Search the long name hash table for the directory entry.\r
\r
-Arguments:\r
-\r
- ODir - The directory to be searched.\r
- LongNameString - The long name string to search.\r
-\r
-Returns:\r
+ @param ODir - The directory to be searched.\r
+ @param LongNameString - The long name string to search.\r
\r
- The previous long name hash node of the directory entry.\r
+ @return The previous long name hash node of the directory entry.\r
\r
---*/\r
+**/\r
+FAT_DIRENT **\r
+FatLongNameHashSearch (\r
+ IN FAT_ODIR *ODir,\r
+ IN CHAR16 *LongNameString\r
+ )\r
{\r
FAT_DIRENT **PreviousHashNode;\r
for (PreviousHashNode = &ODir->LongNameHashTable[FatHashLongName (LongNameString)];\r
return PreviousHashNode;\r
}\r
\r
-FAT_DIRENT **\r
-FatShortNameHashSearch (\r
- IN FAT_ODIR *ODir,\r
- IN CHAR8 *ShortNameString\r
- )\r
-/*++\r
-\r
-Routine Description:\r
+/**\r
\r
Search the short name hash table for the directory entry.\r
\r
-Arguments:\r
-\r
- ODir - The directory to be searched.\r
- ShortNameString - The short name string to search.\r
+ @param ODir - The directory to be searched.\r
+ @param ShortNameString - The short name string to search.\r
\r
-Returns:\r
+ @return The previous short name hash node of the directory entry.\r
\r
- The previous short name hash node of the directory entry.\r
-\r
---*/\r
+**/\r
+FAT_DIRENT **\r
+FatShortNameHashSearch (\r
+ IN FAT_ODIR *ODir,\r
+ IN CHAR8 *ShortNameString\r
+ )\r
{\r
FAT_DIRENT **PreviousHashNode;\r
for (PreviousHashNode = &ODir->ShortNameHashTable[FatHashShortName (ShortNameString)];\r
return PreviousHashNode;\r
}\r
\r
+/**\r
+\r
+ Insert directory entry to hash table.\r
+\r
+ @param ODir - The parent directory.\r
+ @param DirEnt - The directory entry node.\r
+\r
+**/\r
VOID\r
FatInsertToHashTable (\r
IN FAT_ODIR *ODir,\r
IN FAT_DIRENT *DirEnt\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Insert directory entry to hash table.\r
-\r
-Arguments:\r
-\r
- ODir - The parent directory.\r
- DirEnt - The directory entry node.\r
-\r
-Returns:\r
-\r
- None.\r
-\r
---*/\r
{\r
FAT_DIRENT **HashTable;\r
UINT32 HashTableIndex;\r
HashTable[HashTableIndex] = DirEnt;\r
}\r
\r
+/**\r
+\r
+ Delete directory entry from hash table.\r
+\r
+ @param ODir - The parent directory.\r
+ @param DirEnt - The directory entry node.\r
+\r
+**/\r
VOID\r
FatDeleteFromHashTable (\r
IN FAT_ODIR *ODir,\r
IN FAT_DIRENT *DirEnt\r
)\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Delete directory entry from hash table.\r
-\r
-Arguments:\r
-\r
- ODir - The parent directory.\r
- DirEnt - The directory entry node.\r
-\r
-Returns:\r
-\r
- None.\r
-\r
---*/\r
{\r
*FatShortNameHashSearch (ODir, DirEnt->Entry.FileName) = DirEnt->ShortNameForwardLink;\r
*FatLongNameHashSearch (ODir, DirEnt->FileString) = DirEnt->LongNameForwardLink;\r