vold: Support aborting FUSE connections.
This can be done through binder as well as vdc, using 'vdc volume
abort_fuse'.
Bug: 153411204
Test: adb shell vdc volume abort_fuse
Change-Id: I93e46dc1cd361729cc1162c63520cf73152ea409
diff --git a/Utils.cpp b/Utils.cpp
index 15a5e49..e3a419f 100644
--- a/Utils.cpp
+++ b/Utils.cpp
@@ -1330,6 +1330,21 @@
return true;
}
+status_t AbortFuseConnections() {
+ namespace fs = std::filesystem;
+
+ for (const auto& itEntry : fs::directory_iterator("/sys/fs/fuse/connections")) {
+ std::string abortPath = itEntry.path().string() + "/abort";
+ LOG(DEBUG) << "Aborting fuse connection entry " << abortPath;
+ bool ret = writeStringToFile("1", abortPath);
+ if (!ret) {
+ LOG(WARNING) << "Failed to write to " << abortPath;
+ }
+ }
+
+ return OK;
+}
+
status_t EnsureDirExists(const std::string& path, mode_t mode, uid_t uid, gid_t gid) {
if (access(path.c_str(), F_OK) != 0) {
PLOG(WARNING) << "Dir does not exist: " << path;