summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot2018-07-20 21:47:36 -0500
committerGerrit Code Review2018-07-20 21:47:36 -0500
commit1d2b29a9022ae9910bda2e1371066179bbd176d6 (patch)
tree6a60e5fa7a04ebb1a1cc659f25fda2ba203e49cc
parent258109ce4ab00bbb831212c04e6c986899d7bd85 (diff)
parent38a11ccdd183248b07c86b51791dc2dafba36738 (diff)
downloadplatform-system-core-1d2b29a9022ae9910bda2e1371066179bbd176d6.tar.gz
platform-system-core-1d2b29a9022ae9910bda2e1371066179bbd176d6.tar.xz
platform-system-core-1d2b29a9022ae9910bda2e1371066179bbd176d6.zip
Merge "init: rename init_first_stage"
-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 859aeb663..c02b8d187 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 "parser.cpp", 111 "parser.cpp",
112 "persistent_properties.cpp", 112 "persistent_properties.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 12c3d6c4b..6569871b8 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 "property_service.h" 54#include "property_service.h"
55#include "reboot.h" 55#include "reboot.h"