Fix unused function error for user build

```
system/core/fs_mgr/fs_mgr_overlayfs.cpp:83:6: error: unused function
'fs_mgr_is_dsu_running' [-Werror,-Wunused-function]
```

Bug: 172405271
Bug: 165925766
Test: build aosp_bonito-user, no warning/error
Change-Id: I3206e5bd13658ab0b7f5826e8e1c206c8df65684
This commit is contained in:
Yo Chiang 2020-11-04 14:44:37 +08:00
parent b4a3f080e6
commit cc86e967c7
1 changed files with 19 additions and 19 deletions

View File

@ -73,25 +73,6 @@ bool fs_mgr_access(const std::string& path) {
return ret;
}
bool fs_mgr_in_recovery() {
// Check the existence of recovery binary instead of using the compile time
// macro, because first-stage-init is compiled with __ANDROID_RECOVERY__
// defined, albeit not in recovery. More details: system/core/init/README.md
return fs_mgr_access("/system/bin/recovery");
}
bool fs_mgr_is_dsu_running() {
// Since android::gsi::CanBootIntoGsi() or android::gsi::MarkSystemAsGsi() is
// never called in recovery, the return value of android::gsi::IsGsiRunning()
// is not well-defined. In this case, just return false as being in recovery
// implies not running a DSU system.
if (fs_mgr_in_recovery()) return false;
auto saved_errno = errno;
auto ret = android::gsi::IsGsiRunning();
errno = saved_errno;
return ret;
}
// determine if a filesystem is available
bool fs_mgr_overlayfs_filesystem_available(const std::string& filesystem) {
std::string filesystems;
@ -188,6 +169,25 @@ bool fs_mgr_filesystem_has_space(const std::string& mount_point) {
(vst.f_bfree * vst.f_bsize) >= kSizeThreshold;
}
bool fs_mgr_in_recovery() {
// Check the existence of recovery binary instead of using the compile time
// macro, because first-stage-init is compiled with __ANDROID_RECOVERY__
// defined, albeit not in recovery. More details: system/core/init/README.md
return fs_mgr_access("/system/bin/recovery");
}
bool fs_mgr_is_dsu_running() {
// Since android::gsi::CanBootIntoGsi() or android::gsi::MarkSystemAsGsi() is
// never called in recovery, the return value of android::gsi::IsGsiRunning()
// is not well-defined. In this case, just return false as being in recovery
// implies not running a DSU system.
if (fs_mgr_in_recovery()) return false;
auto saved_errno = errno;
auto ret = android::gsi::IsGsiRunning();
errno = saved_errno;
return ret;
}
const auto kPhysicalDevice = "/dev/block/by-name/"s;
constexpr char kScratchImageMetadata[] = "/metadata/gsi/remount/lp_metadata";