mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:17:35 +00:00
Kernel+SystemServer: Change bootmode to system_mode
'bootmode' now only controls which set of services are started by SystemServer, so it is more appropriate to rename it to system_mode, and no longer validate it in the Kernel.
This commit is contained in:
parent
09432a8241
commit
8d13f6ddce
11 changed files with 64 additions and 51 deletions
|
@ -39,8 +39,13 @@ UNMAP_AFTER_INIT void CommandLine::initialize()
|
|||
s_the = new CommandLine(s_cmd_line);
|
||||
dmesgln("Kernel Commandline: {}", kernel_command_line().string());
|
||||
// Validate the modes the user passed in.
|
||||
(void)s_the->boot_mode(Validate::Yes);
|
||||
(void)s_the->panic_mode(Validate::Yes);
|
||||
if (s_the->contains("boot_mode"sv)) {
|
||||
// I know, we don't do legacy, but even though I eliminated 'boot_mode' from the codebase, there
|
||||
// is a good chance that someone's still using it. Let's be nice and tell them where to look.
|
||||
// TODO: Remove this in 2022.
|
||||
PANIC("'boot_mode' is now split into panic=[halt|shutdown], fbdev=[on|off], and system_mode=[graphical|text|selftest].");
|
||||
}
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void CommandLine::build_commandline(const String& cmdline_from_bootloader)
|
||||
|
@ -199,20 +204,9 @@ UNMAP_AFTER_INIT AHCIResetMode CommandLine::ahci_reset_mode() const
|
|||
PANIC("Unknown AHCIResetMode: {}", ahci_reset_mode);
|
||||
}
|
||||
|
||||
BootMode CommandLine::boot_mode(Validate should_validate) const
|
||||
StringView CommandLine::system_mode() const
|
||||
{
|
||||
const auto boot_mode = lookup("boot_mode"sv).value_or("graphical"sv);
|
||||
if (boot_mode == "no-fbdev"sv) {
|
||||
return BootMode::NoFramebufferDevices;
|
||||
} else if (boot_mode == "self-test"sv) {
|
||||
return BootMode::SelfTest;
|
||||
} else if (boot_mode == "graphical"sv) {
|
||||
return BootMode::Graphical;
|
||||
}
|
||||
|
||||
if (should_validate == Validate::Yes)
|
||||
PANIC("Unknown BootMode: {}", boot_mode);
|
||||
return BootMode::Unknown;
|
||||
return lookup("system_mode"sv).value_or("graphical"sv);
|
||||
}
|
||||
|
||||
PanicMode CommandLine::panic_mode(Validate should_validate) const
|
||||
|
|
|
@ -15,13 +15,6 @@
|
|||
|
||||
namespace Kernel {
|
||||
|
||||
enum class BootMode {
|
||||
NoFramebufferDevices,
|
||||
SelfTest,
|
||||
Graphical,
|
||||
Unknown,
|
||||
};
|
||||
|
||||
enum class PanicMode {
|
||||
Halt,
|
||||
Shutdown,
|
||||
|
@ -74,7 +67,7 @@ public:
|
|||
[[nodiscard]] bool are_framebuffer_devices_enabled() const;
|
||||
[[nodiscard]] bool is_force_pio() const;
|
||||
[[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
|
||||
[[nodiscard]] BootMode boot_mode(Validate should_validate = Validate::No) const;
|
||||
[[nodiscard]] StringView system_mode() const;
|
||||
[[nodiscard]] PanicMode panic_mode(Validate should_validate = Validate::No) const;
|
||||
[[nodiscard]] HPETMode hpet_mode() const;
|
||||
[[nodiscard]] bool disable_physical_storage() const;
|
||||
|
|
|
@ -706,6 +706,19 @@ private:
|
|||
return KSuccess;
|
||||
}
|
||||
};
|
||||
class ProcFSSystemMode final : public ProcFSGlobalInformation {
|
||||
public:
|
||||
static NonnullRefPtr<ProcFSSystemMode> must_create();
|
||||
|
||||
private:
|
||||
ProcFSSystemMode();
|
||||
virtual KResult try_generate(KBufferBuilder& builder) override
|
||||
{
|
||||
TRY(builder.append(kernel_command_line().system_mode()));
|
||||
TRY(builder.append('\n'));
|
||||
return KSuccess;
|
||||
}
|
||||
};
|
||||
|
||||
class ProcFSProfile final : public ProcFSGlobalInformation {
|
||||
public:
|
||||
|
@ -793,6 +806,10 @@ UNMAP_AFTER_INIT NonnullRefPtr<ProcFSCommandLine> ProcFSCommandLine::must_create
|
|||
{
|
||||
return adopt_ref_if_nonnull(new (nothrow) ProcFSCommandLine).release_nonnull();
|
||||
}
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<ProcFSSystemMode> ProcFSSystemMode::must_create()
|
||||
{
|
||||
return adopt_ref_if_nonnull(new (nothrow) ProcFSSystemMode).release_nonnull();
|
||||
}
|
||||
UNMAP_AFTER_INIT NonnullRefPtr<ProcFSProfile> ProcFSProfile::must_create()
|
||||
{
|
||||
return adopt_ref_if_nonnull(new (nothrow) ProcFSProfile).release_nonnull();
|
||||
|
@ -855,6 +872,10 @@ UNMAP_AFTER_INIT ProcFSCommandLine::ProcFSCommandLine()
|
|||
: ProcFSGlobalInformation("cmdline"sv)
|
||||
{
|
||||
}
|
||||
UNMAP_AFTER_INIT ProcFSSystemMode::ProcFSSystemMode()
|
||||
: ProcFSGlobalInformation("system_mode"sv)
|
||||
{
|
||||
}
|
||||
UNMAP_AFTER_INIT ProcFSProfile::ProcFSProfile()
|
||||
: ProcFSGlobalInformation("profile"sv)
|
||||
{
|
||||
|
@ -895,6 +916,7 @@ UNMAP_AFTER_INIT NonnullRefPtr<ProcFSRootDirectory> ProcFSRootDirectory::must_cr
|
|||
directory->m_components.append(ProcFSDevices::must_create());
|
||||
directory->m_components.append(ProcFSUptime::must_create());
|
||||
directory->m_components.append(ProcFSCommandLine::must_create());
|
||||
directory->m_components.append(ProcFSSystemMode::must_create());
|
||||
directory->m_components.append(ProcFSProfile::must_create());
|
||||
directory->m_components.append(ProcFSKernelBase::must_create());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue