init: cleanup is_first_stage conditionals
A recent change to the is_first_stage conditionals created a unneeded else { } block as both the code in the else { } block and any code that runs after it are both in the second stage of init. A first step to clean this up is to remove this else block. Secondly, given the above confusion, it makes sense to simplify the two if (is_first_stage) conditions into one, which only now requires duplicating one line to initialize logging and the actual "init first/second stage started!" logs. Lastly, there are a few commands ran at the beginning of both init stages that do not need to be, * boot_clock::time_point start_time = boot_clock::now(); This is only used in the first stage so keep it there * umask(0); umasks are preserved across execve() so it only needs to be set in the first stage * chmod("/proc/cmdline", 0440); This needs to be moved until after /proc is mounted in the first stage, but otherwise only needs to be done once Test: Boot bullhead, check umask, check cmdline permissions, check boot time property Change-Id: Idb7df1d4330960ce282d9609f5c62281ee2638b9
Loading
Please register or sign in to comment