Clean up userspace-reboot
The feature was deprecated last year.
Bug: 292469129
Test: atest CtsInitTestCases
Change-Id: I826502770ab3fa566be57a33829f1103efa893fb
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 606ea8c..2b965b6 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -606,8 +606,6 @@
return Error() << "Invalid code: " << code;
}
-static int initial_mount_fstab_return_code = -1;
-
/* <= Q: mount_all <fstab> [ <path> ]* [--<options>]*
* >= R: mount_all [ <fstab> ] [--<options>]*
*
@@ -648,19 +646,10 @@
import_late(mount_all->rc_paths);
}
- if (mount_fstab_result.userdata_mounted) {
- // This call to fs_mgr_mount_all mounted userdata. Keep the result in
- // order for userspace reboot to correctly remount userdata.
- LOG(INFO) << "Userdata mounted using "
- << (mount_all->fstab_path.empty() ? "(default fstab)" : mount_all->fstab_path)
- << " result : " << mount_fstab_result.code;
- initial_mount_fstab_return_code = mount_fstab_result.code;
- }
-
if (queue_event) {
/* queue_fs_event will queue event based on mount_fstab return code
* and return processed return code*/
- auto queue_fs_result = queue_fs_event(mount_fstab_result.code);
+ auto queue_fs_result = queue_fs_event(mount_fstab_result);
if (!queue_fs_result.ok()) {
return Error() << "queue_fs_event() failed: " << queue_fs_result.error();
}
@@ -1178,29 +1167,6 @@
return ExecWithFunctionOnFailure(args, reboot);
}
-static Result<void> do_remount_userdata(const BuiltinArguments& args) {
- if (initial_mount_fstab_return_code == -1) {
- return Error() << "Calling remount_userdata too early";
- }
- Fstab fstab;
- if (!ReadDefaultFstab(&fstab)) {
- // TODO(b/135984674): should we reboot here?
- return Error() << "Failed to read fstab";
- }
- // TODO(b/135984674): check that fstab contains /data.
- if (auto rc = fs_mgr_remount_userdata_into_checkpointing(&fstab); rc < 0) {
- std::string proc_mounts_output;
- android::base::ReadFileToString("/proc/mounts", &proc_mounts_output, true);
- android::base::WriteStringToFile(proc_mounts_output,
- "/metadata/userspacereboot/mount_info.txt");
- trigger_shutdown("reboot,mount_userdata_failed");
- }
- if (auto result = queue_fs_event(initial_mount_fstab_return_code); !result.ok()) {
- return Error() << "queue_fs_event() failed: " << result.error();
- }
- return {};
-}
-
static Result<void> do_installkey(const BuiltinArguments& args) {
if (!is_file_crypto()) return {};
@@ -1361,7 +1327,6 @@
{"umount_all", {0, 1, {false, do_umount_all}}},
{"update_linker_config", {0, 0, {false, do_update_linker_config}}},
{"readahead", {1, 2, {true, do_readahead}}},
- {"remount_userdata", {0, 0, {false, do_remount_userdata}}},
{"restart", {1, 2, {false, do_restart}}},
{"restorecon", {1, kMax, {true, do_restorecon}}},
{"restorecon_recursive", {1, kMax, {true, do_restorecon_recursive}}},