Fix UFS err_stats

Bug: 392193452
Change-Id: I159f5bcfb8de1b33f46ba860b4436d1dfc6907f2
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
This commit is contained in:
Jaegeuk Kim 2025-01-24 18:02:28 -08:00
parent 861f6bcf77
commit 6151bff500

View file

@ -27,7 +27,6 @@
#define F2FS_FSCK_TIME_PROPERTY "ro.boottime.init.fsck.data" #define F2FS_FSCK_TIME_PROPERTY "ro.boottime.init.fsck.data"
#define F2FS_MNT_TIME_PROPERTY "ro.boottime.init.mount.data" #define F2FS_MNT_TIME_PROPERTY "ro.boottime.init.mount.data"
#define BOOTDEVICE_PROPERTY "ro.boot.bootdevice"
#define BUILD_TYPE_PROPERTY "ro.build.type" #define BUILD_TYPE_PROPERTY "ro.build.type"
void read_buffer(int buf_id, int total_len, const char* path) void read_buffer(int buf_id, int total_len, const char* path)
@ -90,24 +89,10 @@ int main() {
if (statdir) { if (statdir) {
dirent *stat_entry; dirent *stat_entry;
while ((stat_entry = readdir(statdir.get())) != nullptr) { while ((stat_entry = readdir(statdir.get())) != nullptr) {
std::string ufs_err_stats_path(stat_entry->d_name); std::string stat_name(stat_entry->d_name);
if (!strcmp(ufs_err_stats_path.c_str(), ".") if (stat_name == "." || stat_name == "..") continue;
|| !strcmp(ufs_err_stats_path.c_str(), "..")) dumpFileContent(stat_name.c_str(),
continue; (ufs_err_stats_path + stat_name).c_str());
std::string bootdevice = android::base::GetProperty(
BOOTDEVICE_PROPERTY, "");
std::string err_stat_path = "/sys/devices/platform/";
err_stat_path.append(bootdevice.c_str());
err_stat_path.append("/err_stats/");
err_stat_path.append(ufs_err_stats_path.c_str());
std::ifstream err_stat_file(err_stat_path);
if (err_stat_file.is_open()) {
std::string err_stat_atom;
err_stat_file >> err_stat_atom;
printf("%s:%s\n", ufs_err_stats_path.c_str(),
err_stat_atom.c_str());
err_stat_file.close();
}
} }
} }