summaryrefslogtreecommitdiffstats
path: root/roots.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-01-08 21:05:29 +0100
committerandroid-build-merger <android-build-merger@google.com>2019-01-08 21:05:29 +0100
commitad4ce79b4db84b99f18bf2c747f06c0972c75b67 (patch)
treef1c1a2b84e53d9c3c66bc302255239f225c28cb4 /roots.cpp
parentMerge "updater: erase ignores EOPNOTSUPP for BLKDISCARD" (diff)
parentMerge "Use dynamically linked f2fs executables." (diff)
downloadandroid_bootable_recovery-ad4ce79b4db84b99f18bf2c747f06c0972c75b67.tar
android_bootable_recovery-ad4ce79b4db84b99f18bf2c747f06c0972c75b67.tar.gz
android_bootable_recovery-ad4ce79b4db84b99f18bf2c747f06c0972c75b67.tar.bz2
android_bootable_recovery-ad4ce79b4db84b99f18bf2c747f06c0972c75b67.tar.lz
android_bootable_recovery-ad4ce79b4db84b99f18bf2c747f06c0972c75b67.tar.xz
android_bootable_recovery-ad4ce79b4db84b99f18bf2c747f06c0972c75b67.tar.zst
android_bootable_recovery-ad4ce79b4db84b99f18bf2c747f06c0972c75b67.zip
Diffstat (limited to 'roots.cpp')
-rw-r--r--roots.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/roots.cpp b/roots.cpp
index 6db0ca519..290be477c 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -223,34 +223,28 @@ int format_volume(const std::string& volume, const std::string& directory) {
// Has to be f2fs because we checked earlier.
static constexpr int kSectorSize = 4096;
- std::string cmd("/sbin/mkfs.f2fs");
- // clang-format off
std::vector<std::string> make_f2fs_cmd = {
- cmd,
- "-g", "android",
+ "/system/bin/make_f2fs",
+ "-g",
+ "android",
v->blk_device,
};
- // clang-format on
if (length >= kSectorSize) {
make_f2fs_cmd.push_back(std::to_string(length / kSectorSize));
}
- int result = exec_cmd(make_f2fs_cmd);
- if (result == 0 && !directory.empty()) {
- cmd = "/sbin/sload.f2fs";
- // clang-format off
+ if (exec_cmd(make_f2fs_cmd) != 0) {
+ PLOG(ERROR) << "format_volume: Failed to make_f2fs on " << v->blk_device;
+ return -1;
+ }
+ if (!directory.empty()) {
std::vector<std::string> sload_f2fs_cmd = {
- cmd,
- "-f", directory,
- "-t", volume,
- v->blk_device,
+ "/system/bin/sload_f2fs", "-f", directory, "-t", volume, v->blk_device,
};
- // clang-format on
- result = exec_cmd(sload_f2fs_cmd);
- }
- if (result != 0) {
- PLOG(ERROR) << "format_volume: Failed " << cmd << " on " << v->blk_device;
- return -1;
+ if (exec_cmd(sload_f2fs_cmd) != 0) {
+ PLOG(ERROR) << "format_volume: Failed to sload_f2fs on " << v->blk_device;
+ return -1;
+ }
}
return 0;
}