Merge "fs_mgr: ReadDefaultFstab suppress ReadFstabFromDt logging"
am: 33cff00c1c
Change-Id: Ia141090dee34971c219be0e57a228a03e20001af
diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp
index 8076909..aeab893 100644
--- a/fs_mgr/fs_mgr_fstab.cpp
+++ b/fs_mgr/fs_mgr_fstab.cpp
@@ -720,10 +720,10 @@
}
// Returns fstab entries parsed from the device tree if they exist
-bool ReadFstabFromDt(Fstab* fstab) {
+bool ReadFstabFromDt(Fstab* fstab, bool log) {
std::string fstab_buf = read_fstab_from_dt();
if (fstab_buf.empty()) {
- LINFO << __FUNCTION__ << "(): failed to read fstab from dt";
+ if (log) LINFO << __FUNCTION__ << "(): failed to read fstab from dt";
return false;
}
@@ -731,13 +731,15 @@
fmemopen(static_cast<void*>(const_cast<char*>(fstab_buf.c_str())),
fstab_buf.length(), "r"), fclose);
if (!fstab_file) {
- PERROR << __FUNCTION__ << "(): failed to create a file stream for fstab dt";
+ if (log) PERROR << __FUNCTION__ << "(): failed to create a file stream for fstab dt";
return false;
}
if (!fs_mgr_read_fstab_file(fstab_file.get(), false, fstab)) {
- LERROR << __FUNCTION__ << "(): failed to load fstab from kernel:"
- << std::endl << fstab_buf;
+ if (log) {
+ LERROR << __FUNCTION__ << "(): failed to load fstab from kernel:" << std::endl
+ << fstab_buf;
+ }
return false;
}
@@ -779,7 +781,7 @@
// Loads the fstab file and combines with fstab entries passed in from device tree.
bool ReadDefaultFstab(Fstab* fstab) {
Fstab dt_fstab;
- ReadFstabFromDt(&dt_fstab);
+ ReadFstabFromDt(&dt_fstab, false);
*fstab = std::move(dt_fstab);
diff --git a/fs_mgr/include_fstab/fstab/fstab.h b/fs_mgr/include_fstab/fstab/fstab.h
index 38f96c0..9c4d2da 100644
--- a/fs_mgr/include_fstab/fstab/fstab.h
+++ b/fs_mgr/include_fstab/fstab/fstab.h
@@ -192,7 +192,7 @@
using Fstab = std::vector<FstabEntry>;
bool ReadFstabFromFile(const std::string& path, Fstab* fstab);
-bool ReadFstabFromDt(Fstab* fstab);
+bool ReadFstabFromDt(Fstab* fstab, bool log = true);
bool ReadDefaultFstab(Fstab* fstab);
// Temporary conversion functions.