]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmulatorPkg/Unix/Host/BlockIo.c
EmulatorPkg: Remove all trailing whitespace
[mirror_edk2.git] / EmulatorPkg / Unix / Host / BlockIo.c
index bb2da24d8539cd87b047457340f9d0828e4db330..657ce34e4589a40e89381326621b28f68b26b80b 100644 (file)
@@ -1,13 +1,13 @@
 /**@file\r
 \r
 Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials                          \r
-are licensed and made available under the terms and conditions of the BSD License         \r
-which accompanies this distribution.  The full text of the license may be found at        \r
-http://opensource.org/licenses/bsd-license.php                                            \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
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\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
 \r
@@ -69,7 +69,7 @@ SetFilePointer64 (
   res = lseek (Private->fd, offset, (int)MoveMethod);\r
   if (res == -1) {\r
     Status = EFI_INVALID_PARAMETER;\r
-  } \r
+  }\r
 \r
   if (NewFilePointer != NULL) {\r
     *NewFilePointer = res;\r
@@ -123,13 +123,13 @@ EmuBlockIoOpenDevice (
     Status = EFI_UNSUPPORTED;\r
     goto Done;\r
   }\r
-  \r
+\r
   if (FileSize == 0) {\r
     // lseek fails on a real device. ioctl calls are OS specific\r
 #if __APPLE__\r
     {\r
       UINT32 BlockSize;\r
-     \r
+\r
       if (ioctl (Private->fd, DKIOCGETBLOCKSIZE, &BlockSize) == 0) {\r
         Private->Media->BlockSize = BlockSize;\r
       }\r
@@ -141,13 +141,13 @@ EmuBlockIoOpenDevice (
           Private->Media->LastBlock = Private->NumberOfBlocks - 1;\r
         }\r
       }\r
-      ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);  \r
+      ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);\r
     }\r
-#else \r
+#else\r
     {\r
       size_t BlockSize;\r
       UINT64 DiskSize;\r
-      \r
+\r
       if (ioctl (Private->fd, BLKSSZGET, &BlockSize) == 0) {\r
         Private->Media->BlockSize = BlockSize;\r
       }\r
@@ -157,12 +157,12 @@ EmuBlockIoOpenDevice (
       }\r
     }\r
 #endif\r
-    \r
+\r
   } else {\r
     Private->Media->BlockSize = Private->BlockSize;\r
     Private->NumberOfBlocks = DivU64x32 (FileSize, Private->Media->BlockSize);\r
     Private->Media->LastBlock = Private->NumberOfBlocks - 1;\r
-    \r
+\r
     if (fstatfs (Private->fd, &buf) == 0) {\r
 #if __APPLE__\r
       Private->Media->OptimalTransferLengthGranularity = buf.f_iosize/buf.f_bsize;\r
@@ -170,7 +170,7 @@ EmuBlockIoOpenDevice (
       Private->Media->OptimalTransferLengthGranularity = buf.f_bsize/buf.f_bsize;\r
 #endif\r
     }\r
-  } \r
+  }\r
 \r
   DEBUG ((EFI_D_INIT, "%HEmuOpenBlock: opened %a%N\n", Private->Filename));\r
   Status = EFI_SUCCESS;\r
@@ -198,7 +198,7 @@ EmuBlockIoCreateMapping (
   Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);\r
 \r
   Private->Media = Media;\r
-  \r
+\r
   Media->MediaId          = 0;\r
   Media->RemovableMedia   = Private->RemovableMedia;\r
   Media->MediaPresent     = TRUE;\r
@@ -207,18 +207,18 @@ EmuBlockIoCreateMapping (
   Media->WriteCaching     = FALSE;\r
   Media->IoAlign          = 1;\r
   Media->LastBlock        = 0; // Filled in by OpenDevice\r
-  \r
+\r
   // EFI_BLOCK_IO_PROTOCOL_REVISION2\r
   Media->LowestAlignedLba              = 0;\r
-  Media->LogicalBlocksPerPhysicalBlock = 0; \r
-    \r
+  Media->LogicalBlocksPerPhysicalBlock = 0;\r
+\r
 \r
   // EFI_BLOCK_IO_PROTOCOL_REVISION3\r
   Media->OptimalTransferLengthGranularity = 0;\r
-    \r
+\r
   Status = EmuBlockIoOpenDevice (Private);\r
 \r
-  \r
+\r
   return Status;\r
 }\r
 \r
@@ -299,7 +299,7 @@ EmuBlockIoReadWriteCommon (
   if ((UINTN) Buffer % Private->Media->IoAlign != 0) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-  \r
+\r
   //\r
   // Verify buffer size\r
   //\r
@@ -336,7 +336,7 @@ EmuBlockIoReadWriteCommon (
 \r
 /**\r
   Read BufferSize bytes from Lba into Buffer.\r
-  \r
+\r
   This function reads the requested number of blocks from the device. All the\r
   blocks are read, or an error is returned.\r
   If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and\r
@@ -344,13 +344,13 @@ EmuBlockIoReadWriteCommon (
   not be signaled.\r
 \r
   @param[in]       This       Indicates a pointer to the calling context.\r
-  @param[in]       MediaId    Id of the media, changes every time the media is \r
+  @param[in]       MediaId    Id of the media, changes every time the media is\r
                               replaced.\r
   @param[in]       Lba        The starting Logical Block Address to read from.\r
   @param[in, out]  Token           A pointer to the token associated with the transaction.\r
-  @param[in]       BufferSize Size of Buffer, must be a multiple of device block size.  \r
-  @param[out]      Buffer     A pointer to the destination buffer for the data. The \r
-                              caller is responsible for either having implicit or \r
+  @param[in]       BufferSize Size of Buffer, must be a multiple of device block size.\r
+  @param[out]      Buffer     A pointer to the destination buffer for the data. The\r
+                              caller is responsible for either having implicit or\r
                               explicit ownership of the buffer.\r
 \r
   @retval EFI_SUCCESS           The read request was queued if Token->Event is\r
@@ -362,7 +362,7 @@ EmuBlockIoReadWriteCommon (
   @retval EFI_MEDIA_CHANGED     The MediaId is not for the current media.\r
   @retval EFI_BAD_BUFFER_SIZE   The BufferSize parameter is not a multiple of the\r
                                 intrinsic block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r
+  @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
                                 or the buffer is not on proper alignment.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack\r
                                 of resources.\r
@@ -438,7 +438,7 @@ Done:
   @retval EFI_MEDIA_CHNAGED     The MediaId does not matched the current device.\r
   @retval EFI_DEVICE_ERROR      The device reported an error while performing the write.\r
   @retval EFI_BAD_BUFFER_SIZE   The Buffer was not a multiple of the block size of the device.\r
-  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, \r
+  @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
                                 or the buffer is not on proper alignment.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack\r
                                 of resources.\r
@@ -495,10 +495,10 @@ Done:
 \r
 /**\r
   Flush the Block Device.\r
\r
+\r
   If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED\r
   is returned and non-blocking I/O is being used, the Event associated with\r
-  this request will not be signaled.  \r
+  this request will not be signaled.\r
 \r
   @param[in]      This     Indicates a pointer to the calling context.\r
   @param[in,out]  Token    A pointer to the token associated with the transaction\r
@@ -531,8 +531,8 @@ EmuBlockIoFlushBlocks (
     fcntl (Private->fd, F_FULLFSYNC);\r
 #endif\r
   }\r
-  \r
-  \r
+\r
+\r
   if (Token != NULL) {\r
     if (Token->Event != NULL) {\r
       // Caller is responcible for signaling EFI Event\r
@@ -540,7 +540,7 @@ EmuBlockIoFlushBlocks (
       return EFI_SUCCESS;\r
     }\r
   }\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -585,18 +585,18 @@ StdDupUnicodeToAscii (
   UINTN   Size;\r
   char    *Ascii;\r
   char    *Ptr;\r
-  \r
+\r
   Size = StrLen (Str) + 1;\r
   Ascii = malloc (Size);\r
   if (Ascii == NULL) {\r
     return NULL;\r
   }\r
-  \r
+\r
   for (Ptr = Ascii; *Str != '\0'; Ptr++, Str++) {\r
     *Ptr = *Str;\r
   }\r
   *Ptr = 0;\r
-  \r
+\r
   return Ascii;\r
 }\r
 \r
@@ -616,32 +616,32 @@ EmuBlockIoThunkOpen (
 {\r
   EMU_BLOCK_IO_PRIVATE  *Private;\r
   char                  *Str;\r
-  \r
+\r
   if (This->Private != NULL) {\r
     return EFI_ALREADY_STARTED;\r
   }\r
-  \r
+\r
   if (!CompareGuid (This->Protocol, &gEmuBlockIoProtocolGuid)) {\r
     return EFI_UNSUPPORTED;\r
   }\r
-  \r
+\r
   Private = malloc (sizeof (EMU_BLOCK_IO_PRIVATE));\r
   if (Private == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
-  \r
+\r
   Private->Signature = EMU_BLOCK_IO_PRIVATE_SIGNATURE;\r
   Private->Thunk     = This;\r
   CopyMem (&Private->EmuBlockIo, &gEmuBlockIoProtocol, sizeof (gEmuBlockIoProtocol));\r
   Private->fd        = -1;\r
   Private->BlockSize = 512;\r
\r
+\r
   Private->Filename = StdDupUnicodeToAscii (This->ConfigString);\r
   if (Private->Filename == NULL) {\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
\r
+\r
   Str = strstr (Private->Filename, ":");\r
   if (Str == NULL) {\r
     Private->RemovableMedia = FALSE;\r
@@ -660,7 +660,7 @@ EmuBlockIoThunkOpen (
       }\r
     }\r
   }\r
-  \r
+\r
   This->Interface = &Private->EmuBlockIo;\r
   This->Private   = Private;\r
   return EFI_SUCCESS;\r
@@ -677,17 +677,17 @@ EmuBlockIoThunkClose (
   if (!CompareGuid (This->Protocol, &gEmuBlockIoProtocolGuid)) {\r
     return EFI_UNSUPPORTED;\r
   }\r
-  \r
+\r
   Private = This->Private;\r
-  \r
+\r
   if (This->Private != NULL) {\r
     if (Private->Filename != NULL) {\r
       free (Private->Filename);\r
-    }   \r
+    }\r
     free (This->Private);\r
     This->Private = NULL;\r
   }\r
-  \r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r