]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - FatPkg/EnhancedFatDxe/OpenVolume.c
ArmVirtPkg: don't set PcdDebugClearMemoryValue
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / OpenVolume.c
... / ...
CommitLineData
1/** @file\r
2 OpenVolume() function of Simple File System Protocol.\r
3\r
4Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
5This program and the accompanying materials are licensed and made available\r
6under the terms and conditions of the BSD License which accompanies this\r
7distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "Fat.h"\r
16\r
17/**\r
18\r
19 Implements Simple File System Protocol interface function OpenVolume().\r
20\r
21 @param This - Calling context.\r
22 @param File - the Root Directory of the volume.\r
23\r
24 @retval EFI_OUT_OF_RESOURCES - Can not allocate the memory.\r
25 @retval EFI_VOLUME_CORRUPTED - The FAT type is error.\r
26 @retval EFI_SUCCESS - Open the volume successfully.\r
27\r
28**/\r
29EFI_STATUS\r
30EFIAPI\r
31FatOpenVolume (\r
32 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,\r
33 OUT EFI_FILE_PROTOCOL **File\r
34 )\r
35{\r
36 EFI_STATUS Status;\r
37 FAT_VOLUME *Volume;\r
38 FAT_IFILE *IFile;\r
39\r
40 Volume = VOLUME_FROM_VOL_INTERFACE (This);\r
41 FatAcquireLock ();\r
42\r
43 //\r
44 // Open Root file\r
45 //\r
46 Status = FatOpenDirEnt (NULL, &Volume->RootDirEnt);\r
47 if (EFI_ERROR (Status)) {\r
48 goto Done;\r
49 }\r
50 //\r
51 // Open a new instance to the root\r
52 //\r
53 Status = FatAllocateIFile (Volume->Root, &IFile);\r
54 if (!EFI_ERROR (Status)) {\r
55 *File = &IFile->Handle;\r
56 }\r
57\r
58Done:\r
59\r
60 Status = FatCleanupVolume (Volume, Volume->Root, Status, NULL);\r
61 FatReleaseLock ();\r
62\r
63 return Status;\r
64}\r