clang-format the rest of the files
Apply clang-format to fix the remaining files not fixed by
change I23cde3f0bbcac13bef555d13514e922c79d5ad48
Test: Format-only changes; treehugger suffices.
Change-Id: I1bfd5c8d68d298596875d5edae26cdfe27c03489
diff --git a/model/EmulatedVolume.cpp b/model/EmulatedVolume.cpp
index 25ea602..19074af 100644
--- a/model/EmulatedVolume.cpp
+++ b/model/EmulatedVolume.cpp
@@ -27,8 +27,8 @@
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/sysmacros.h>
+#include <sys/types.h>
#include <sys/wait.h>
using android::base::StringPrintf;
@@ -38,22 +38,21 @@
static const char* kFusePath = "/system/bin/sdcard";
-EmulatedVolume::EmulatedVolume(const std::string& rawPath) :
- VolumeBase(Type::kEmulated), mFusePid(0) {
+EmulatedVolume::EmulatedVolume(const std::string& rawPath)
+ : VolumeBase(Type::kEmulated), mFusePid(0) {
setId("emulated");
mRawPath = rawPath;
mLabel = "emulated";
}
-EmulatedVolume::EmulatedVolume(const std::string& rawPath, dev_t device,
- const std::string& fsUuid) : VolumeBase(Type::kEmulated), mFusePid(0) {
+EmulatedVolume::EmulatedVolume(const std::string& rawPath, dev_t device, const std::string& fsUuid)
+ : VolumeBase(Type::kEmulated), mFusePid(0) {
setId(StringPrintf("emulated:%u,%u", major(device), minor(device)));
mRawPath = rawPath;
mLabel = fsUuid;
}
-EmulatedVolume::~EmulatedVolume() {
-}
+EmulatedVolume::~EmulatedVolume() {}
status_t EmulatedVolume::doMount() {
// We could have migrated storage to an adopted private volume, so always
@@ -72,8 +71,8 @@
setLabel(label);
if (fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) ||
- fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) ||
- fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT)) {
+ fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) ||
+ fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT)) {
PLOG(ERROR) << getId() << " failed to create mount points";
return -errno;
}
@@ -81,6 +80,7 @@
dev_t before = GetDevice(mFuseWrite);
if (!(mFusePid = fork())) {
+ // clang-format off
if (execl(kFusePath, kFusePath,
"-u", "1023", // AID_MEDIA_RW
"-g", "1023", // AID_MEDIA_RW
@@ -91,6 +91,7 @@
mRawPath.c_str(),
label.c_str(),
NULL)) {
+ // clang-format on
PLOG(ERROR) << "Failed to exec";
}
@@ -106,7 +107,7 @@
nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME);
while (before == GetDevice(mFuseWrite)) {
LOG(VERBOSE) << "Waiting for FUSE to spin up...";
- usleep(50000); // 50ms
+ usleep(50000); // 50ms
nsecs_t now = systemTime(SYSTEM_TIME_BOOTTIME);
if (nanoseconds_to_milliseconds(now - start) > 5000) {
diff --git a/model/PublicVolume.cpp b/model/PublicVolume.cpp
index 4076e73..9b48f82 100644
--- a/model/PublicVolume.cpp
+++ b/model/PublicVolume.cpp
@@ -20,8 +20,8 @@
#include "fs/Exfat.h"
#include "fs/Vfat.h"
-#include <android-base/stringprintf.h>
#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
#include <cutils/fs.h>
#include <private/android_filesystem_config.h>
#include <utils/Timers.h>
@@ -30,8 +30,8 @@
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <sys/sysmacros.h>
+#include <sys/types.h>
#include <sys/wait.h>
using android::base::StringPrintf;
@@ -43,14 +43,12 @@
static const char* kAsecPath = "/mnt/secure/asec";
-PublicVolume::PublicVolume(dev_t device) :
- VolumeBase(Type::kPublic), mDevice(device), mFusePid(0) {
+PublicVolume::PublicVolume(dev_t device) : VolumeBase(Type::kPublic), mDevice(device), mFusePid(0) {
setId(StringPrintf("public:%u,%u", major(device), minor(device)));
mDevPath = StringPrintf("/dev/block/vold/%s", getId().c_str());
}
-PublicVolume::~PublicVolume() {
-}
+PublicVolume::~PublicVolume() {}
status_t PublicVolume::readMetadata() {
status_t res = ReadMetadataUntrusted(mDevPath, &mFsType, &mFsUuid, &mFsLabel);
@@ -66,8 +64,7 @@
std::string securePath(mRawPath + "/.android_secure");
// Recover legacy secure path
- if (!access(legacyPath.c_str(), R_OK | X_OK)
- && access(securePath.c_str(), R_OK | X_OK)) {
+ if (!access(legacyPath.c_str(), R_OK | X_OK) && access(securePath.c_str(), R_OK | X_OK)) {
if (rename(legacyPath.c_str(), securePath.c_str())) {
PLOG(WARNING) << getId() << " failed to rename legacy ASEC dir";
}
@@ -159,8 +156,8 @@
}
if (fs_prepare_dir(mFuseDefault.c_str(), 0700, AID_ROOT, AID_ROOT) ||
- fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) ||
- fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT)) {
+ fs_prepare_dir(mFuseRead.c_str(), 0700, AID_ROOT, AID_ROOT) ||
+ fs_prepare_dir(mFuseWrite.c_str(), 0700, AID_ROOT, AID_ROOT)) {
PLOG(ERROR) << getId() << " failed to create FUSE mount points";
return -errno;
}
@@ -169,6 +166,7 @@
if (!(mFusePid = fork())) {
if (getMountFlags() & MountFlags::kPrimary) {
+ // clang-format off
if (execl(kFusePath, kFusePath,
"-u", "1023", // AID_MEDIA_RW
"-g", "1023", // AID_MEDIA_RW
@@ -177,9 +175,11 @@
mRawPath.c_str(),
stableName.c_str(),
NULL)) {
+ // clang-format on
PLOG(ERROR) << "Failed to exec";
}
} else {
+ // clang-format off
if (execl(kFusePath, kFusePath,
"-u", "1023", // AID_MEDIA_RW
"-g", "1023", // AID_MEDIA_RW
@@ -187,6 +187,7 @@
mRawPath.c_str(),
stableName.c_str(),
NULL)) {
+ // clang-format on
PLOG(ERROR) << "Failed to exec";
}
}
@@ -203,7 +204,7 @@
nsecs_t start = systemTime(SYSTEM_TIME_BOOTTIME);
while (before == GetDevice(mFuseWrite)) {
LOG(VERBOSE) << "Waiting for FUSE to spin up...";
- usleep(50000); // 50ms
+ usleep(50000); // 50ms
nsecs_t now = systemTime(SYSTEM_TIME_BOOTTIME);
if (nanoseconds_to_milliseconds(now - start) > 5000) {
diff --git a/model/VolumeBase.cpp b/model/VolumeBase.cpp
index cf3d54e..74bd874 100644
--- a/model/VolumeBase.cpp
+++ b/model/VolumeBase.cpp
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#include "Utils.h"
#include "VolumeBase.h"
+#include "Utils.h"
#include "VolumeManager.h"
-#include <android-base/stringprintf.h>
#include <android-base/logging.h>
+#include <android-base/stringprintf.h>
#include <fcntl.h>
#include <stdlib.h>
@@ -32,10 +32,13 @@
namespace android {
namespace vold {
-VolumeBase::VolumeBase(Type type) :
- mType(type), mMountFlags(0), mMountUserId(-1), mCreated(false), mState(
- State::kUnmounted), mSilent(false) {
-}
+VolumeBase::VolumeBase(Type type)
+ : mType(type),
+ mMountFlags(0),
+ mMountUserId(-1),
+ mCreated(false),
+ mState(State::kUnmounted),
+ mSilent(false) {}
VolumeBase::~VolumeBase() {
CHECK(!mCreated);
@@ -45,7 +48,9 @@
mState = state;
auto listener = getListener();
- if (listener) listener->onVolumeStateChanged(getId(), static_cast<int32_t>(mState));
+ if (listener) {
+ listener->onVolumeStateChanged(getId(), static_cast<int32_t>(mState));
+ }
}
status_t VolumeBase::setDiskId(const std::string& diskId) {
@@ -131,7 +136,9 @@
mInternalPath = internalPath;
auto listener = getListener();
- if (listener) listener->onVolumeInternalPathChanged(getId(), mInternalPath);
+ if (listener) {
+ listener->onVolumeInternalPathChanged(getId(), mInternalPath);
+ }
return OK;
}
@@ -178,8 +185,9 @@
status_t res = doCreate();
auto listener = getListener();
- if (listener) listener->onVolumeCreated(getId(),
- static_cast<int32_t>(mType), mDiskId, mPartGuid);
+ if (listener) {
+ listener->onVolumeCreated(getId(), static_cast<int32_t>(mType), mDiskId, mPartGuid);
+ }
setState(State::kUnmounted);
return res;
@@ -199,9 +207,10 @@
setState(State::kRemoved);
}
-
auto listener = getListener();
- if (listener) listener->onVolumeDestroyed(getId());
+ if (listener) {
+ listener->onVolumeDestroyed(getId());
+ }
status_t res = doDestroy();
mCreated = false;
@@ -238,8 +247,7 @@
setState(State::kEjecting);
for (const auto& vol : mVolumes) {
if (vol->destroy()) {
- LOG(WARNING) << getId() << " failed to destroy " << vol->getId()
- << " stacked above";
+ LOG(WARNING) << getId() << " failed to destroy " << vol->getId() << " stacked above";
}
}
mVolumes.clear();
diff --git a/model/VolumeBase.h b/model/VolumeBase.h
index 2052c15..a75669e 100644
--- a/model/VolumeBase.h
+++ b/model/VolumeBase.h
@@ -17,8 +17,8 @@
#ifndef ANDROID_VOLD_VOLUME_BASE_H
#define ANDROID_VOLD_VOLUME_BASE_H
-#include "android/os/IVoldListener.h"
#include "Utils.h"
+#include "android/os/IVoldListener.h"
#include <cutils/multiuser.h>
#include <utils/Errors.h>
@@ -45,7 +45,7 @@
* volumes and removes any bind mounts before finally unmounting itself.
*/
class VolumeBase {
-public:
+ public:
virtual ~VolumeBase();
enum class Type {
@@ -103,7 +103,7 @@
status_t unmount();
status_t format(const std::string& fsType);
-protected:
+ protected:
explicit VolumeBase(Type type);
virtual status_t doCreate();
@@ -119,7 +119,7 @@
android::sp<android::os::IVoldListener> getListener();
-private:
+ private:
/* ID that uniquely references volume while alive */
std::string mId;
/* ID that uniquely references parent disk while alive */