diff options
Diffstat (limited to 'src/kernel/fs/iso9660.c')
-rw-r--r-- | src/kernel/fs/iso9660.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/kernel/fs/iso9660.c b/src/kernel/fs/iso9660.c index b17a975..d8c103f 100644 --- a/src/kernel/fs/iso9660.c +++ b/src/kernel/fs/iso9660.c @@ -9,8 +9,9 @@ static fs_driver_ops_t iso9660_driver_ops = { }; void register_iso9660_driver() { - //ASSERT(sizeof(iso9660_vdt_entry_t) == 2048); - //ASSERT(sizeof(iso9660_dr_t) == 34); + ASSERT(sizeof(iso9660_dr_date_t) == 7); + ASSERT(sizeof(iso9660_dr_t) == 34); + ASSERT(sizeof(iso9660_vdt_entry_t) == 2048); register_fs_driver("iso9660", &iso9660_driver_ops); } @@ -22,11 +23,21 @@ void register_iso9660_driver() { static bool iso9660_make(fs_handle_t *source, const char* opts, fs_t *t) { stat_t st; if (!file_stat(source, &st)) return false; - if ((st.type & FT_BLOCKDEV) != 0) return false; + if ((st.type & FT_BLOCKDEV) == 0) return false; - uint32_t block_size = file_ioctl(source, IOCTL_BLOCKDEV_GET_BLOCK_SIZE, 0); + int block_size = file_ioctl(source, IOCTL_BLOCKDEV_GET_BLOCK_SIZE, 0); if (block_size != 2048) return false; + // Look up primary volume descriptor entry + iso9660_vdt_entry_t ent; + int ent_sect = 0x10; + while (true) { + if (file_read(source, ent_sect * 2048, 2048, ent.buf) != 2048) return false; + if (ent.boot.type == ISO9660_VDT_PRIMARY) break; // ok got it! + if (ent.boot.type == ISO9660_VDT_TERMINATOR) return false; // doesn't exist ? + ent_sect++; + } + return false; // TODO } |