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