See description
Added finding the next free cluster Added name to long name Added long name to short name Added tests for above Added createLongNameEntry + tests Moved tests to bottom Added createShortNameEntry + test Used the RTC for the date and time for the created short entry Tidied createEntries A bit of refactor No symlinks for FAT32 findNextFreeCluster updates FAT Reordered tests to better follow the FAT32FS code FAT32 has no support for symlinks, so removed code around this. Removed open_args from createNode as it doesn't need it Added writeEntries + tests Write the short and long entries to disk findNextFreeCluster update cluster chain with parent cluster Added FAT32 write + tests This Added the ability to create files and directories and write to files. Added location of the short dir entry for the file so can update the size of the file on disk Added folders to the test FAT32 directory. Also fixed minor bug in mkfat32 Added check for destroying the filesystem Fixed error message for cluster size Simpler if condition 0x0FFFFFFF => 0xFFFFFFFF Spelling Fixed test
This commit is contained in:
parent
5fbb8871a4
commit
4afecd6508
19 changed files with 3192 additions and 959 deletions
|
@ -488,7 +488,7 @@ pub fn openDir(path: []const u8, flags: OpenFlags) (Allocator.Error || Error)!*D
|
|||
file.close();
|
||||
break :blk Error.IsAFile;
|
||||
},
|
||||
// We instructed open to folow symlinks above, so this is impossible
|
||||
// We instructed open to follow symlinks above, so this is impossible
|
||||
.Symlink => unreachable,
|
||||
.Dir => &node.Dir,
|
||||
};
|
||||
|
@ -499,7 +499,7 @@ pub fn openDir(path: []const u8, flags: OpenFlags) (Allocator.Error || Error)!*D
|
|||
///
|
||||
/// Arguments:
|
||||
/// IN path: []const u8 - The path to open. Must be absolute (see isAbsolute)
|
||||
/// IN tareget: ?[]const u8 - The target to use when creating the symlink. Can be null if .NO_CREATION is used as the open flag
|
||||
/// IN target: ?[]const u8 - The target to use when creating the symlink. Can be null if .NO_CREATION is used as the open flag
|
||||
/// IN flags: OpenFlags - The flags specifying if this node should be created if it doesn't exist. Cannot be CREATE_FILE
|
||||
///
|
||||
/// Return: []const u8
|
||||
|
@ -552,7 +552,13 @@ pub fn isAbsolute(path: []const u8) bool {
|
|||
/// Arguments:
|
||||
/// IN node: *Node - The node to initialise the root node.
|
||||
///
|
||||
pub fn setRoot(node: *Node) void {
|
||||
/// Error: Error
|
||||
/// Error.NotADirectory - The node isn't a directory node.
|
||||
///
|
||||
pub fn setRoot(node: *Node) Error!void {
|
||||
if (!node.isDir()) {
|
||||
return Error.NotADirectory;
|
||||
}
|
||||
root = node;
|
||||
}
|
||||
|
||||
|
@ -972,8 +978,8 @@ test "read" {
|
|||
testing.expectEqual(test_link, "/foo.txt");
|
||||
var link_file = try openFile("/link", .NO_CREATION);
|
||||
{
|
||||
const length = try link_file.read(buffer[0..0]);
|
||||
testing.expect(std.mem.eql(u8, str[0..0], buffer[0..length]));
|
||||
const length = try link_file.read(buffer[0..]);
|
||||
testing.expect(std.mem.eql(u8, str[0..], buffer[0..length]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue