Merge "Refine the first stage mount for DSU"
This commit is contained in:
commit
62f35129d4
2 changed files with 14 additions and 2 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include <fs_mgr_dm_linear.h>
|
||||
#include <libdm/loop_control.h>
|
||||
#include <libfiemap/split_fiemap_writer.h>
|
||||
#include <libgsi/libgsi.h>
|
||||
|
||||
#include "metadata.h"
|
||||
#include "utility.h"
|
||||
|
|
@ -34,6 +35,7 @@ namespace android {
|
|||
namespace fiemap {
|
||||
|
||||
using namespace std::literals;
|
||||
using android::base::ReadFileToString;
|
||||
using android::base::unique_fd;
|
||||
using android::dm::DeviceMapper;
|
||||
using android::dm::DmDeviceState;
|
||||
|
|
@ -53,6 +55,11 @@ static constexpr char kTestImageMetadataDir[] = "/metadata/gsi/test";
|
|||
std::unique_ptr<ImageManager> ImageManager::Open(const std::string& dir_prefix) {
|
||||
auto metadata_dir = "/metadata/gsi/" + dir_prefix;
|
||||
auto data_dir = "/data/gsi/" + dir_prefix;
|
||||
auto install_dir_file = gsi::DsuInstallDirFile(gsi::GetDsuSlot(dir_prefix));
|
||||
std::string path;
|
||||
if (ReadFileToString(install_dir_file, &path)) {
|
||||
data_dir = path;
|
||||
}
|
||||
return Open(metadata_dir, data_dir);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,6 @@ using android::fs_mgr::ReadDefaultFstab;
|
|||
using android::fs_mgr::ReadFstabFromDt;
|
||||
using android::fs_mgr::SkipMountingPartitions;
|
||||
using android::fs_mgr::TransformFstabForDsu;
|
||||
using android::init::WriteFile;
|
||||
using android::snapshot::SnapshotManager;
|
||||
|
||||
using namespace std::literals;
|
||||
|
|
@ -620,7 +619,13 @@ void FirstStageMount::UseDsuIfPresent() {
|
|||
}
|
||||
return InitRequiredDevices(std::move(devices));
|
||||
};
|
||||
auto images = IImageManager::Open("dsu", 0ms);
|
||||
std::string active_dsu;
|
||||
if (!gsi::GetActiveDsu(&active_dsu)) {
|
||||
LOG(ERROR) << "Failed to GetActiveDsu";
|
||||
return;
|
||||
}
|
||||
LOG(INFO) << "DSU slot: " << active_dsu;
|
||||
auto images = IImageManager::Open("dsu/" + active_dsu, 0ms);
|
||||
if (!images || !images->MapAllImages(init_devices)) {
|
||||
LOG(ERROR) << "DSU partition layout could not be instantiated";
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue