mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
Kernel: Tidy up Ext2FS construction a bit
This commit is contained in:
parent
47bfbe343b
commit
36725228fa
4 changed files with 5 additions and 5 deletions
|
@ -54,9 +54,9 @@ static unsigned divide_rounded_up(unsigned a, unsigned b)
|
|||
return (a / b) + (a % b != 0);
|
||||
}
|
||||
|
||||
NonnullRefPtr<Ext2FS> Ext2FS::create(FileDescription& file_description)
|
||||
KResultOr<NonnullRefPtr<Ext2FS>> Ext2FS::try_create(FileDescription& file_description)
|
||||
{
|
||||
return adopt_ref(*new Ext2FS(file_description));
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) Ext2FS(file_description));
|
||||
}
|
||||
|
||||
Ext2FS::Ext2FS(FileDescription& file_description)
|
||||
|
|
|
@ -89,7 +89,7 @@ public:
|
|||
FileSize64bits = 1 << 1,
|
||||
};
|
||||
|
||||
static NonnullRefPtr<Ext2FS> create(FileDescription&);
|
||||
static KResultOr<NonnullRefPtr<Ext2FS>> try_create(FileDescription&);
|
||||
|
||||
virtual ~Ext2FS() override;
|
||||
virtual KResult initialize() override;
|
||||
|
|
|
@ -185,7 +185,7 @@ NonnullRefPtr<FileSystem> StorageManagement::root_filesystem() const
|
|||
auto description_or_error = FileDescription::try_create(boot_device_description.release_nonnull());
|
||||
VERIFY(!description_or_error.is_error());
|
||||
|
||||
auto file_system = Ext2FS::create(description_or_error.release_value());
|
||||
auto file_system = Ext2FS::try_create(description_or_error.release_value()).release_value();
|
||||
|
||||
if (auto result = file_system->initialize(); result.is_error()) {
|
||||
PANIC("StorageManagement: Couldn't open root filesystem: {}", result);
|
||||
|
|
|
@ -72,7 +72,7 @@ KResultOr<FlatPtr> Process::sys$mount(Userspace<const Syscall::SC_mount_params*>
|
|||
|
||||
dbgln("mount: attempting to mount {} on {}", description->absolute_path(), target);
|
||||
|
||||
fs = Ext2FS::create(*description);
|
||||
fs = TRY(Ext2FS::try_create(*description));
|
||||
} else if (fs_type == "9p"sv || fs_type == "Plan9FS"sv) {
|
||||
if (description_or_error.is_error())
|
||||
return EBADF;
|
||||
|
|
Loading…
Add table
Reference in a new issue