From f98d6c49e0ef3ff946316c7fad3a96db1264282c Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Fri, 25 Jan 2019 09:08:42 -0800 Subject: [PATCH] fs_mgr: ReadDefaultFstab suppress ReadFstabFromDt logging Since we are moving the fstab from DT into the ramdisk fstab, the logging from ReadFstabFromDt when reading the default fstab is turning into logging noise. Test: compile Bug: 122602260 Change-Id: Icba0962c13d701afce2dc7c4f23712dd47ea0100 --- fs_mgr/fs_mgr_fstab.cpp | 14 ++++++++------ fs_mgr/include_fstab/fstab/fstab.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 9d4f280ec..9718a8370 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -719,10 +719,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; } @@ -730,13 +730,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; } @@ -778,7 +780,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.