[−][src]Trait uefi::proto::media::file::File
Common interface to FileHandle
, RegularFile
, and Directory
.
File
contains all functionality that is safe to perform on any type of
file handle.
Provided methods
fn open(
&mut self,
filename: &str,
open_mode: FileMode,
attributes: FileAttribute
) -> Result<FileHandle>
&mut self,
filename: &str,
open_mode: FileMode,
attributes: FileAttribute
) -> Result<FileHandle>
Try to open a file relative to this file.
Arguments
filename
Path of file to open, relative to this fileopen_mode
The mode to open the file withattributes
Only valid whenFILE_MODE_CREATE
is used as a mode
Errors
uefi::Status::INVALID_PARAMETER
The filename exceeds the maximum length of 255 charsuefi::Status::NOT_FOUND
Could not find fileuefi::Status::NO_MEDIA
The device has no mediauefi::Status::MEDIA_CHANGED
The device has a different medium in ituefi::Status::DEVICE_ERROR
The device reported an erroruefi::Status::VOLUME_CORRUPTED
The filesystem structures are corrupteduefi::Status::WRITE_PROTECTED
Write/Create attempted on readonly fileuefi::Status::ACCESS_DENIED
The service denied access to the fileuefi::Status::OUT_OF_RESOURCES
Not enough resources to open fileuefi::Status::VOLUME_FULL
The volume is full
fn close(self)
Close this file handle. Same as dropping this structure.
fn delete(self) -> Result
Closes and deletes this file
Warnings
uefi::Status::WARN_DELETE_FAILURE
The file was closed, but deletion failed
fn get_info<'buf, Info: FileProtocolInfo + ?Sized>(
&mut self,
buffer: &'buf mut [u8]
) -> Result<&'buf mut Info, Option<usize>>
&mut self,
buffer: &'buf mut [u8]
) -> Result<&'buf mut Info, Option<usize>>
Queries some information about a file
The information will be written into a user-provided buffer. If the buffer is too small, the required buffer size will be returned as part of the error.
The buffer must be aligned on an <Info as Align>::alignment()
boundary.
Arguments
buffer
Buffer that the information should be written into
Errors
uefi::Status::UNSUPPORTED
The file does not possess this information typeuefi::Status::NO_MEDIA
The device has no mediumuefi::Status::DEVICE_ERROR
The device reported an erroruefi::Status::VOLUME_CORRUPTED
The file system structures are corrupteduefi::Status::BUFFER_TOO_SMALL
The buffer is too small for the requested
fn set_info<Info: FileProtocolInfo + ?Sized>(&mut self, info: &Info) -> Result
Sets some information about a file
There are various restrictions on the information that may be modified using this method.
The simplest one is that it is usually not possible to call it on read-only media. Further
restrictions specific to a given information type are described in the corresponding
FileProtocolInfo
type documentation.
Arguments
info
Info that should be set for the file
Errors
uefi::Status::UNSUPPORTED
The file does not possess this information typeuefi::Status::NO_MEDIA
The device has no mediumuefi::Status::DEVICE_ERROR
The device reported an erroruefi::Status::VOLUME_CORRUPTED
The file system structures are corrupteduefi::Status::WRITE_PROTECTED
Attempted to set information on a read-only mediauefi::Status::ACCESS_DENIED
Requested change is invalid for this information typeuefi::Status::VOLUME_FULL
Not enough space left on the volume to change the info
fn flush(&mut self) -> Result
Flushes all modified data associated with the file handle to the device
Errors
uefi::Status::NO_MEDIA
The device has no mediauefi::Status::DEVICE_ERROR
The device reported an erroruefi::Status::VOLUME_CORRUPTED
The filesystem structures are corrupteduefi::Status::WRITE_PROTECTED
The file or medium is write protecteduefi::Status::ACCESS_DENIED
The file was opened read onlyuefi::Status::VOLUME_FULL
The volume is full