]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Disk/PartitionDxe/Udf.c
MdeModulePkg/Udf: Refine function description comments
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / PartitionDxe / Udf.c
index c1d44809bfd2cf952a5ce5848d6b188dd1113fc0..c566bfc594d7ced79abd6703b6a86769b7fccb23 100644 (file)
@@ -40,6 +40,18 @@ UDF_DEVICE_PATH gUdfDevicePath = {
   }\r
 };\r
 \r
+/**\r
+  Find the anchor volume descriptor pointer.\r
+\r
+  @param[in]  BlockIo             BlockIo interface.\r
+  @param[in]  DiskIo              DiskIo interface.\r
+  @param[out] AnchorPoint         Anchor volume descriptor pointer.\r
+\r
+  @retval EFI_SUCCESS             Anchor volume descriptor pointer found.\r
+  @retval EFI_VOLUME_CORRUPTED    The file system structures are corrupted.\r
+  @retval other                   Anchor volume descriptor pointer not found.\r
+\r
+**/\r
 EFI_STATUS\r
 FindAnchorVolumeDescriptorPointer (\r
   IN   EFI_BLOCK_IO_PROTOCOL                 *BlockIo,\r
@@ -48,11 +60,18 @@ FindAnchorVolumeDescriptorPointer (
   )\r
 {\r
   EFI_STATUS  Status;\r
-  UINT32      BlockSize = BlockIo->Media->BlockSize;\r
-  EFI_LBA     EndLBA = BlockIo->Media->LastBlock;\r
-  EFI_LBA     DescriptorLBAs[] = { 256, EndLBA - 256, EndLBA, 512 };\r
+  UINT32      BlockSize;\r
+  EFI_LBA     EndLBA;\r
+  EFI_LBA     DescriptorLBAs[4];\r
   UINTN       Index;\r
 \r
+  BlockSize = BlockIo->Media->BlockSize;\r
+  EndLBA = BlockIo->Media->LastBlock;\r
+  DescriptorLBAs[0] = 256;\r
+  DescriptorLBAs[1] = EndLBA - 256;\r
+  DescriptorLBAs[2] = EndLBA;\r
+  DescriptorLBAs[3] = 512;\r
+\r
   for (Index = 0; Index < ARRAY_SIZE (DescriptorLBAs); Index++) {\r
     Status = DiskIo->ReadDisk (\r
       DiskIo,\r
@@ -236,6 +255,7 @@ PartitionInstallUdfChildHandles (
   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath\r
   )\r
 {\r
+  UINT32                       RemainderByMediaBlockSize;\r
   EFI_STATUS                   Status;\r
   EFI_BLOCK_IO_MEDIA           *Media;\r
   EFI_DEVICE_PATH_PROTOCOL     *DevicePathNode;\r
@@ -248,8 +268,12 @@ PartitionInstallUdfChildHandles (
   //\r
   // Check if UDF logical block size is multiple of underlying device block size\r
   //\r
-  if ((UDF_LOGICAL_SECTOR_SIZE % Media->BlockSize) != 0 ||\r
-      Media->BlockSize > UDF_LOGICAL_SECTOR_SIZE) {\r
+  DivU64x32Remainder (\r
+    UDF_LOGICAL_SECTOR_SIZE,   // Dividend\r
+    Media->BlockSize,          // Divisor\r
+    &RemainderByMediaBlockSize // Remainder\r
+    );\r
+  if (RemainderByMediaBlockSize != 0) {\r
     return EFI_NOT_FOUND;\r
   }\r
 \r