summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorTom Cherry2018-07-20 17:18:04 -0500
committerTom Cherry2018-07-20 17:31:36 -0500
commit38a11ccdd183248b07c86b51791dc2dafba36738 (patch)
tree6d7089bc56995bf045c4ed389d6f72318676f3fd /init
parent74be24d696f2d67293de6b9bb6e715c1728abed7 (diff)
downloadplatform-system-core-38a11ccdd183248b07c86b51791dc2dafba36738.tar.gz
platform-system-core-38a11ccdd183248b07c86b51791dc2dafba36738.tar.xz
platform-system-core-38a11ccdd183248b07c86b51791dc2dafba36738.zip
init: rename init_first_stage
In preparation for splitting first stage init from the rest of the init executable, rename these files which are specifically involved in first stage mount operations to a more appropriate name. Test: builds Change-Id: I8a2d4e8c7e1deea1bab45cc8e738727bc2ceb3e5
Diffstat (limited to 'init')
-rw-r--r--init/Android.bp2
-rw-r--r--init/first_stage_mount.cpp (renamed from init/init_first_stage.cpp)27
-rw-r--r--init/first_stage_mount.h (renamed from init/init_first_stage.h)5
-rw-r--r--init/init.cpp2
4 files changed, 17 insertions, 19 deletions
diff --git a/init/Android.bp b/init/Android.bp
index 5bbb7a09c..d3305b903 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -104,9 +104,9 @@ cc_library_static {
104 "devices.cpp", 104 "devices.cpp",
105 "epoll.cpp", 105 "epoll.cpp",
106 "firmware_handler.cpp", 106 "firmware_handler.cpp",
107 "first_stage_mount.cpp",
107 "import_parser.cpp", 108 "import_parser.cpp",
108 "init.cpp", 109 "init.cpp",
109 "init_first_stage.cpp",
110 "keychords.cpp", 110 "keychords.cpp",
111 "log.cpp", 111 "log.cpp",
112 "parser.cpp", 112 "parser.cpp",
diff --git a/init/init_first_stage.cpp b/init/first_stage_mount.cpp
index 0ee020384..8ded87373 100644
--- a/init/init_first_stage.cpp
+++ b/init/first_stage_mount.cpp
@@ -14,7 +14,7 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17#include "init_first_stage.h" 17#include "first_stage_mount.h"
18 18
19#include <stdlib.h> 19#include <stdlib.h>
20#include <unistd.h> 20#include <unistd.h>
@@ -125,11 +125,12 @@ static inline bool IsDmLinearEnabled() {
125 if (checked) { 125 if (checked) {
126 return enabled; 126 return enabled;
127 } 127 }
128 import_kernel_cmdline(false, [](const std::string& key, const std::string& value, bool in_qemu) { 128 import_kernel_cmdline(false,
129 if (key == "androidboot.logical_partitions" && value == "1") { 129 [](const std::string& key, const std::string& value, bool in_qemu) {
130 enabled = true; 130 if (key == "androidboot.logical_partitions" && value == "1") {
131 } 131 enabled = true;
132 }); 132 }
133 });
133 checked = true; 134 checked = true;
134 return enabled; 135 return enabled;
135} 136}
@@ -149,9 +150,9 @@ FirstStageMount::FirstStageMount()
149 } 150 }
150 151
151 auto boot_devices = fs_mgr_get_boot_devices(); 152 auto boot_devices = fs_mgr_get_boot_devices();
152 device_handler_ = 153 device_handler_ = std::make_unique<DeviceHandler>(
153 std::make_unique<DeviceHandler>(std::vector<Permissions>{}, std::vector<SysfsPermissions>{}, 154 std::vector<Permissions>{}, std::vector<SysfsPermissions>{}, std::vector<Subsystem>{},
154 std::vector<Subsystem>{}, std::move(boot_devices), false); 155 std::move(boot_devices), false);
155} 156}
156 157
157std::unique_ptr<FirstStageMount> FirstStageMount::Create() { 158std::unique_ptr<FirstStageMount> FirstStageMount::Create() {
@@ -484,7 +485,7 @@ ListenerAction FirstStageMountVBootV2::UeventCallback(const Uevent& uevent) {
484 // as it finds them, so this must happen first. 485 // as it finds them, so this must happen first.
485 if (!uevent.partition_name.empty() && 486 if (!uevent.partition_name.empty() &&
486 required_devices_partition_names_.find(uevent.partition_name) != 487 required_devices_partition_names_.find(uevent.partition_name) !=
487 required_devices_partition_names_.end()) { 488 required_devices_partition_names_.end()) {
488 // GetBlockDeviceSymlinks() will return three symlinks at most, depending on 489 // GetBlockDeviceSymlinks() will return three symlinks at most, depending on
489 // the content of uevent. by-name symlink will be at [0] if uevent->partition_name 490 // the content of uevent. by-name symlink will be at [0] if uevent->partition_name
490 // is not empty. e.g., 491 // is not empty. e.g.,
@@ -492,7 +493,7 @@ ListenerAction FirstStageMountVBootV2::UeventCallback(const Uevent& uevent) {
492 // - /dev/block/platform/soc.0/f9824900.sdhci/mmcblk0p1 493 // - /dev/block/platform/soc.0/f9824900.sdhci/mmcblk0p1
493 std::vector<std::string> links = device_handler_->GetBlockDeviceSymlinks(uevent); 494 std::vector<std::string> links = device_handler_->GetBlockDeviceSymlinks(uevent);
494 if (!links.empty()) { 495 if (!links.empty()) {
495 auto[it, inserted] = by_name_symlink_map_.emplace(uevent.partition_name, links[0]); 496 auto [it, inserted] = by_name_symlink_map_.emplace(uevent.partition_name, links[0]);
496 if (!inserted) { 497 if (!inserted) {
497 LOG(ERROR) << "Partition '" << uevent.partition_name 498 LOG(ERROR) << "Partition '" << uevent.partition_name
498 << "' already existed in the by-name symlink map with a value of '" 499 << "' already existed in the by-name symlink map with a value of '"
@@ -508,7 +509,7 @@ bool FirstStageMountVBootV2::SetUpDmVerity(fstab_rec* fstab_rec) {
508 if (fs_mgr_is_avb(fstab_rec)) { 509 if (fs_mgr_is_avb(fstab_rec)) {
509 if (!InitAvbHandle()) return false; 510 if (!InitAvbHandle()) return false;
510 SetUpAvbHashtreeResult hashtree_result = 511 SetUpAvbHashtreeResult hashtree_result =
511 avb_handle_->SetUpAvbHashtree(fstab_rec, false /* wait_for_verity_dev */); 512 avb_handle_->SetUpAvbHashtree(fstab_rec, false /* wait_for_verity_dev */);
512 switch (hashtree_result) { 513 switch (hashtree_result) {
513 case SetUpAvbHashtreeResult::kDisabled: 514 case SetUpAvbHashtreeResult::kDisabled:
514 return true; // Returns true to mount the partition. 515 return true; // Returns true to mount the partition.
@@ -585,7 +586,7 @@ void SetInitAvbVersionInRecovery() {
585 } 586 }
586 587
587 FsManagerAvbUniquePtr avb_handle = 588 FsManagerAvbUniquePtr avb_handle =
588 FsManagerAvbHandle::Open(std::move(avb_first_mount.by_name_symlink_map_)); 589 FsManagerAvbHandle::Open(std::move(avb_first_mount.by_name_symlink_map_));
589 if (!avb_handle) { 590 if (!avb_handle) {
590 PLOG(ERROR) << "Failed to open FsManagerAvbHandle for INIT_AVB_VERSION"; 591 PLOG(ERROR) << "Failed to open FsManagerAvbHandle for INIT_AVB_VERSION";
591 return; 592 return;
diff --git a/init/init_first_stage.h b/init/first_stage_mount.h
index c7a386718..21d87fd48 100644
--- a/init/init_first_stage.h
+++ b/init/first_stage_mount.h
@@ -14,8 +14,7 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17#ifndef _INIT_FIRST_STAGE_H 17#pragma once
18#define _INIT_FIRST_STAGE_H
19 18
20namespace android { 19namespace android {
21namespace init { 20namespace init {
@@ -25,5 +24,3 @@ void SetInitAvbVersionInRecovery();
25 24
26} // namespace init 25} // namespace init
27} // namespace android 26} // namespace android
28
29#endif
diff --git a/init/init.cpp b/init/init.cpp
index 686cd6ed9..5352450b0 100644
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -48,8 +48,8 @@
48 48
49#include "action_parser.h" 49#include "action_parser.h"
50#include "epoll.h" 50#include "epoll.h"
51#include "first_stage_mount.h"
51#include "import_parser.h" 52#include "import_parser.h"
52#include "init_first_stage.h"
53#include "keychords.h" 53#include "keychords.h"
54#include "log.h" 54#include "log.h"
55#include "property_service.h" 55#include "property_service.h"