Merge "Remove the rest of users of the old style fstab"
This commit is contained in:
commit
286684f835
5 changed files with 27 additions and 37 deletions
|
|
@ -75,16 +75,20 @@ static std::string find_proc_mount(const char* dir) {
|
|||
|
||||
// Returns the device used to mount a directory in the fstab.
|
||||
static std::string find_fstab_mount(const char* dir) {
|
||||
std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
|
||||
fs_mgr_free_fstab);
|
||||
struct fstab_rec* rec = fs_mgr_get_entry_for_mount_point(fstab.get(), dir);
|
||||
if (!rec) {
|
||||
Fstab fstab;
|
||||
if (!ReadDefaultFstab(&fstab)) {
|
||||
return "";
|
||||
}
|
||||
if (fs_mgr_is_logical(rec)) {
|
||||
fs_mgr_update_logical_partition(rec);
|
||||
|
||||
auto entry = std::find_if(fstab.begin(), fstab.end(),
|
||||
[&dir](const auto& entry) { return entry.mount_point == dir; });
|
||||
if (entry == fstab.end()) {
|
||||
return "";
|
||||
}
|
||||
return rec->blk_device;
|
||||
if (entry->fs_mgr_flags.logical) {
|
||||
fs_mgr_update_logical_partition(&(*entry));
|
||||
}
|
||||
return entry->blk_device;
|
||||
}
|
||||
|
||||
// The proc entry for / is full of lies, so check fstab instead.
|
||||
|
|
|
|||
|
|
@ -41,8 +41,6 @@
|
|||
|
||||
#include "fec/io.h"
|
||||
|
||||
struct fstab *fstab;
|
||||
|
||||
#ifdef ALLOW_ADBD_DISABLE_VERITY
|
||||
static const bool kAllowDisableVerity = true;
|
||||
#else
|
||||
|
|
@ -213,18 +211,18 @@ void set_verity_enabled_state_service(unique_fd fd, bool enable) {
|
|||
// Not using AVB - assume VB1.0.
|
||||
|
||||
// read all fstab entries at once from all sources
|
||||
if (!fstab) fstab = fs_mgr_read_fstab_default();
|
||||
if (!fstab) {
|
||||
Fstab fstab;
|
||||
if (!ReadDefaultFstab(&fstab)) {
|
||||
WriteFdExactly(fd.get(), "Failed to read fstab\n");
|
||||
suggest_run_adb_root(fd.get());
|
||||
return;
|
||||
}
|
||||
|
||||
// Loop through entries looking for ones that verity manages.
|
||||
for (int i = 0; i < fstab->num_entries; i++) {
|
||||
if (fs_mgr_is_verified(&fstab->recs[i])) {
|
||||
if (set_verity_enabled_state(fd.get(), fstab->recs[i].blk_device,
|
||||
fstab->recs[i].mount_point, enable)) {
|
||||
for (const auto& entry : fstab) {
|
||||
if (entry.fs_mgr_flags.verify) {
|
||||
if (set_verity_enabled_state(fd.get(), entry.blk_device.c_str(),
|
||||
entry.mount_point.c_str(), enable)) {
|
||||
any_changed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,15 +52,17 @@ void WipeOverlayfsForPartition(FastbootDevice* device, const std::string& partit
|
|||
// Following appears to have a first time 2% impact on flashing speeds.
|
||||
|
||||
// Convert partition_name to a validated mount point and wipe.
|
||||
std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
|
||||
fs_mgr_free_fstab);
|
||||
for (auto i = 0; i < fstab->num_entries; i++) {
|
||||
const auto mount_point = fstab->recs[i].mount_point;
|
||||
if (!mount_point) continue;
|
||||
auto partition = android::base::Basename(mount_point);
|
||||
if ("/"s == mount_point) partition = "system";
|
||||
Fstab fstab;
|
||||
ReadDefaultFstab(&fstab);
|
||||
|
||||
for (const auto& entry : fstab) {
|
||||
auto partition = android::base::Basename(entry.mount_point);
|
||||
if ("/" == entry.mount_point) {
|
||||
partition = "system";
|
||||
}
|
||||
|
||||
if ((partition + device->GetCurrentSlot()) == partition_name) {
|
||||
fs_mgr_overlayfs_teardown(mount_point);
|
||||
fs_mgr_overlayfs_teardown(entry.mount_point.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -889,19 +889,6 @@ bool fs_mgr_update_logical_partition(FstabEntry* entry) {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool fs_mgr_update_logical_partition(struct fstab_rec* rec) {
|
||||
auto entry = FstabRecToFstabEntry(rec);
|
||||
|
||||
if (!fs_mgr_update_logical_partition(&entry)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
free(rec->blk_device);
|
||||
rec->blk_device = strdup(entry.blk_device.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
class CheckpointManager {
|
||||
public:
|
||||
CheckpointManager(int needs_checkpoint = -1) : needs_checkpoint_(needs_checkpoint) {}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ bool fs_mgr_update_verity_state(
|
|||
std::function<void(const std::string& mount_point, int mode)> callback);
|
||||
bool fs_mgr_swapon_all(const Fstab& fstab);
|
||||
bool fs_mgr_update_logical_partition(FstabEntry* entry);
|
||||
bool fs_mgr_update_logical_partition(struct fstab_rec* rec);
|
||||
|
||||
int fs_mgr_do_format(const FstabEntry& entry, bool reserve_footer);
|
||||
int fs_mgr_do_format(fstab_rec* rec, bool reserve_footer);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue