Drop `File_Len` from VFS.Read()
The `File_Len` is never supposed to change outside the FS driver.
diff --git a/src/filo-fs-ext2.adb b/src/filo-fs-ext2.adb
index ace8c6a..ec17fe4 100644
--- a/src/filo-fs-ext2.adb
+++ b/src/filo-fs-ext2.adb
@@ -751,7 +751,6 @@
procedure Read
(State : in out T;
- File_Len : in File_Length;
File_Pos : in out File_Offset;
Buf : out Buffer_Type;
Len : out Natural)
@@ -759,11 +758,11 @@
Pos : Natural;
begin
if State.Inode.Mode = Fast_Link then
- if File_Len > State.Inode.Inline'Length or
- File_Pos >= File_Len then
+ if State.Inode.Size > Inode_Length (State.Inode.Inline'Length) or
+ Inode_Length (File_Pos) >= State.Inode.Size then
Len := 0;
else
- Len := Natural'Min (Buf'Length, Natural (File_Len - File_Pos));
+ Len := Natural'Min (Buf'Length, Natural (State.Inode.Size) - Natural (File_Pos));
end if;
Buf (Buf'First .. Buf'First + Len - 1) :=
State.Inode.Inline (Natural (File_Pos) .. Natural (File_Pos) + Len - 1);
@@ -780,13 +779,13 @@
In_Block : constant Max_Block_Index := Natural (File_Pos mod Block_Size);
Logical : constant FSBlock_Logical := FSBlock_Logical (File_Pos / Block_Size);
In_Block_Space : constant Natural := Natural (Block_Size) - In_Block;
- In_File_Space : constant Natural := Natural (File_Len - File_Pos);
+ In_File_Space : constant Inode_Length := State.Inode.Size - Inode_Length (File_Pos);
In_Buf_Space : constant Natural := Buf'Last - Pos + 1;
Len_Here : Natural;
begin
Len_Here := In_Block_Space;
- if In_File_Space < Len_Here then
- Len_Here := In_File_Space;
+ if In_File_Space < Inode_Length (Len_Here) then
+ Len_Here := Natural (In_File_Space);
end if;
if In_Buf_Space < Len_Here then
Len_Here := In_Buf_Space;