diff options
author | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-03-03 00:51:55 -0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-03 11:05:16 +0100 |
commit | 84a399de5d977009b07652bf2dfefaff163693f8 (patch) | |
tree | 1ec685482477ecf8177dcf68ac0190e8a7ff3fbe /Kernel/Time | |
parent | 74881ac649742ea5b1b34c78ee365440e04ef046 (diff) | |
download | serenity-84a399de5d977009b07652bf2dfefaff163693f8.zip |
Kernel: Move Kernel CommandLine parsing to strongly typed API.
Previously all of the CommandLine parsing was spread out around the
Kernel. Instead move it all into the Kernel CommandLine class, and
expose a strongly typed API for querying the state of options.
Diffstat (limited to 'Kernel/Time')
-rw-r--r-- | Kernel/Time/TimeManagement.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Kernel/Time/TimeManagement.cpp b/Kernel/Time/TimeManagement.cpp index 01efc7c371..4267de7487 100644 --- a/Kernel/Time/TimeManagement.cpp +++ b/Kernel/Time/TimeManagement.cpp @@ -192,7 +192,7 @@ time_t TimeManagement::boot_time() const UNMAP_AFTER_INIT TimeManagement::TimeManagement() { - bool probe_non_legacy_hardware_timers = !(kernel_command_line().lookup("time").value_or("modern") == "legacy"); + bool probe_non_legacy_hardware_timers = !(kernel_command_line().is_legacy_time_enabled()); if (ACPI::is_enabled()) { if (!ACPI::Parser::the()->x86_specific_flags().cmos_rtc_not_present) { RTC::initialize(); @@ -247,12 +247,14 @@ Vector<HardwareTimerBase*> TimeManagement::scan_for_non_periodic_timers() bool TimeManagement::is_hpet_periodic_mode_allowed() { - auto hpet_mode = kernel_command_line().lookup("hpet").value_or("periodic"); - if (hpet_mode == "periodic") + switch (kernel_command_line().hpet_mode()) { + case HPETMode::Periodic: return true; - if (hpet_mode == "nonperiodic") + case HPETMode::NonPeriodic: return false; - VERIFY_NOT_REACHED(); + default: + VERIFY_NOT_REACHED(); + } } UNMAP_AFTER_INIT bool TimeManagement::probe_and_set_non_legacy_hardware_timers() |