diff options
author | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-24 17:31:10 +0100 |
---|---|---|
committer | Alex Auvolat <alex.auvolat@ens.fr> | 2015-02-24 17:31:10 +0100 |
commit | d89c862fb2f569275300d6a64caaa0b287367558 (patch) | |
tree | e3572ee543f9f5189289e466fdf67a911504be20 /src/kernel/fs | |
parent | 150dd5f860a5f22a8c3bcc1bf3a1f2e36dcf6fd8 (diff) | |
download | kogata-d89c862fb2f569275300d6a64caaa0b287367558.tar.gz kogata-d89c862fb2f569275300d6a64caaa0b287367558.zip |
Fix a bug (dispose in pciide should not exist)
Diffstat (limited to 'src/kernel/fs')
-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 } |