clang-format many files.
Test: Format-only changes; treehugger suffices.
Change-Id: I23cde3f0bbcac13bef555d13514e922c79d5ad48
diff --git a/Ext4Crypt.cpp b/Ext4Crypt.cpp
index 67b7e90..21071d4 100644
--- a/Ext4Crypt.cpp
+++ b/Ext4Crypt.cpp
@@ -31,12 +31,12 @@
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
-#include <unistd.h>
#include <limits.h>
#include <selinux/android.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <unistd.h>
#include <private/android_filesystem_config.h>
@@ -93,7 +93,7 @@
// TODO abolish this map, per b/26948053
std::map<userid_t, KeyBuffer> s_ce_keys;
-}
+} // namespace
static bool e4crypt_is_emulated() {
return property_get_bool("persist.sys.emulate_fbe", false);
@@ -145,8 +145,7 @@
}
static bool get_ce_key_new_path(const std::string& directory_path,
- const std::vector<std::string>& paths,
- std::string *ce_key_path) {
+ const std::vector<std::string>& paths, std::string* ce_key_path) {
if (paths.empty()) {
*ce_key_path = get_ce_key_current_path(directory_path);
return true;
@@ -163,9 +162,9 @@
// Discard all keys but the named one; rename it to canonical name.
// No point in acting on errors in this; ignore them.
-static void fixate_user_ce_key(const std::string& directory_path, const std::string &to_fix,
+static void fixate_user_ce_key(const std::string& directory_path, const std::string& to_fix,
const std::vector<std::string>& paths) {
- for (auto const other_path: paths) {
+ for (auto const other_path : paths) {
if (other_path != to_fix) {
android::vold::destroyKey(other_path);
}
@@ -181,10 +180,10 @@
static bool read_and_fixate_user_ce_key(userid_t user_id,
const android::vold::KeyAuthentication& auth,
- KeyBuffer *ce_key) {
+ KeyBuffer* ce_key) {
auto const directory_path = get_ce_key_directory_path(user_id);
auto const paths = get_ce_key_paths(directory_path);
- for (auto const ce_key_path: paths) {
+ for (auto const ce_key_path : paths) {
LOG(DEBUG) << "Trying user CE key " << ce_key_path;
if (android::vold::retrieveKey(ce_key_path, auth, ce_key)) {
LOG(DEBUG) << "Successfully retrieved key";
@@ -242,12 +241,14 @@
auto const paths = get_ce_key_paths(directory_path);
std::string ce_key_path;
if (!get_ce_key_new_path(directory_path, paths, &ce_key_path)) return false;
- if (!android::vold::storeKeyAtomically(ce_key_path, user_key_temp,
- kEmptyAuthentication, ce_key)) return false;
+ if (!android::vold::storeKeyAtomically(ce_key_path, user_key_temp, kEmptyAuthentication,
+ ce_key))
+ return false;
fixate_user_ce_key(directory_path, ce_key_path, paths);
// Write DE key second; once this is written, all is good.
if (!android::vold::storeKeyAtomically(get_de_key_path(user_id), user_key_temp,
- kEmptyAuthentication, de_key)) return false;
+ kEmptyAuthentication, de_key))
+ return false;
}
std::string de_raw_ref;
if (!android::vold::installKey(de_key, &de_raw_ref)) return false;
@@ -440,14 +441,14 @@
bool success = true;
std::string raw_ref;
success &= evict_ce_key(user_id);
- success &= lookup_key_ref(s_de_key_raw_refs, user_id, &raw_ref)
- && android::vold::evictKey(raw_ref);
+ success &=
+ lookup_key_ref(s_de_key_raw_refs, user_id, &raw_ref) && android::vold::evictKey(raw_ref);
s_de_key_raw_refs.erase(user_id);
auto it = s_ephemeral_users.find(user_id);
if (it != s_ephemeral_users.end()) {
s_ephemeral_users.erase(it);
} else {
- for (auto const path: get_ce_key_paths(get_ce_key_directory_path(user_id))) {
+ for (auto const path : get_ce_key_paths(get_ce_key_directory_path(user_id))) {
success &= android::vold::destroyKey(path);
}
auto de_key_path = get_de_key_path(user_id);
@@ -556,14 +557,14 @@
std::string token, secret;
if (!parse_hex(token_hex, &token)) return false;
if (!parse_hex(secret_hex, &secret)) return false;
- auto auth = secret.empty() ? kEmptyAuthentication
- : android::vold::KeyAuthentication(token, secret);
+ auto auth =
+ secret.empty() ? kEmptyAuthentication : android::vold::KeyAuthentication(token, secret);
auto it = s_ce_keys.find(user_id);
if (it == s_ce_keys.end()) {
LOG(ERROR) << "Key not loaded into memory, can't change for user " << user_id;
return false;
}
- const auto &ce_key = it->second;
+ const auto& ce_key = it->second;
auto const directory_path = get_ce_key_directory_path(user_id);
auto const paths = get_ce_key_paths(directory_path);
std::string ce_key_path;
@@ -670,7 +671,8 @@
if (!prepare_dir(system_legacy_path, 0700, AID_SYSTEM, AID_SYSTEM)) return false;
#if MANAGE_MISC_DIRS
if (!prepare_dir(misc_legacy_path, 0750, multiuser_get_uid(user_id, AID_SYSTEM),
- multiuser_get_uid(user_id, AID_EVERYBODY))) return false;
+ multiuser_get_uid(user_id, AID_EVERYBODY)))
+ return false;
#endif
if (!prepare_dir(profiles_de_path, 0771, AID_SYSTEM, AID_SYSTEM)) return false;