]>
Commit | Line | Data |
---|---|---|
cae7420b DB |
1 | /** @file\r |
2 | OpenVolume() function of Simple File System Protocol.\r | |
b9ec9330 | 3 | \r |
149d6335 | 4 | Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r |
6163cc98 | 5 | This program and the accompanying materials are licensed and made available\r |
b9ec9330 QH |
6 | under the terms and conditions of the BSD License which accompanies this\r |
7 | distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT 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 |
29 | EFI_STATUS\r |
30 | EFIAPI\r | |
31 | FatOpenVolume (\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 | |
58 | Done:\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 |