diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 807690959..aeab89381 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -720,10 +720,10 @@ struct fstab* fs_mgr_read_fstab(const char* fstab_path) { } // 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 @@ bool ReadFstabFromDt(Fstab* fstab) { fmemopen(static_cast(const_cast(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 @@ static std::string get_fstab_path() // 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 38f96c01f..9c4d2da66 100644 --- a/fs_mgr/include_fstab/fstab/fstab.h +++ b/fs_mgr/include_fstab/fstab/fstab.h @@ -192,7 +192,7 @@ struct FstabEntry { using Fstab = std::vector; 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.