]> git.proxmox.com Git - mirror_edk2.git/blame - FatPkg/EnhancedFatDxe/OpenVolume.c
FatPkg/EnhancedFatDxe: Make the comments align with EDKIIcoding style
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / OpenVolume.c
CommitLineData
cae7420b
DB
1/** @file\r
2 OpenVolume() function of Simple File System Protocol.\r
b9ec9330 3\r
149d6335 4Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
6163cc98 5This program and the accompanying materials are licensed and made available\r
b9ec9330
QH
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
cae7420b 13**/\r
b9ec9330 14\r
cae7420b 15#include "Fat.h"\r
b9ec9330 16\r
cae7420b 17/**\r
b9ec9330 18\r
cae7420b 19 Implements Simple File System Protocol interface function OpenVolume().\r
b9ec9330 20\r
cae7420b
DB
21 @param This - Calling context.\r
22 @param File - the Root Directory of the volume.\r
b9ec9330 23\r
cae7420b
DB
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
b9ec9330 27\r
cae7420b 28**/\r
b9ec9330
QH
29EFI_STATUS\r
30EFIAPI\r
31FatOpenVolume (\r
32 IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,\r
dba03ba1 33 OUT EFI_FILE_PROTOCOL **File\r
b9ec9330 34 )\r
b9ec9330
QH
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
149d6335 60 Status = FatCleanupVolume (Volume, Volume->Root, Status, NULL);\r
b9ec9330
QH
61 FatReleaseLock ();\r
62\r
63 return Status;\r
64}\r