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