diff options
| author | Paul Crowley <paulcrowley@google.com> | 2018-09-18 13:30:21 -0700 |
|---|---|---|
| committer | Paul Crowley <paulcrowley@google.com> | 2018-09-18 15:41:22 -0700 |
| commit | 14c8c0765a2968f8605c58f27dc68dcc3b6b0807 (patch) | |
| tree | 7c7981c54cadbcb3689996815d5b89f8b4159922 /main.cpp | |
| parent | 1251ef0bcfb82ff7aef2c4472620e6565d0c4ba6 (diff) | |
clang-format many files.
Test: Format-only changes; treehugger suffices.
Change-Id: I23cde3f0bbcac13bef555d13514e922c79d5ad48
Diffstat (limited to 'main.cpp')
| -rw-r--r-- | main.cpp | 72 |
1 files changed, 35 insertions, 37 deletions
@@ -16,12 +16,12 @@ #define ATRACE_TAG ATRACE_TAG_PACKAGE_MANAGER -#include "model/Disk.h" -#include "VolumeManager.h" #include "NetlinkManager.h" #include "VoldNativeService.h" #include "VoldUtil.h" +#include "VolumeManager.h" #include "cryptfs.h" +#include "model/Disk.h" #include "sehandle.h" #include <android-base/logging.h> @@ -31,23 +31,23 @@ #include <hidl/HidlTransportSupport.h> #include <utils/Trace.h> +#include <dirent.h> +#include <errno.h> +#include <fcntl.h> +#include <fs_mgr.h> +#include <getopt.h> #include <stdio.h> #include <stdlib.h> -#include <errno.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> -#include <getopt.h> -#include <fcntl.h> -#include <dirent.h> -#include <fs_mgr.h> static int process_config(VolumeManager* vm, bool* has_adoptable, bool* has_quota, bool* has_reserved); -static void coldboot(const char *path); +static void coldboot(const char* path); static void parse_args(int argc, char** argv); -struct selabel_handle *sehandle; +struct selabel_handle* sehandle; using android::base::StringPrintf; @@ -60,14 +60,13 @@ int main(int argc, char** argv) { ATRACE_BEGIN("main"); - LOG(VERBOSE) << "Detected support for:" - << (android::vold::IsFilesystemSupported("ext4") ? " ext4" : "") - << (android::vold::IsFilesystemSupported("f2fs") ? " f2fs" : "") - << (android::vold::IsFilesystemSupported("vfat") ? " vfat" : ""); + << (android::vold::IsFilesystemSupported("ext4") ? " ext4" : "") + << (android::vold::IsFilesystemSupported("f2fs") ? " f2fs" : "") + << (android::vold::IsFilesystemSupported("vfat") ? " vfat" : ""); - VolumeManager *vm; - NetlinkManager *nm; + VolumeManager* vm; + NetlinkManager* nm; parse_args(argc, argv); @@ -148,19 +147,21 @@ int main(int argc, char** argv) { static void parse_args(int argc, char** argv) { static struct option opts[] = { - {"blkid_context", required_argument, 0, 'b' }, - {"blkid_untrusted_context", required_argument, 0, 'B' }, - {"fsck_context", required_argument, 0, 'f' }, - {"fsck_untrusted_context", required_argument, 0, 'F' }, + {"blkid_context", required_argument, 0, 'b'}, + {"blkid_untrusted_context", required_argument, 0, 'B'}, + {"fsck_context", required_argument, 0, 'f'}, + {"fsck_untrusted_context", required_argument, 0, 'F'}, }; int c; while ((c = getopt_long(argc, argv, "", opts, nullptr)) != -1) { switch (c) { + // clang-format off case 'b': android::vold::sBlkidContext = optarg; break; case 'B': android::vold::sBlkidUntrustedContext = optarg; break; case 'f': android::vold::sFsckContext = optarg; break; case 'F': android::vold::sFsckUntrustedContext = optarg; break; + // clang-format on } } @@ -170,33 +171,30 @@ static void parse_args(int argc, char** argv) { CHECK(android::vold::sFsckUntrustedContext != nullptr); } -static void do_coldboot(DIR *d, int lvl) { - struct dirent *de; +static void do_coldboot(DIR* d, int lvl) { + struct dirent* de; int dfd, fd; dfd = dirfd(d); fd = openat(dfd, "uevent", O_WRONLY | O_CLOEXEC); - if(fd >= 0) { + if (fd >= 0) { write(fd, "add\n", 4); close(fd); } - while((de = readdir(d))) { - DIR *d2; + while ((de = readdir(d))) { + DIR* d2; - if (de->d_name[0] == '.') - continue; + if (de->d_name[0] == '.') continue; - if (de->d_type != DT_DIR && lvl > 0) - continue; + if (de->d_type != DT_DIR && lvl > 0) continue; fd = openat(dfd, de->d_name, O_RDONLY | O_DIRECTORY | O_CLOEXEC); - if(fd < 0) - continue; + if (fd < 0) continue; d2 = fdopendir(fd); - if(d2 == 0) + if (d2 == 0) close(fd); else { do_coldboot(d2, lvl + 1); @@ -205,10 +203,10 @@ static void do_coldboot(DIR *d, int lvl) { } } -static void coldboot(const char *path) { +static void coldboot(const char* path) { ATRACE_NAME("coldboot"); - DIR *d = opendir(path); - if(d) { + DIR* d = opendir(path); + if (d) { do_coldboot(d, 0); closedir(d); } @@ -251,13 +249,13 @@ static int process_config(VolumeManager* vm, bool* has_adoptable, bool* has_quot flags |= android::vold::Disk::Flags::kAdoptable; *has_adoptable = true; } - if (fs_mgr_is_noemulatedsd(rec) - || android::base::GetBoolProperty("vold.debug.default_primary", false)) { + if (fs_mgr_is_noemulatedsd(rec) || + android::base::GetBoolProperty("vold.debug.default_primary", false)) { flags |= android::vold::Disk::Flags::kDefaultPrimary; } vm->addDiskSource(std::shared_ptr<VolumeManager::DiskSource>( - new VolumeManager::DiskSource(sysPattern, nickname, flags))); + new VolumeManager::DiskSource(sysPattern, nickname, flags))); } } return 0; |
