]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | OpenVolume() function of Simple File System Protocol.\r | |
3 | \r | |
4 | Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials are licensed and made available\r | |
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 | |
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 | |
29 | EFI_STATUS\r | |
30 | EFIAPI\r | |
31 | FatOpenVolume (\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 | |
58 | Done:\r | |
59 | \r | |
60 | Status = FatCleanupVolume (Volume, Volume->Root, Status, NULL);\r | |
61 | FatReleaseLock ();\r | |
62 | \r | |
63 | return Status;\r | |
64 | }\r |