mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 05:57:41 +00:00
Kernel: Remove CommandLine::get() in favor of lookup()
lookup() returns an Optional<String> which allows us to implement easy default values using lookup(key).value_or(default_value);
This commit is contained in:
parent
cebb619f8e
commit
e3b450005f
4 changed files with 2 additions and 14 deletions
|
@ -66,11 +66,6 @@ Optional<String> CommandLine::lookup(const String& key) const
|
||||||
return m_params.get(key);
|
return m_params.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
String CommandLine::get(const String& key) const
|
|
||||||
{
|
|
||||||
return m_params.get(key).value_or({});
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CommandLine::contains(const String& key) const
|
bool CommandLine::contains(const String& key) const
|
||||||
{
|
{
|
||||||
return m_params.contains(key);
|
return m_params.contains(key);
|
||||||
|
|
|
@ -39,7 +39,6 @@ public:
|
||||||
static void initialize(const String&);
|
static void initialize(const String&);
|
||||||
|
|
||||||
const String& string() const { return m_string; }
|
const String& string() const { return m_string; }
|
||||||
String get(const String& key) const;
|
|
||||||
Optional<String> lookup(const String& key) const;
|
Optional<String> lookup(const String& key) const;
|
||||||
bool contains(const String& key) const;
|
bool contains(const String& key) const;
|
||||||
|
|
||||||
|
|
|
@ -143,10 +143,7 @@ Vector<HardwareTimer*> TimeManagement::scan_for_non_periodic_timers()
|
||||||
|
|
||||||
bool TimeManagement::is_hpet_periodic_mode_allowed()
|
bool TimeManagement::is_hpet_periodic_mode_allowed()
|
||||||
{
|
{
|
||||||
if (!kernel_command_line().contains("hpet"))
|
auto hpet_mode = kernel_command_line().lookup("hpet").value_or("periodic");
|
||||||
return true;
|
|
||||||
|
|
||||||
auto hpet_mode = kernel_command_line().get("hpet");
|
|
||||||
if (hpet_mode == "periodic")
|
if (hpet_mode == "periodic")
|
||||||
return true;
|
return true;
|
||||||
if (hpet_mode == "nonperiodic")
|
if (hpet_mode == "nonperiodic")
|
||||||
|
|
|
@ -216,10 +216,7 @@ void init_stage2()
|
||||||
bool text_debug = kernel_command_line().contains("text_debug");
|
bool text_debug = kernel_command_line().contains("text_debug");
|
||||||
bool force_pio = kernel_command_line().contains("force_pio");
|
bool force_pio = kernel_command_line().contains("force_pio");
|
||||||
|
|
||||||
auto root = kernel_command_line().get("root");
|
auto root = kernel_command_line().lookup("root").value_or("/dev/hda");
|
||||||
if (root.is_empty()) {
|
|
||||||
root = "/dev/hda";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!root.starts_with("/dev/hda")) {
|
if (!root.starts_with("/dev/hda")) {
|
||||||
klog() << "init_stage2: root filesystem must be on the first IDE hard drive (/dev/hda)";
|
klog() << "init_stage2: root filesystem must be on the first IDE hard drive (/dev/hda)";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue