The `libefi-fshelp' library can be used by drivers that want to implement the `simple file system' protocol. The library presents a complete interface, but communicates with the file system backend through a minimal API. The interface is defined in the gnu/efi/util/fshelp.h header.
The file system backend defines a type `efi_fshelp_node_t' that
represents a node in the file system. The type is fully opaque to the
library. Nodes are reference counted. The library can at any time
obtain an extra reference by calling the reference
operation on
the node, or release a reference by invoking release
. It is up
to the file system implementation to maintain references.
Install all the protocol interfaces that the library defines on the controller specified by controller. fshelp is the fshelp instance that will be used through out the lifetime of the protocols. ops is the file system backend operations vector.
The efi_fshelp_ops
vector contains the following operations:
Try to mount file system and return a reference to node in *root.
Obtain reference to node specified by node.
Release reference to node specified by node, possible destroy it.
Retreive information about the node node and store it in the buffer specified by info. The backend may in turn cache the information for higher performance.
Set information about the node node given the information in info.
Read a directory entry at the position specified by *fpos from node dir. If no more directory entries could be read, the operation should return
EFI_NOT_FOUND
. A reference to the node in the read directory entry is returned in *nodep, and the name of the entry in *namep. The caller is resposible for releasing the reference to *nodep and freeing the memory of *namep. The position *fpos should be updated on a successful read.
Read data from the node node at position given by fpos. The amount of data to read is determined by *size, which will be updated with the actual amount of data read on return. On return, if *size is zero there is no more data to read. The data will be read into buffer buffer.
The library also implements a set of helper functions that can be used to more easily implement some of the fshelp operations.
Read *size bytes from the node node into the buffer buffer, beginning with the block pos. read hook is used to read disk blocks. read_data will be passed to the hook as the first argument. block hook is used to translate file blocks to disk blocks. The file is FILESIZE bytes big and the blocks have a size of log2blocksize (in log2, units of 512 bytes blocks).