文件打开及读写、定位¶
Protocol¶
Protocol/SimpleFileSystem.h
它可以让我们访问FAT文件系统,包括 FAT12/FAT16/FAT132
The SimpleFileSystem protocol is the programmatic access to the FAT (12,16,32) file system specified in UEFI 2.0. It can also be used to abstract a file
system other than FAT.
打开及使用详见 docs/boot/protocol/sfs.md
Overview¶
初始化"文件服务".
在默认情况下,第一个 Handle 是当前程序所在的设备Handle,所以打开的根目录应该是当前程序所在的文件系统的根目录.
打开文件
忽略 gFileProtocol->Open 的 Attributes <- 0.
使之更好编码,多个Mode可以相或.
TODO: 文件的覆盖操作
文件读取
文件写入
在没有设置的情况下,从指针位置为0处开始覆写
FileWrite 执行并不会马上就写入设备,而是先写入所谓的缓存.
Flushes all modified data associated with a file to a device.
此函数基于 EFI_FILE_PROTOCOL.Flush,EFI_FILE_PROTOCOL.Close 也会写入.
设置位置
获取位置
所有封装基于gFileProtocol.
src/boot/SigmaBootPkg/File.csrc/include/boot/File.h