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