remount: Remove unused option -C/--clean_scratch_files

The option was added for debugging purposes in case the "test argv[0] ==
clean_scratch_files" method breaks.
Now it has no user at all and no reason to maintain it, so just remove it.

Also don't use MyLogger() when running as clean_scratch_files, as
clean_scratch_files don't have stdout/stderr.

Bug: 241179247
Test: Presubmit
Change-Id: I2d8069f59fe6b85fc84ab07bb2df6efb39d6ecaa
This commit is contained in:
Yi-Yo Chiang 2022-08-17 01:09:41 +08:00 committed by Yi-yo Chiang
parent 4f351c3cf5
commit 0465273180

View file

@ -475,17 +475,16 @@ static int do_remount(Fstab& fstab, const std::vector<std::string>& partition_ar
return retval;
}
static int do_clean_scratch_files() {
android::fs_mgr::CleanupOldScratchFiles();
return 0;
}
int main(int argc, char* argv[]) {
android::base::InitLogging(argv, MyLogger);
// Do not use MyLogger() when running as clean_scratch_files, as stdout/stderr of daemon process
// are discarded.
if (argc > 0 && android::base::Basename(argv[0]) == "clean_scratch_files"s) {
return do_clean_scratch_files();
android::fs_mgr::CleanupOldScratchFiles();
return 0;
}
android::base::InitLogging(argv, MyLogger);
// Make sure we are root.
if (::getuid() != 0) {
LOG(ERROR) << "Not running as root. Try \"adb root\" first.";
@ -509,7 +508,6 @@ int main(int argc, char* argv[]) {
{"help", no_argument, nullptr, 'h'},
{"reboot", no_argument, nullptr, 'R'},
{"verbose", no_argument, nullptr, 'v'},
{"clean_scratch_files", no_argument, nullptr, 'C'},
{0, 0, nullptr, 0},
};
for (int opt; (opt = ::getopt_long(argc, argv, "hRT:v", longopts, nullptr)) != -1;) {
@ -530,8 +528,6 @@ int main(int argc, char* argv[]) {
case 'v':
verbose = true;
break;
case 'C':
return do_clean_scratch_files();
default:
LOG(ERROR) << "Bad Argument -" << char(opt);
usage(BADARG);