EFI SIMPLE FILE SYSTEM PROTOCOL

From PhoenixWiki

Jump to: navigation, search

Provides a minimal interface for file-type access to a device.

Contents

GUID

#define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
  {0x0964e5b22,0x6459,0x11d2,0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b}

Protocol Interface Structure

#include EFI_PROTOCOL_CONSUMER(SimpleFileSystem)

extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;
typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {
  UINT64                                      Revision;
  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume;
} EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;
#define EFI_SIMPLE_FILE SYSTEM_PROTOCOL_REVISION 0x00010000

Members

Member Description
Revision The version of the EFI_FILE_SYSTEM_PROTOCOL. The version specified by this specification is 0x00010000. All future revisions must be backwards compatible. If a future version is not backwards compatible, it is not the same GUID.
OpenVolume Opens the volume for file I/O access.

Description

The EFI_SIMPLE_FILE_SYSTEM_PROTOCOL provides a minimal interface for file-type access to a device. This protocol is only supported on some devices.

Devices that support the Simple File System protocol return an EFI_FILE_SYTEM_PROTOCOL. The only function of this interface is to open a handle to the root directory of the file system on the volume.

Once opened, all accesses to the volume are performed through the volume’s file handles, using the EFI_FILE_PROTOCOL protocol. The volume is closed by closing all the open file handles.

The firmware automatically creates handles for any block device that supports the following file system formats:

  • FAT12
  • FAT16
  • FAT32

OpenVolume()

Opens the root directory on a volume.

Prototype

typedef
EFI_STATUS
(EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME) (
  IN EFI_SIMPLE_FILE_SYSTEM PROTOCOL *This,
  OUT EFI_FILE_PROTOCOL **Root);

Parameters

Parameter Description
This A pointer to the volume to open the root directory of.
Root A pointer to the location to return the opened file handle for the root directory.

Description
The OpenVolume() function opens a volume, and returns a file handle to the volume’s root directory. This handle is used to perform all other file I/O operations. The volume remains open until all the file handles to it are closed.

If the medium is changed while there are open file handles to the volume, all file handles to the volume will return EFI_MEDIA_CHANGED. To access the files on the new medium, the volume must be reopened with OpenVolume(). If the new medium is a different file system than the one supplied in the EFI_HANDLE’s DevicePath for the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL, OpenVolume() will return EFI_UNSUPPORTED.

Status Codes Returned

Status Code Description
EFI_SUCCESS The file volume was opened.
EFI_UNSUPPORTED The volume does not support the requested file system type.
EFI_NO_MEDIA The device has no medium.
EFI_DEVICE_ERROR The device reported an error.
EFI_VOLUME_CORRUPTED The file system structures are corrupted.
EFI_ACCESS_DENIED The service denied access to the file.
EFI_OUT_OF_RESOURCES The file volume was not opened.
EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no longer supported. Any existing file handles for this volume are no longer valid. To access the files on the new medium, the volume must be reopened with OpenVolume.

Copyright (C) 2008 Phoenix Technologies Ltd. All Rights Reserved. Portions copyright (C) 2008 UEFI Forum, Inc. Used with permission.

Personal tools