From f07d07bf47042649f5b031694265e048351cccc0 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Thu, 13 Jun 2019 17:37:01 -0700 Subject: [PATCH] fs_mgr_fstab: translate reserve_root to reserved_size in fsmgr Without this patch, fstab should decribe reserve_root=[# of 4KB blocks] in f2fs mount option as well as reserved_size=[KB] in fsmgr flag to notify it to framework. With this patch, it should be just fine to use reserve_root=[# of 4KB blocks] in fstab. Bug: 135003600 Test: checked vold.has_reserved Change-Id: Iab75f7da9792ad205a6c4d2d0f1eba8c16a5266a Signed-off-by: Jaegeuk Kim --- fs_mgr/fs_mgr_fstab.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 403f9be8c..31790b160 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -171,6 +171,18 @@ void ParseMountFlags(const std::string& flags, FstabEntry* entry) { fs_options.append(","); // appends a comma if not the first } fs_options.append(flag); + + if (entry->fs_type == "f2fs" && StartsWith(flag, "reserve_root=")) { + std::string arg; + if (auto equal_sign = flag.find('='); equal_sign != std::string::npos) { + arg = flag.substr(equal_sign + 1); + } + if (!ParseInt(arg, &entry->reserved_size)) { + LWARNING << "Warning: reserve_root= flag malformed: " << arg; + } else { + entry->reserved_size <<= 12; + } + } } } entry->fs_options = std::move(fs_options);