Started on documentation for dcb_iso9660::fs.

This commit is contained in:
Filipe Rodrigues 2021-01-19 19:18:49 +00:00
parent 3335397328
commit 6f436271e2
2 changed files with 24 additions and 11 deletions

19
dcb-iso9660/src/fs.md Normal file
View File

@ -0,0 +1,19 @@
# ISO 9960 Implementation
This module implements the `ISO-9660` (ECMA-119) filesystem specification
within the [`Filesystem`] struct, which takes in a [`CdRom`](crate::CdRom).
# Layout
The `ISO-9660` filesystem is defines with the following layout:
| Offset | Size | Type | Name |
| ------ | ------------------ | -------------------- | ---------------------------------------------------------------- |
| 0x0 | 0x8000 | `[u8; 0x8000]` | System Area. Used for arbitrary data, not part of the filesystem |
| 0x8000 | (variable) * 0x800 | `[VolumeDescriptor]` | Volume descriptor set. Contiguous array of [`VolumeDescriptor`]s |
| ... | ... | `PathTable` | Path tables. |
| ... | ... | `[u8]` | Raw Data |
# Implementation
The current implementation uses the root directory to locate data on the filesystem,
as opposed to the path table.

View File

@ -1,6 +1,4 @@
//! ISO 9660 filesystem.
//!
//! This module implements the ISO 9660 filesystem.
#![doc(include = "fs.md")]
// Modules
pub mod date_time;
@ -24,12 +22,14 @@ use std::io;
/// The filesystem
#[derive(PartialEq, Eq, Clone, Debug)]
pub struct Filesystem {
// TODO: Only read the root directory and necessary information
// to reconstruct the filesystem.
/// Primary volume descriptor
primary_volume_descriptor: PrimaryVolumeDescriptor,
}
impl Filesystem {
/// Reads the filesystem from a game file
/// Reads the filesystem from the cd rom.
pub fn new<R: io::Read + io::Seek>(file: &mut CdRom<R>) -> Result<Self, NewError> {
// Start reading volume descriptors from sector `0x10` until we hit the primary one
// Note: First `32 kiB` (= 16 sectors) are reserved for arbitrary data.
@ -50,15 +50,9 @@ impl Filesystem {
Ok(Self { primary_volume_descriptor })
}
/// Returns the root directory
/// Returns the root directory entry
#[must_use]
pub const fn root_dir(&self) -> &Entry {
&self.primary_volume_descriptor.root_dir_entry
}
/// Prints a tree of all files
pub fn fmt_tree<R: io::Read + io::Seek>(&self, _cdrom: &mut CdRom<R>) {
let _ = self;
todo!();
}
}