summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Stefani <luca.stefani.ge1@gmail.com>2020-07-16 17:05:18 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-07-16 17:05:18 +0000
commitb7b3a9ca33ba15112fb3205f233c8a8d99b48116 (patch)
tree33f4e5900bba51ec18cd919936b40581b0bab33c
parent22b93b31acf597524d89d145b20c598f9fcbed60 (diff)
parentcbc7b4a5a4fb63d479f3909b6bd409af85bde83a (diff)
downloadplatform_system_incremental_delivery-b7b3a9ca33ba15112fb3205f233c8a8d99b48116.tar.gz
platform_system_incremental_delivery-b7b3a9ca33ba15112fb3205f233c8a8d99b48116.tar.bz2
platform_system_incremental_delivery-b7b3a9ca33ba15112fb3205f233c8a8d99b48116.zip
incfs: Get rid of short ab for android::base am: 629be47a28 am: 660599a2b3 am: cbc7b4a5a4
Original change: https://android-review.googlesource.com/c/platform/system/incremental_delivery/+/1363551 Change-Id: I3abb11bb5339ebee252da7522781e15deaa4b583
-rw-r--r--incfs/incfs.cpp42
-rw-r--r--incfs/incfsdump/dump.cpp3
2 files changed, 23 insertions, 22 deletions
diff --git a/incfs/incfs.cpp b/incfs/incfs.cpp
index 84f339e..5f4990e 100644
--- a/incfs/incfs.cpp
+++ b/incfs/incfs.cpp
@@ -53,7 +53,9 @@
#include "path.h"
using namespace std::literals;
-namespace ab = android::base;
+
+using android::base::StringPrintf;
+using android::base::unique_fd;
struct IncFsControl final {
IncFsFd cmd;
@@ -64,19 +66,19 @@ struct IncFsControl final {
};
static android::incfs::MountRegistry& registry() {
- static ab::NoDestructor<android::incfs::MountRegistry> instance{};
+ static android::base::NoDestructor<android::incfs::MountRegistry> instance{};
return *instance;
}
-static ab::unique_fd openRaw(std::string_view file) {
- auto fd = ab::unique_fd(::open(android::incfs::details::c_str(file), O_RDONLY | O_CLOEXEC));
+static unique_fd openRaw(std::string_view file) {
+ auto fd = unique_fd(::open(android::incfs::details::c_str(file), O_RDONLY | O_CLOEXEC));
if (fd < 0) {
- return ab::unique_fd{-errno};
+ return unique_fd{-errno};
}
return fd;
}
-static ab::unique_fd openRaw(std::string_view dir, std::string_view name) {
+static unique_fd openRaw(std::string_view dir, std::string_view name) {
return openRaw(android::incfs::path::join(dir, name));
}
@@ -129,24 +131,24 @@ IncFsFeatures IncFs_Features() {
static bool isFsAvailable() {
static const char kProcFilesystems[] = "/proc/filesystems";
std::string filesystems;
- if (!ab::ReadFileToString(kProcFilesystems, &filesystems)) {
+ if (!android::base::ReadFileToString(kProcFilesystems, &filesystems)) {
return false;
}
return filesystems.find("\t" INCFS_NAME "\n") != std::string::npos;
}
static std::string_view incFsPropertyValue() {
- static const ab::NoDestructor<std::string> kValue{
+ static const android::base::NoDestructor<std::string> kValue{
android::sysprop::IncrementalProperties::enable().value_or("")};
return *kValue;
}
static std::pair<bool, std::string_view> parseProperty(std::string_view property) {
- auto boolVal = ab::ParseBool(property);
- if (boolVal == ab::ParseBoolResult::kTrue) {
+ auto boolVal = android::base::ParseBool(property);
+ if (boolVal == android::base::ParseBoolResult::kTrue) {
return {isFsAvailable(), {}};
}
- if (boolVal == ab::ParseBoolResult::kFalse) {
+ if (boolVal == android::base::ParseBoolResult::kFalse) {
return {false, {}};
}
@@ -184,7 +186,7 @@ public:
return true;
}
std::call_once(loadedFlag_, [this] {
- const ab::unique_fd fd(
+ const unique_fd fd(
TEMP_FAILURE_RETRY(::open(android::incfs::details::c_str(moduleName_),
O_RDONLY | O_NOFOLLOW | O_CLOEXEC)));
if (fd < 0) {
@@ -276,7 +278,7 @@ static int rmDirContent(const char* path) {
if (entry->d_name == "."sv || entry->d_name == ".."sv) {
continue;
}
- auto fullPath = ab::StringPrintf("%s/%s", path, entry->d_name);
+ auto fullPath = StringPrintf("%s/%s", path, entry->d_name);
if (entry->d_type == DT_DIR) {
if (const auto err = rmDirContent(fullPath.c_str()); err != 0) {
return err;
@@ -294,11 +296,11 @@ static int rmDirContent(const char* path) {
}
static std::string makeMountOptionsString(IncFsMountOptions options) {
- return ab::StringPrintf("read_timeout_ms=%u,readahead=0,rlog_pages=%u,rlog_wakeup_cnt=1",
- unsigned(options.defaultReadTimeoutMs),
- unsigned(options.readLogBufferPages < 0
- ? INCFS_DEFAULT_PAGE_READ_BUFFER_PAGES
- : options.readLogBufferPages));
+ return StringPrintf("read_timeout_ms=%u,readahead=0,rlog_pages=%u,rlog_wakeup_cnt=1",
+ unsigned(options.defaultReadTimeoutMs),
+ unsigned(options.readLogBufferPages < 0
+ ? INCFS_DEFAULT_PAGE_READ_BUFFER_PAGES
+ : options.readLogBufferPages));
}
static IncFsControl* makeControl(const char* root) {
@@ -306,7 +308,7 @@ static IncFsControl* makeControl(const char* root) {
if (!cmd.ok()) {
return nullptr;
}
- ab::unique_fd pendingReads(fcntl(cmd.get(), F_DUPFD_CLOEXEC, cmd.get()));
+ unique_fd pendingReads(fcntl(cmd.get(), F_DUPFD_CLOEXEC, cmd.get()));
if (!pendingReads.ok()) {
return nullptr;
}
@@ -1037,7 +1039,7 @@ IncFsErrorCode IncFs_WaitForPageReads(const IncFsControl* control, int32_t timeo
}
static IncFsFd openForSpecialOps(int cmd, const char* path) {
- ab::unique_fd fd(::open(path, O_RDONLY | O_CLOEXEC));
+ unique_fd fd(::open(path, O_RDONLY | O_CLOEXEC));
if (fd < 0) {
return -errno;
}
diff --git a/incfs/incfsdump/dump.cpp b/incfs/incfsdump/dump.cpp
index e6c49b6..4959062 100644
--- a/incfs/incfsdump/dump.cpp
+++ b/incfs/incfsdump/dump.cpp
@@ -47,7 +47,6 @@
#include <string_view>
using namespace std::literals;
-namespace ab = android::base;
namespace {
@@ -199,7 +198,7 @@ typedef union {
class Dump {
public:
Dump(std::string_view backingFile)
- : mBackingFile(ab::Basename(std::string(backingFile))), mIn(backingFile) {}
+ : mBackingFile(android::base::Basename(std::string(backingFile))), mIn(backingFile) {}
void run() {
if (!mIn) {