]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Library/EfiFileLib/EfiFileLib.c
ARM Packages: Removed trailing spaces
[mirror_edk2.git] / EmbeddedPkg / Library / EfiFileLib / EfiFileLib.c
index 83a3b7841fe72b1c68a07403f74a10af456b6b81..448127d93f5afbeb1b475cd2f8cd5ea60d10d8a4 100644 (file)
@@ -34,19 +34,19 @@ Fv2:         - EFI Firmware VOlume device 2
 **/\r
 \r
 #include <PiDxe.h>\r
-#include <Protocol/BlockIo.h>             \r
-#include <Protocol/DiskIo.h>             \r
-#include <Protocol/SimpleFileSystem.h>      \r
-#include <Protocol/FirmwareVolume2.h>        \r
+#include <Protocol/BlockIo.h>\r
+#include <Protocol/DiskIo.h>\r
+#include <Protocol/SimpleFileSystem.h>\r
+#include <Protocol/FirmwareVolume2.h>\r
 #include <Protocol/LoadFile.h>\r
-#include <Protocol/FirmwareVolumeBlock.h>  \r
+#include <Protocol/FirmwareVolumeBlock.h>\r
 #include <Guid/FileInfo.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DevicePathLib.h>\r
 #include <Library/PrintLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
-#include <Library/UefiLib.h>   \r
+#include <Library/UefiLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/DebugLib.h>\r
@@ -210,7 +210,7 @@ EblUpdateDeviceLists (
 /**\r
 PathName is in the form <device name>:<path> for example fs1:\ or ROOT:\.\r
 Return TRUE if the <devce name> prefix of PathName matches a file system\r
-Volume Name. MatchIndex is the array  index in mFsInfo[] of the match, \r
+Volume Name. MatchIndex is the array  index in mFsInfo[] of the match,\r
 and it can be used with mFs[] to find the handle that needs to be opened\r
 \r
 @param  PathName      PathName to check\r
@@ -291,7 +291,7 @@ EfiGetDeviceCounts (
 \r
 EFI_STATUS\r
 ConvertIpStringToEfiIp (\r
-  IN  CHAR8           *PathName, \r
+  IN  CHAR8           *PathName,\r
   OUT EFI_IP_ADDRESS  *ServerIp\r
   )\r
 {\r
@@ -326,7 +326,7 @@ ConvertIpStringToEfiIp (
 \r
 \r
 /**\r
-Internal work function to extract a device number from a string skipping \r
+Internal work function to extract a device number from a string skipping\r
 text. Easy way to extract numbers from strings like blk7:.\r
 \r
 @param  Str   String to extract device number form\r
@@ -344,7 +344,7 @@ EblConvertDevStringToNumber (
   UINTN   Index;\r
 \r
 \r
-  // Find the first digit \r
+  // Find the first digit\r
   Max = AsciiStrLen (Str);\r
   for  (Index = 0; !((*Str >= '0') && (*Str <= '9')) && (Index < Max); Index++) {\r
     Str++;\r
@@ -563,11 +563,11 @@ EblFvFileDevicePath (
     do {\r
       File->FvType = EFI_FV_FILETYPE_ALL;\r
       GetNextFileStatus = File->Fv->GetNextFile (\r
-        File->Fv, \r
+        File->Fv,\r
         &Key,\r
-        &File->FvType,  \r
-        &File->FvNameGuid, \r
-        &File->FvAttributes, \r
+        &File->FvType,\r
+        &File->FvNameGuid,\r
+        &File->FvAttributes,\r
         &File->Size\r
         );\r
       if (!EFI_ERROR (GetNextFileStatus)) {\r
@@ -634,17 +634,17 @@ EblFvFileDevicePath (
 \r
 \r
 /**\r
-Open a device named by PathName. The PathName includes a device name and \r
+Open a device named by PathName. The PathName includes a device name and\r
 path separated by a :. See file header for more details on the PathName\r
 syntax. There is no checking to prevent a file from being opened more than\r
-one type. \r
+one type.\r
 \r
 SectionType is only used to open an FV. Each file in an FV contains multiple\r
 sections and only the SectionType section is opened.\r
 \r
 For any file that is opened with EfiOpen() must be closed with EfiClose().\r
 \r
-@param  PathName    Path to parse to open \r
+@param  PathName    Path to parse to open\r
 @param  OpenMode    Same as EFI_FILE.Open()\r
 @param  SectionType Section in FV to open.\r
 \r
@@ -711,7 +711,7 @@ EfiOpen (
       }\r
 \r
       if ((PathName[0] == '/') || (PathName[0] == '\\')) {\r
-        // PathName starts in / so this means we go to the root of the device in the CWD. \r
+        // PathName starts in / so this means we go to the root of the device in the CWD.\r
         CwdPlusPathName[0] = '\0';\r
         for (FileStart = 0; gCwd[FileStart] != '\0'; FileStart++) {\r
           CwdPlusPathName[FileStart] = gCwd[FileStart];\r
@@ -740,7 +740,7 @@ EfiOpen (
       return File;\r
     }\r
 \r
-    DevNumber = EblConvertDevStringToNumber ((CHAR8 *)PathName); \r
+    DevNumber = EblConvertDevStringToNumber ((CHAR8 *)PathName);\r
   }\r
 \r
   File->DeviceName = AllocatePool (StrLen);\r
@@ -750,11 +750,11 @@ EfiOpen (
   if (File->FileName[0] == '\0') {\r
     // if it is just a file name use / as root\r
     File->FileName = "\\";\r
-  } \r
+  }\r
 \r
   //\r
   // Use best match algorithm on the dev names so we only need to look at the\r
-  // first few charters to match the full device name. Short name forms are \r
+  // first few charters to match the full device name. Short name forms are\r
   // legal from the caller.\r
   //\r
   Status = EFI_SUCCESS;\r
@@ -767,7 +767,7 @@ EfiOpen (
       File->EfiHandle = mFs[DevNumber];\r
       Status = EblFileDevicePath (File, &PathName[FileStart], OpenMode);\r
 \r
-    } else if (PathName[1] == 'v' || PathName[1] == 'V') { \r
+    } else if (PathName[1] == 'v' || PathName[1] == 'V') {\r
       if (DevNumber >= mFvCount) {\r
         goto ErrorExit;\r
       }\r
@@ -784,7 +784,7 @@ EfiOpen (
       for (Index = FileStart; PathName[Index] != '\0'; Index++) {\r
         if (PathName[Index] == ':') {\r
           // Support fv0:\DxeCore:0x10\r
-          // This means open the PE32 Section of the file \r
+          // This means open the PE32 Section of the file\r
           ModifiedSectionType = (EFI_SECTION_TYPE)AsciiStrHexToUintn (&PathName[Index + 1]);\r
           PathName[Index] = '\0';\r
         }\r
@@ -960,7 +960,7 @@ EfiCopyFile (
     if (EFI_ERROR(Status)) {\r
       AsciiPrint("Write file error %r\n", Status);\r
       goto Exit;\r
-    }    \r
+    }\r
   }\r
 \r
   // Any left over?\r
@@ -977,7 +977,7 @@ EfiCopyFile (
     if (EFI_ERROR(Status)) {\r
       AsciiPrint("Write file error\n");\r
       goto Exit;\r
-    }    \r
+    }\r
   }\r
 \r
 Exit:\r
@@ -1026,16 +1026,16 @@ EfiDeviceOpenByType (
     DevStr = "loadfile%d:";\r
     break;\r
   case EfiOpenFirmwareVolume:\r
-    DevStr = "fv%d:";    \r
+    DevStr = "fv%d:";\r
     break;\r
   case EfiOpenFileSystem:\r
-    DevStr = "fs%d:";    \r
+    DevStr = "fs%d:";\r
     break;\r
   case EfiOpenBlockIo:\r
-    DevStr = "blk%d:";    \r
+    DevStr = "blk%d:";\r
     break;\r
   case EfiOpenMemoryBuffer:\r
-    DevStr = "a%d:";    \r
+    DevStr = "a%d:";\r
     break;\r
   default:\r
     return NULL;\r
@@ -1074,14 +1074,14 @@ EfiClose (
 \r
     TftpBufferSize = File->Size;\r
     Status = EblMtftp (\r
-      EFI_PXE_BASE_CODE_TFTP_WRITE_FILE, \r
-      File->Buffer, \r
-      TRUE, \r
-      &TftpBufferSize, \r
-      NULL, \r
-      &File->ServerIp, \r
-      (UINT8 *)File->FileName, \r
-      NULL, \r
+      EFI_PXE_BASE_CODE_TFTP_WRITE_FILE,\r
+      File->Buffer,\r
+      TRUE,\r
+      &TftpBufferSize,\r
+      NULL,\r
+      &File->ServerIp,\r
+      (UINT8 *)File->FileName,\r
+      NULL,\r
       FALSE\r
       );\r
     if (EFI_ERROR(Status)) {\r
@@ -1090,7 +1090,7 @@ EfiClose (
     }\r
   }\r
 \r
-  if ((File->Type == EfiOpenLoadFile) || \r
+  if ((File->Type == EfiOpenLoadFile) ||\r
     ((File->Type == EfiOpenTftp) && (File->IsBufferValid == TRUE)) ||\r
     ((File->Type == EfiOpenFirmwareVolume) && (File->IsBufferValid == TRUE))) {\r
     EblFreePool(File->Buffer);\r
@@ -1112,9 +1112,9 @@ EfiClose (
 \r
 \r
 /**\r
-Return the size of the file represented by Stream. Also return the current \r
+Return the size of the file represented by Stream. Also return the current\r
 Seek position. Opening a file will enable a valid file size to be returned.\r
-LoadFile is an exception as a load file size is set to zero. \r
+LoadFile is an exception as a load file size is set to zero.\r
 \r
 @param  Stream    Open File Handle\r
 \r
@@ -1176,7 +1176,7 @@ EfiTell (
 \r
 /**\r
 Seek to the Offset location in the file. LoadFile and FV device types do\r
-not support EfiSeek(). It is not possible to grow the file size using \r
+not support EfiSeek(). It is not possible to grow the file size using\r
 EfiSeek().\r
 \r
 SeekType defines how use Offset to calculate the new file position:\r
@@ -1185,7 +1185,7 @@ EfiSeekCurrent: Position is Offset bytes from the current position
 EfiSeekEnd    : Only supported if Offset is zero to seek to end of file.\r
 \r
 @param  Stream    Open File Handle\r
-@param  Offset    Offset to seek too. \r
+@param  Offset    Offset to seek too.\r
 @param  SeekType  Type of seek to perform\r
 \r
 \r
@@ -1278,14 +1278,14 @@ CacheTftpFile (
   TftpBufferSize = File->Size;\r
 \r
   Status = EblMtftp (\r
-    EFI_PXE_BASE_CODE_TFTP_READ_FILE, \r
-    File->Buffer, \r
-    FALSE, \r
-    &TftpBufferSize, \r
-    NULL, \r
-    &File->ServerIp, \r
-    (UINT8 *)File->FileName, \r
-    NULL, \r
+    EFI_PXE_BASE_CODE_TFTP_READ_FILE,\r
+    File->Buffer,\r
+    FALSE,\r
+    &TftpBufferSize,\r
+    NULL,\r
+    &File->ServerIp,\r
+    (UINT8 *)File->FileName,\r
+    NULL,\r
     FALSE);\r
   if (EFI_ERROR(Status)) {\r
     AsciiPrint("TFTP error during APPLE_NSP_TFTP_READ_FILE: %r\n", Status);\r
@@ -1301,10 +1301,10 @@ CacheTftpFile (
 \r
 /**\r
 Read BufferSize bytes from the current location in the file. For load file,\r
-FV, and TFTP case you must read the entire file. \r
+FV, and TFTP case you must read the entire file.\r
 \r
 @param  Stream      Open File Handle\r
-@param  Buffer      Caller allocated buffer. \r
+@param  Buffer      Caller allocated buffer.\r
 @param  BufferSize  Size of buffer in bytes.\r
 \r
 \r
@@ -1345,7 +1345,7 @@ EfiRead (
 \r
   case EfiOpenFirmwareVolume:\r
     if (CompareGuid (&File->FvNameGuid, &gZeroGuid)) {\r
-      // This is the entire FV device, so treat like a memory buffer \r
+      // This is the entire FV device, so treat like a memory buffer\r
       CopyMem (Buffer, (VOID *)(UINTN)(File->FvStart + File->CurrentPosition), *BufferSize);\r
       File->CurrentPosition += *BufferSize;\r
       Status = EFI_SUCCESS;\r
@@ -1429,13 +1429,13 @@ EfiRead (
 \r
 /**\r
 Read the entire file into a buffer. This routine allocates the buffer and\r
-returns it to the user full of the read data. \r
+returns it to the user full of the read data.\r
 \r
 This is very useful for load file where it's hard to know how big the buffer\r
 must be.\r
 \r
 @param  Stream      Open File Handle\r
-@param  Buffer      Pointer to buffer to return. \r
+@param  Buffer      Pointer to buffer to return.\r
 @param  BufferSize  Pointer to Size of buffer return..\r
 \r
 \r
@@ -1471,10 +1471,10 @@ EfiReadAllocatePool (
 \r
 \r
 /**\r
-Write data back to the file. For TFTP case you must write the entire file. \r
+Write data back to the file. For TFTP case you must write the entire file.\r
 \r
 @param  Stream      Open File Handle\r
-@param  Buffer      Pointer to buffer to return. \r
+@param  Buffer      Pointer to buffer to return.\r
 @param  BufferSize  Pointer to Size of buffer return..\r
 \r
 \r
@@ -1494,7 +1494,7 @@ EfiWrite (
 {\r
   EFI_STATUS              Status;\r
   EFI_FV_WRITE_FILE_DATA  FileData;\r
-  EFI_DISK_IO_PROTOCOL    *DiskIo;  \r
+  EFI_DISK_IO_PROTOCOL    *DiskIo;\r
 \r
   if (!FileHandleValid (File)) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -1592,7 +1592,7 @@ EfiWrite (
 \r
 \r
 /**\r
-Given Cwd expand Path to remove .. and replace them with real \r
+Given Cwd expand Path to remove .. and replace them with real\r
 directory names.\r
 \r
 @param  Cwd     Current Working Directory\r
@@ -1636,9 +1636,9 @@ ExpandPath (
     if (Work == NULL) {\r
       // Remaining part of Path contains no more ..\r
       break;\r
-    } \r
+    }\r
 \r
-    // append path prior to .. \r
+    // append path prior to ..\r
     AsciiStrnCat (NewPath, Start, Work - Start);\r
     StrLen = AsciiStrLen (NewPath);\r
     for (i = StrLen; i >= 0; i--) {\r
@@ -1659,7 +1659,7 @@ ExpandPath (
     }\r
 \r
     Start = Work + 3;\r
-  } \r
+  }\r
 \r
   // Handle the path that remains after the ..\r
   AsciiStrnCat (NewPath, Start, End - Start);\r
@@ -1682,7 +1682,7 @@ the path does not contain a device name, The CWD is prepended to the path.
 EFI_STATUS\r
 EfiSetCwd (\r
   IN  CHAR8   *Cwd\r
-  ) \r
+  )\r
 {\r
   EFI_OPEN_FILE *File;\r
   UINTN         Len;\r
@@ -1700,7 +1700,7 @@ EfiSetCwd (
   Path = Cwd;\r
   if (AsciiStrStr (Cwd, "..") != NULL) {\r
     if (gCwd == NULL) {\r
-      // no parent \r
+      // no parent\r
       return EFI_SUCCESS;\r
     }\r
 \r
@@ -1754,10 +1754,10 @@ EfiSetCwd (
 Set the Current Working Directory (CWD). If a call is made to EfiOpen () and\r
 the path does not contain a device name, The CWD is prepended to the path.\r
 The CWD buffer is only valid until a new call is made to EfiSetCwd(). After\r
-a call to EfiSetCwd() it is not legal to use the pointer returned by \r
+a call to EfiSetCwd() it is not legal to use the pointer returned by\r
 this function.\r
 \r
-@param  Cwd     Current Working Directory \r
+@param  Cwd     Current Working Directory\r
 \r
 \r
 @return ""      No CWD set\r