TianoCore EDK2 master
Loading...
Searching...
No Matches
File.c File Reference
#include "Udf.h"

Go to the source code of this file.

Macros

#define _ROOT_FILE(_PrivData)   (_PrivData)->Root
 
#define _PARENT_FILE(_PrivData)    ((_PrivData)->IsRootDirectory ? (_PrivData)->Root : &(_PrivData)->File)
 
#define _FILE(_PrivData)   _PARENT_FILE(_PrivData)
 

Functions

EFI_STATUS EFIAPI UdfOpenVolume (IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This, OUT EFI_FILE_PROTOCOL **Root)
 
EFI_STATUS EFIAPI UdfOpen (IN EFI_FILE_PROTOCOL *This, OUT EFI_FILE_PROTOCOL **NewHandle, IN CHAR16 *FileName, IN UINT64 OpenMode, IN UINT64 Attributes)
 
EFI_STATUS EFIAPI UdfRead (IN EFI_FILE_PROTOCOL *This, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI UdfClose (IN EFI_FILE_PROTOCOL *This)
 
EFI_STATUS EFIAPI UdfDelete (IN EFI_FILE_PROTOCOL *This)
 
EFI_STATUS EFIAPI UdfWrite (IN EFI_FILE_PROTOCOL *This, IN OUT UINTN *BufferSize, IN VOID *Buffer)
 
EFI_STATUS EFIAPI UdfGetPosition (IN EFI_FILE_PROTOCOL *This, OUT UINT64 *Position)
 
EFI_STATUS EFIAPI UdfSetPosition (IN EFI_FILE_PROTOCOL *This, IN UINT64 Position)
 
EFI_STATUS EFIAPI UdfGetInfo (IN EFI_FILE_PROTOCOL *This, IN EFI_GUID *InformationType, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI UdfSetInfo (IN EFI_FILE_PROTOCOL *This, IN EFI_GUID *InformationType, IN UINTN BufferSize, IN VOID *Buffer)
 
EFI_STATUS EFIAPI UdfFlush (IN EFI_FILE_PROTOCOL *This)
 

Variables

EFI_FILE_PROTOCOL gUdfFileIoOps
 

Detailed Description

Handle operations in files and directories from UDF/ECMA-167 file systems.

Copyright (C) 2014-2017 Paulo Alcantara pcacj.nosp@m.r@zy.nosp@m.tor.c.nosp@m.om Copyright (c) 2018, Intel Corporation. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file File.c.

Macro Definition Documentation

◆ _FILE

#define _FILE (   _PrivData)    _PARENT_FILE(_PrivData)

Definition at line 33 of file File.c.

◆ _PARENT_FILE

#define _PARENT_FILE (   _PrivData)     ((_PrivData)->IsRootDirectory ? (_PrivData)->Root : &(_PrivData)->File)

Definition at line 31 of file File.c.

◆ _ROOT_FILE

#define _ROOT_FILE (   _PrivData)    (_PrivData)->Root

Definition at line 30 of file File.c.

Function Documentation

◆ UdfClose()

EFI_STATUS EFIAPI UdfClose ( IN EFI_FILE_PROTOCOL This)

Close the file handle.

Parameters
ThisProtocol instance pointer.
Return values
EFI_SUCCESSThe file was closed.

Definition at line 548 of file File.c.

◆ UdfDelete()

EFI_STATUS EFIAPI UdfDelete ( IN EFI_FILE_PROTOCOL This)

Close and delete the file handle.

Parameters
ThisProtocol instance pointer.
Return values
EFI_SUCCESSThe file was closed and deleted.
EFI_WARN_DELETE_FAILUREThe handle was closed but the file was not deleted.

Definition at line 595 of file File.c.

◆ UdfFlush()

EFI_STATUS EFIAPI UdfFlush ( IN EFI_FILE_PROTOCOL This)

Flush data back for the file handle.

Parameters
ThisProtocol instance pointer.
Return values
EFI_SUCCESSData was flushed.
EFI_UNSUPPORTEDWrites to Open directory are not supported.
EFI_NO_MEDIAThe device has no media.
EFI_DEVICE_ERRORThe device reported an error.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted.
EFI_WRITE_PROTECTEDThe device is write protected.
EFI_ACCESS_DENIEDThe file was open for read only.
EFI_VOLUME_FULLThe volume is full.

Definition at line 912 of file File.c.

◆ UdfGetInfo()

EFI_STATUS EFIAPI UdfGetInfo ( IN EFI_FILE_PROTOCOL This,
IN EFI_GUID InformationType,
IN OUT UINTN BufferSize,
OUT VOID *  Buffer 
)

Get information about a file.

Parameters
ThisProtocol instance pointer.
InformationTypeType of information to return in Buffer.
BufferSizeOn input size of buffer, on output amount of data in buffer.
BufferThe buffer to return data.
Return values
EFI_SUCCESSData was returned.
EFI_UNSUPPORTEDInformationType is not supported.
EFI_NO_MEDIAThe device has no media.
EFI_DEVICE_ERRORThe device reported an error.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted.
EFI_WRITE_PROTECTEDThe device is write protected.
EFI_ACCESS_DENIEDThe file was open for read only.
EFI_BUFFER_TOO_SMALLBuffer was too small; required size returned in BufferSize.

Definition at line 764 of file File.c.

◆ UdfGetPosition()

EFI_STATUS EFIAPI UdfGetPosition ( IN EFI_FILE_PROTOCOL This,
OUT UINT64 *  Position 
)

Get file's current position.

Parameters
ThisProtocol instance pointer.
PositionByte position from the start of the file.
Return values
EFI_SUCCESSPosition was updated.
EFI_UNSUPPORTEDSeek request for directories is not valid.

Definition at line 654 of file File.c.

◆ UdfOpen()

EFI_STATUS EFIAPI UdfOpen ( IN EFI_FILE_PROTOCOL This,
OUT EFI_FILE_PROTOCOL **  NewHandle,
IN CHAR16 *  FileName,
IN UINT64  OpenMode,
IN UINT64  Attributes 
)

Opens a new file relative to the source file's location.

Parameters
ThisThe protocol instance pointer.
NewHandleReturns File Handle for FileName.
FileNameNull terminated string. "\", ".", and ".." are supported.
OpenModeOpen mode for file.
AttributesOnly used for EFI_FILE_MODE_CREATE.
Return values
EFI_SUCCESSThe device was opened.
EFI_NOT_FOUNDThe specified file could not be found on the device.
EFI_NO_MEDIAThe device has no media.
EFI_MEDIA_CHANGEDThe media has changed.
EFI_DEVICE_ERRORThe device reported an error.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted.
EFI_ACCESS_DENIEDThe service denied access to the file.
EFI_OUT_OF_RESOURCESThe volume was not opened due to lack of resources.
EFI_VOLUME_FULLThe volume is full.

Definition at line 164 of file File.c.

◆ UdfOpenVolume()

EFI_STATUS EFIAPI UdfOpenVolume ( IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL This,
OUT EFI_FILE_PROTOCOL **  Root 
)

Open the root directory on a volume.

Parameters
ThisProtocol instance pointer.
RootReturns an Open file handle for the root directory
Return values
EFI_SUCCESSThe device was opened.
EFI_UNSUPPORTEDThis volume does not support the file system.
EFI_NO_MEDIAThe device has no media.
EFI_DEVICE_ERRORThe device reported an error.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted.
EFI_ACCESS_DENIEDThe service denied access to the file.
EFI_OUT_OF_RESOURCESThe volume was not opened due to lack of resources.

Definition at line 53 of file File.c.

◆ UdfRead()

EFI_STATUS EFIAPI UdfRead ( IN EFI_FILE_PROTOCOL This,
IN OUT UINTN BufferSize,
OUT VOID *  Buffer 
)

Read data from the file.

Parameters
ThisProtocol instance pointer.
BufferSizeOn input size of buffer, on output amount of data in buffer.
BufferThe buffer in which data is read.
Return values
EFI_SUCCESSData was read.
EFI_NO_MEDIAThe device has no media.
EFI_DEVICE_ERRORThe device reported an error.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted.
EFI_BUFFER_TO_SMALLBufferSize is too small. BufferSize contains required size.

Definition at line 317 of file File.c.

◆ UdfSetInfo()

EFI_STATUS EFIAPI UdfSetInfo ( IN EFI_FILE_PROTOCOL This,
IN EFI_GUID InformationType,
IN UINTN  BufferSize,
IN VOID *  Buffer 
)

Set information about a file.

Parameters
ThisProtocol instance pointer.
InformationTypeType of information in Buffer.
BufferSizeSize of buffer.
BufferThe data to write.
Return values
EFI_SUCCESSData was set.
EFI_UNSUPPORTEDInformationType is not supported.
EFI_NO_MEDIAThe device has no media.
EFI_DEVICE_ERRORThe device reported an error.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted.
EFI_WRITE_PROTECTEDThe device is write protected.
EFI_ACCESS_DENIEDThe file was open for read only.

Definition at line 885 of file File.c.

◆ UdfSetPosition()

EFI_STATUS EFIAPI UdfSetPosition ( IN EFI_FILE_PROTOCOL This,
IN UINT64  Position 
)

Set file's current position.

Parameters
ThisProtocol instance pointer.
PositionByte position from the start of the file.
Return values
EFI_SUCCESSPosition was updated.
EFI_UNSUPPORTEDSeek request for non-zero is not valid on open.

Definition at line 695 of file File.c.

◆ UdfWrite()

EFI_STATUS EFIAPI UdfWrite ( IN EFI_FILE_PROTOCOL This,
IN OUT UINTN BufferSize,
IN VOID *  Buffer 
)

Write data to a file.

Parameters
ThisProtocol instance pointer.
BufferSizeOn input size of buffer, on output amount of data in buffer.
BufferThe buffer in which data to write.
Return values
EFI_SUCCESSData was written.
EFI_UNSUPPORTEDWrites to Open directory are not supported.
EFI_NO_MEDIAThe device has no media.
EFI_DEVICE_ERRORThe device reported an error.
EFI_DEVICE_ERRORAn attempt was made to write to a deleted file.
EFI_VOLUME_CORRUPTEDThe file system structures are corrupted.
EFI_WRITE_PROTECTEDThe device is write protected.
EFI_ACCESS_DENIEDThe file was open for read only.
EFI_VOLUME_FULLThe volume is full.

Definition at line 633 of file File.c.

Variable Documentation

◆ gUdfFileIoOps

EFI_FILE_PROTOCOL gUdfFileIoOps
Initial value:
= {
EFI_FILE_PROTOCOL_REVISION,
}
EFI_STATUS EFIAPI UdfFlush(IN EFI_FILE_PROTOCOL *This)
Definition: File.c:912
EFI_STATUS EFIAPI UdfRead(IN EFI_FILE_PROTOCOL *This, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
Definition: File.c:317
EFI_STATUS EFIAPI UdfSetInfo(IN EFI_FILE_PROTOCOL *This, IN EFI_GUID *InformationType, IN UINTN BufferSize, IN VOID *Buffer)
Definition: File.c:885
EFI_STATUS EFIAPI UdfGetPosition(IN EFI_FILE_PROTOCOL *This, OUT UINT64 *Position)
Definition: File.c:654
EFI_STATUS EFIAPI UdfGetInfo(IN EFI_FILE_PROTOCOL *This, IN EFI_GUID *InformationType, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
Definition: File.c:764
EFI_STATUS EFIAPI UdfClose(IN EFI_FILE_PROTOCOL *This)
Definition: File.c:548
EFI_STATUS EFIAPI UdfDelete(IN EFI_FILE_PROTOCOL *This)
Definition: File.c:595
EFI_STATUS EFIAPI UdfSetPosition(IN EFI_FILE_PROTOCOL *This, IN UINT64 Position)
Definition: File.c:695
EFI_STATUS EFIAPI UdfWrite(IN EFI_FILE_PROTOCOL *This, IN OUT UINTN *BufferSize, IN VOID *Buffer)
Definition: File.c:633
EFI_STATUS EFIAPI UdfOpen(IN EFI_FILE_PROTOCOL *This, OUT EFI_FILE_PROTOCOL **NewHandle, IN CHAR16 *FileName, IN UINT64 OpenMode, IN UINT64 Attributes)
Definition: File.c:164
#define NULL
Definition: Base.h:319

Definition at line 12 of file File.c.