Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff88e301 authored by Tom Cherry's avatar Tom Cherry
Browse files

init: remove console_init_action

There's no fundamental reason to store this aside.  That property can
only be written by init, so it's not likely that we're going to
corrupt it.

Test: boot and use serial console
Change-Id: I9248fbaf959ea913d09add829d4cb509af99d570
parent b1ffb1de
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -26,9 +26,6 @@ int setgroups(size_t __size, const gid_t* __list) {
namespace android {
namespace init {

// init.h
std::string default_console = "/dev/console";

// property_service.h
bool CanReadProperty(const std::string& source_context, const std::string& name) {
    return true;
+0 −3
Original line number Diff line number Diff line
@@ -35,9 +35,6 @@ int setgroups(size_t __size, const gid_t* __list);
namespace android {
namespace init {

// init.h
extern std::string default_console;

// property_service.h
bool CanReadProperty(const std::string& source_context, const std::string& name);
extern uint32_t (*property_set)(const std::string& name, const std::string& value);
+0 −11
Original line number Diff line number Diff line
@@ -90,8 +90,6 @@ static int property_triggers_enabled = 0;

static char qemu[32];

std::string default_console = "/dev/console";

static int signal_fd = -1;

static std::unique_ptr<Timer> waiting_for_prop(nullptr);
@@ -348,14 +346,6 @@ static Result<void> wait_for_coldboot_done_action(const BuiltinArguments& args)
    return {};
}

static Result<void> console_init_action(const BuiltinArguments& args) {
    std::string console = GetProperty("ro.boot.console", "");
    if (!console.empty()) {
        default_console = "/dev/" + console;
    }
    return {};
}

static Result<void> SetupCgroupsAction(const BuiltinArguments&) {
    // Have to create <CGROUPS_RC_DIR> using make_dir function
    // for appropriate sepolicy to be set for it
@@ -762,7 +752,6 @@ int SecondStageMain(int argc, char** argv) {
                return {};
            },
            "KeychordInit");
    am.QueueBuiltinAction(console_init_action, "console_init");

    // Trigger all the boot actions to get us started.
    am.QueueEventTrigger("init");
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ namespace init {
// Note: These globals are *only* valid in init, so they should not be used in ueventd
// or any files that may be included in ueventd, such as devices.cpp and util.cpp.
// TODO: Have an Init class and remove all globals.
extern std::string default_console;
extern std::vector<std::string> late_import_paths;

Parser CreateParser(ActionManager& action_manager, ServiceList& service_list);
+1 −2
Original line number Diff line number Diff line
@@ -40,7 +40,6 @@
#if defined(__ANDROID__)
#include <ApexProperties.sysprop.h>

#include "init.h"
#include "mount_namespace.h"
#include "property_service.h"
#else
@@ -359,7 +358,7 @@ Result<void> Service::Start() {
    bool needs_console = (flags_ & SVC_CONSOLE);
    if (needs_console) {
        if (proc_attr_.console.empty()) {
            proc_attr_.console = default_console;
            proc_attr_.console = "/dev/" + GetProperty("ro.boot.console", "console");
        }

        // Make sure that open call succeeds to ensure a console driver is