iso9660: Add FS_Record type to describe part of a block
diff --git a/src/filo-fs-iso9660.ads b/src/filo-fs-iso9660.ads
index 0a28cc2..480ce39 100644
--- a/src/filo-fs-iso9660.ads
+++ b/src/filo-fs-iso9660.ads
@@ -49,22 +49,31 @@
type State is (Unmounted, Mounted, File_Opened);
FSBlock_Size : constant := 2048;
+ subtype FSBlock_Length is Index_Type range 0 .. FSBlock_Size;
subtype FSBlock_Index is Index_Type range 0 .. FSBlock_Size - 1;
type FSBlock_Count is range 0 .. 2 ** 32 - 1;
subtype FSBlock is FSBlock_Count range 0 .. FSBlock_Count'Last - 1;
type FSBlock_Logical is new FSBlock;
+ type FS_Record is record
+ Block : FSBlock := 0;
+ Offset : FSBlock_Length := 0;
+ Size : FSBlock_Length := 0;
+ end record
+ with
+ Dynamic_Predicate =>
+ Size <= FSBlock_Size - Offset;
+
subtype Directory_Record_Range is Index_Type range 0 .. 32;
subtype Directory_Record is Buffer_Type (Directory_Record_Range);
subtype Directory_Record_Offset is FSBlock_Index
range 0 .. FSBlock_Size - Directory_Record'Length;
-- We'll use the absolute position of the dir record
- type Inode_Index is record
- Block : FSBlock := 0;
- Offset : Directory_Record_Offset := 0;
- end record;
+ subtype Inode_Index is FS_Record
+ with
+ Dynamic_Predicate => Inode_Index.Offset <= Directory_Record_Offset'Last;
type Inode_Length is range 0 .. FSBlock_Count'Last * FSBlock_Size;
type Mount_State is record