summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYo Chiang <yochiang@google.com>2020-10-06 15:54:48 +0800
committerYo Chiang <yochiang@google.com>2020-10-07 18:48:10 +0800
commita19157d20ac199a22dd958be7d8b04a2f9c40b86 (patch)
treec63f667f0ed44189da9b05674d6293f764d0dda3 /include
parentf465eb8c7bd7596566a885c747304f117d801afe (diff)
downloadgsid-a19157d20ac199a22dd958be7d8b04a2f9c40b86.tar.gz
Make GetActiveDsu() static inline
So that libraries such as `libfstab` who only links to header-only library `libgsi_headers` can still call GetActiveDsu(). Bug: 168571434 Test: Build pass Change-Id: Ifa637320813a7a04cfb37f05b77cd90e5546b095
Diffstat (limited to 'include')
-rw-r--r--include/libgsi/libgsi.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/libgsi/libgsi.h b/include/libgsi/libgsi.h
index fbe2f17..ed47767 100644
--- a/include/libgsi/libgsi.h
+++ b/include/libgsi/libgsi.h
@@ -18,6 +18,8 @@
#include <string>
+#include <android-base/file.h>
+
namespace android {
namespace gsi {
@@ -55,7 +57,9 @@ static constexpr int kMaxBootAttempts = 1;
// Get the currently active dsu slot
// Return true on success
-bool GetActiveDsu(std::string* active_dsu);
+static inline bool GetActiveDsu(std::string* active_dsu) {
+ return android::base::ReadFileToString(kDsuActiveFile, active_dsu);
+}
// Returns true if the currently running system image is a live GSI.
bool IsGsiRunning();