1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

Kernel: Implement a ISO 9660 filesystem reader :^)

This commit implements the ISO 9660 filesystem as specified in ECMA 119.
Currently, it only supports the base specification and Joliet or Rock
Ridge support is not present. The filesystem will normalize all
filenames to be lowercase (same as Linux).

The filesystem can be mounted directly from a file. Loop devices are
currently not supported by SerenityOS.

Special thanks to Lubrsi for testing on real hardware and providing
profiling help.

Co-Authored-By: Luke <luke.wilde@live.co.uk>
This commit is contained in:
sin-ack 2021-07-29 20:19:12 +00:00 committed by Andreas Kling
parent a2a553b286
commit 0d468f2282
6 changed files with 1152 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#include <Kernel/FileSystem/DevFS.h>
#include <Kernel/FileSystem/DevPtsFS.h>
#include <Kernel/FileSystem/Ext2FileSystem.h>
#include <Kernel/FileSystem/ISO9660FileSystem.h>
#include <Kernel/FileSystem/Plan9FileSystem.h>
#include <Kernel/FileSystem/ProcFS.h>
#include <Kernel/FileSystem/SysFS.h>
@ -98,6 +99,21 @@ KResultOr<FlatPtr> Process::sys$mount(Userspace<const Syscall::SC_mount_params*>
fs = SysFS::create();
} else if (fs_type == "tmp"sv || fs_type == "TmpFS"sv) {
fs = TmpFS::create();
} else if (fs_type == "iso9660"sv || fs_type == "ISO9660FS"sv) {
if (description.is_null())
return EBADF;
if (!description->file().is_seekable()) {
dbgln("mount: this is not a seekable file");
return ENODEV;
}
dbgln("mount: attempting to mount {} on {}", description->absolute_path(), target);
auto maybe_fs = ISO9660FS::try_create(*description);
if (maybe_fs.is_error()) {
return maybe_fs.error();
}
fs = maybe_fs.release_value();
} else {
return ENODEV;
}