From a6aae2f5a5949c49475c7ba603a0567b49cd00b6 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Sat, 17 Feb 2018 06:02:30 -0800 Subject: [PATCH 1/4] vold: Idle-maint issues discards fully Change-Id: Ib20a55e8761aa740b530803f029ecb36256fe9aa Signed-off-by: Jaegeuk Kim --- IdleMaint.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/IdleMaint.cpp b/IdleMaint.cpp index 62086cd..a2b5faa 100644 --- a/IdleMaint.cpp +++ b/IdleMaint.cpp @@ -225,6 +225,9 @@ static bool waitForGc(const std::list& paths) { static int startGc(const std::list& paths) { for (const auto& path : paths) { LOG(DEBUG) << "Start GC on " << path; + if (!WriteStringToFile("1", path + "/discard_granularity")) { + PLOG(WARNING) << "Set discard gralunarity failed on" << path; + } if (!WriteStringToFile("1", path + "/gc_urgent")) { PLOG(WARNING) << "Start GC failed on " << path; } @@ -238,6 +241,9 @@ static int stopGc(const std::list& paths) { if (!WriteStringToFile("0", path + "/gc_urgent")) { PLOG(WARNING) << "Stop GC failed on " << path; } + if (!WriteStringToFile("16", path + "/discard_granularity")) { + PLOG(WARNING) << "Set discard gralunarity failed on" << path; + } } return android::OK; } From ea2d2bb46c1bf14e6a2b262946c81d8e85272e33 Mon Sep 17 00:00:00 2001 From: Risan Date: Fri, 23 Feb 2018 08:12:37 +0900 Subject: [PATCH 2/4] Add ArcService AIDL in Vold This is needed to allow ARC++ Vold to interact with ArcBridgeService through SystemServer. Bug: 64500663 Test: Compiled, tested on device + cts in master-arc-dev (ag/3488659) Change-Id: I3b05b0f456ec99be9163877a2d83cdbf2bb94991 --- Android.bp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Android.bp b/Android.bp index 12d8b2d..a3072eb 100644 --- a/Android.bp +++ b/Android.bp @@ -134,6 +134,7 @@ cc_library_static { "model/ObbVolume.cpp", ], static_libs: [ + "arc_services_aidl", "libarcobbvolume", ], shared_libs: [ @@ -155,6 +156,7 @@ cc_binary { product_variables: { arc: { static_libs: [ + "arc_services_aidl", "libarcobbvolume", ], shared_libs: [ From 5540b4406c2ca9c5a3654cabc1ab7e88afde58b5 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Sat, 24 Feb 2018 18:09:21 -0700 Subject: [PATCH 3/4] Use unique_ptr to safely release resources. Test: builds, boots Bug: 66995913 Change-Id: Ib580501fc979b63295b180250581dc7527de76b2 --- Loop.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Loop.cpp b/Loop.cpp index 3736d6a..335ca13 100644 --- a/Loop.cpp +++ b/Loop.cpp @@ -110,17 +110,16 @@ int Loop::destroyByDevice(const char *loopDevice) { int Loop::destroyAll() { ATRACE_NAME("Loop::destroyAll"); - DIR* dir; - struct dirent* de; - std::string root = "/dev/block/"; - if (!(dir = opendir(root.c_str()))) { + auto dirp = std::unique_ptr(opendir(root.c_str()), closedir); + if (!dirp) { PLOG(ERROR) << "Failed to opendir"; return -1; } // Poke through all devices looking for loops - while ((de = readdir(dir))) { + struct dirent* de; + while ((de = readdir(dirp.get()))) { auto test = std::string(de->d_name); if (!android::base::StartsWith(test, "loop")) continue; @@ -151,7 +150,6 @@ int Loop::destroyAll() { } } - closedir(dir); return 0; } From e50314d52b818f74d0f46b87ff6aebc74d037164 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Sat, 24 Feb 2018 18:23:35 -0700 Subject: [PATCH 4/4] Trim whitespace from sysfs values. Test: builds, boots Bug: 72740079 Change-Id: If364927ea762c7dee99bff5dc307e3b9b5355c2b --- model/Disk.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model/Disk.cpp b/model/Disk.cpp index 9fcf5e1..d7b19ac 100644 --- a/model/Disk.cpp +++ b/model/Disk.cpp @@ -257,6 +257,7 @@ status_t Disk::readMetadata() { PLOG(WARNING) << "Failed to read vendor from " << path; return -errno; } + tmp = android::base::Trim(tmp); mLabel = tmp; break; } @@ -267,6 +268,7 @@ status_t Disk::readMetadata() { PLOG(WARNING) << "Failed to read manufacturer from " << path; return -errno; } + tmp = android::base::Trim(tmp); int64_t manfid; if (!android::base::ParseInt(tmp, &manfid)) { PLOG(WARNING) << "Failed to parse manufacturer " << tmp;