/*++\r
\r
-Copyright (c) 2005 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials are licensed and made available\r
+Copyright (c) 2005 - 2013, 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
FatAllocateVolume (\r
IN EFI_HANDLE Handle,\r
IN EFI_DISK_IO_PROTOCOL *DiskIo,\r
+ IN EFI_DISK_IO2_PROTOCOL *DiskIo2,\r
IN EFI_BLOCK_IO_PROTOCOL *BlockIo\r
)\r
/*++\r
{\r
EFI_STATUS Status;\r
FAT_VOLUME *Volume;\r
- BOOLEAN LockedByMe;\r
- LockedByMe = FALSE;\r
+\r
//\r
// Allocate a volume structure\r
//\r
if (Volume == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
- //\r
- // Acquire the lock.\r
- // If caller has already acquired the lock, cannot lock it again.\r
- //\r
- if (!FatIsLocked ()) {\r
- FatAcquireLock ();\r
- LockedByMe = TRUE;\r
- }\r
+\r
//\r
// Initialize the structure\r
//\r
Volume->Signature = FAT_VOLUME_SIGNATURE;\r
Volume->Handle = Handle;\r
Volume->DiskIo = DiskIo;\r
+ Volume->DiskIo2 = DiskIo2;\r
Volume->BlockIo = BlockIo;\r
Volume->MediaId = BlockIo->Media->MediaId;\r
Volume->ReadOnly = BlockIo->Media->ReadOnly;\r
//\r
// Volume installed\r
//\r
- DEBUG ((EFI_D_INIT, "%HInstalled Fat filesystem on %x%N\n", Handle));\r
+ DEBUG ((EFI_D_INIT, "Installed Fat filesystem on %p\n", Handle));\r
Volume->Valid = TRUE;\r
\r
Done:\r
- //\r
- // Unlock if locked by myself.\r
- //\r
- if (LockedByMe) {\r
- FatReleaseLock ();\r
- }\r
-\r
if (EFI_ERROR (Status)) {\r
FatFreeVolume (Volume);\r
}\r
// means we are in the process of some Fat operation),\r
// we can not acquire again.\r
//\r
- if (!FatIsLocked ()) {\r
+ Status = FatAcquireLockOrFail ();\r
+ if (!EFI_ERROR (Status)) {\r
LockedByMe = TRUE;\r
- FatAcquireLock ();\r
}\r
//\r
// The volume is still being used. Hence, set error flag for all OFiles still in\r
// FatCleanupVolume do the task.\r
//\r
if (LockedByMe) {\r
- FatCleanupVolume (Volume, NULL, EFI_SUCCESS);\r
+ FatCleanupVolume (Volume, NULL, EFI_SUCCESS, NULL);\r
FatReleaseLock ();\r
}\r
\r
if (FatType == FAT32) {\r
Volume->FreeInfoPos = FatBs.FatBse.Fat32Bse.FsInfoSector * BlockSize;\r
if (FatBs.FatBse.Fat32Bse.FsInfoSector != 0) {\r
- FatDiskIo (Volume, READ_DISK, Volume->FreeInfoPos, sizeof (FAT_INFO_SECTOR), &Volume->FatInfoSector);\r
+ FatDiskIo (Volume, READ_DISK, Volume->FreeInfoPos, sizeof (FAT_INFO_SECTOR), &Volume->FatInfoSector, NULL);\r
if (Volume->FatInfoSector.Signature == FAT_INFO_SIGNATURE &&\r
Volume->FatInfoSector.InfoBeginSignature == FAT_INFO_BEGIN_SIGNATURE &&\r
Volume->FatInfoSector.InfoEndSignature == FAT_INFO_END_SIGNATURE &&\r