fs_mgr_overlayfs: Trim surrounding "@" from the per mountpoint scratch dir name
Right now we encode the per mountpoint scratch dir name like this: /system -> /mnt/overlay/@system/ /product/app -> /mnt/overlay/@product@app/ This CL changes it to: /system -> /mnt/overlay/system/ /product/app -> /mnt/overlay/product@app/ This makes it so that the encoded path for top-level mountpoints (like /system, /vendor) would have the same encoded scratch dir as before https://r.android.com/2795755 was introduced. With this change old first-stage-init can handle top-level remounts correctly. However for mountpoints with '/' in them, their remount scratch dirs would be encoded with the new format, and old first-stage-init would ignore and not setup these during boot. This makes the remount mechanism to function partially when running on an old ramdisk (first-stage-init) + new system combo. Normally we expect the init_boot ramdisk to be upgraded alongside system.img, so this change isn't strictly needed. However there are cases where we might want to develop new OS features on old vendor platform, thus this change. Bug: 306124139 Bug: 243503963 Test: adb-remount-test Change-Id: I9b43641bb338f11c6c83888880948e4b85af14e1
This commit is contained in:
parent
711a5e24fb
commit
dd62ec3288
1 changed files with 6 additions and 1 deletions
|
|
@ -98,7 +98,12 @@ std::string GetEncodedBaseDirForMountPoint(const std::string& mount_point) {
|
|||
if (mount_point.empty() || !android::base::Realpath(mount_point, &normalized_path)) {
|
||||
return "";
|
||||
}
|
||||
return android::base::StringReplace(normalized_path, "/", "@", true);
|
||||
std::string_view sv(normalized_path);
|
||||
if (sv != "/") {
|
||||
android::base::ConsumePrefix(&sv, "/");
|
||||
android::base::ConsumeSuffix(&sv, "/");
|
||||
}
|
||||
return android::base::StringReplace(sv, "/", "@", true);
|
||||
}
|
||||
|
||||
static bool fs_mgr_is_dir(const std::string& path) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue