mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:37:43 +00:00
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.
This commit is contained in:
parent
74881ac649
commit
84a399de5d
9 changed files with 143 additions and 45 deletions
|
@ -29,9 +29,27 @@
|
|||
#include <AK/HashMap.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Vector.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
enum class BootMode {
|
||||
Text,
|
||||
SelfTest,
|
||||
Graphical
|
||||
};
|
||||
|
||||
enum class HPETMode {
|
||||
Periodic,
|
||||
NonPeriodic
|
||||
};
|
||||
|
||||
enum class AcpiFeatureLevel {
|
||||
Enabled,
|
||||
Limited,
|
||||
Disabled,
|
||||
};
|
||||
|
||||
class CommandLine {
|
||||
AK_MAKE_ETERNAL;
|
||||
|
||||
|
@ -39,9 +57,23 @@ public:
|
|||
static void early_initialize(const char* cmd_line);
|
||||
static void initialize();
|
||||
|
||||
const String& string() const { return m_string; }
|
||||
[[nodiscard]] const String& string() const { return m_string; }
|
||||
Optional<String> lookup(const String& key) const;
|
||||
bool contains(const String& key) const;
|
||||
[[nodiscard]] bool contains(const String& key) const;
|
||||
|
||||
[[nodiscard]] bool is_ide_enabled() const;
|
||||
[[nodiscard]] bool is_smp_enabled() const;
|
||||
[[nodiscard]] bool is_vmmouse_enabled() const;
|
||||
[[nodiscard]] bool is_mmio_enabled() const;
|
||||
[[nodiscard]] bool is_legacy_time_enabled() const;
|
||||
[[nodiscard]] bool is_text_mode() const;
|
||||
[[nodiscard]] bool is_force_pio() const;
|
||||
[[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
|
||||
[[nodiscard]] BootMode boot_mode() const;
|
||||
[[nodiscard]] HPETMode hpet_mode() const;
|
||||
[[nodiscard]] String userspace_init() const;
|
||||
[[nodiscard]] Vector<String> userspace_init_args() const;
|
||||
[[nodiscard]] String root_device() const;
|
||||
|
||||
private:
|
||||
CommandLine(const String&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue