From 25ce9b1f060d27a4f893d3b494007ae74dd425bf Mon Sep 17 00:00:00 2001 From: Qing Huang Date: Thu, 18 Mar 2010 01:56:21 +0000 Subject: [PATCH] Fix a migration bug in Fat driver as the value of lock has been changed from EDK library to EDKII library (based on FatPkg commit c243d2ce08e76bfaefc0a3e9256603993a3b5ebe) [jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD] Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen Acked-by: Mark Doran Acked-by: Laszlo Ersek --- FatPkg/EnhancedFatDxe/Fat.h | 6 +++--- FatPkg/EnhancedFatDxe/Init.c | 10 +++++----- FatPkg/EnhancedFatDxe/Misc.c | 16 +++++++++------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h index 56822f723a..1b1d424637 100644 --- a/FatPkg/EnhancedFatDxe/Fat.h +++ b/FatPkg/EnhancedFatDxe/Fat.h @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2005 - 2009, Intel Corporation +Copyright (c) 2005 - 2010, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -783,8 +783,8 @@ FatReleaseLock ( VOID ); -BOOLEAN -FatIsLocked ( +EFI_STATUS +FatAcquireLockOrFail ( VOID ); diff --git a/FatPkg/EnhancedFatDxe/Init.c b/FatPkg/EnhancedFatDxe/Init.c index b0e34d18cd..e18ff54474 100644 --- a/FatPkg/EnhancedFatDxe/Init.c +++ b/FatPkg/EnhancedFatDxe/Init.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2005 - 2007, Intel Corporation +Copyright (c) 2005 - 2010, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -64,8 +64,8 @@ Returns: // Acquire the lock. // If caller has already acquired the lock, cannot lock it again. // - if (!FatIsLocked ()) { - FatAcquireLock (); + Status = FatAcquireLockOrFail (); + if (!EFI_ERROR (Status)) { LockedByMe = TRUE; } // @@ -180,9 +180,9 @@ Returns: // means we are in the process of some Fat operation), // we can not acquire again. // - if (!FatIsLocked ()) { + Status = FatAcquireLockOrFail (); + if (!EFI_ERROR (Status)) { LockedByMe = TRUE; - FatAcquireLock (); } // // The volume is still being used. Hence, set error flag for all OFiles still in diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c index a06914fd19..8774ac8c11 100644 --- a/FatPkg/EnhancedFatDxe/Misc.c +++ b/FatPkg/EnhancedFatDxe/Misc.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2005, Intel Corporation +Copyright (c) 2005 - 2010, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -140,15 +140,17 @@ Returns: EfiAcquireLock (&FatFsLock); } -BOOLEAN -FatIsLocked ( +EFI_STATUS +FatAcquireLockOrFail ( VOID ) /*++ Routine Description: - Get the locking status of the volume. + Lock the volume. + If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned. + Otherwise, EFI_SUCCESS is returned. Arguments: @@ -156,12 +158,12 @@ Arguments: Returns: - TRUE - The volume is locked. - FALSE - The volume is not locked. + EFI_SUCCESS - The volume is locked. + EFI_ACCESS_DENIED - The volume could not be locked because it is already locked. --*/ { - return (BOOLEAN) (FatFsLock.Lock); + return EfiAcquireLockOrFail (&FatFsLock); } VOID -- 2.39.2