summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2019-11-01 19:18:54 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-11-01 19:18:54 +0000
commit30073834e65f2be271f2475b49679cc1f6b1220f (patch)
tree05030a91f83a2cc1e514c7d60f764012811573ac
parent7ffc4e61b6ab738db85bf65ce7e550e330b15544 (diff)
parent7a1845106a55df3bff99968d55854e814a68fe53 (diff)
downloadcuttlefish_common-30073834e65f2be271f2475b49679cc1f6b1220f.tar.gz
Merge "Consolidate flag default values."
-rw-r--r--host/commands/assemble_cvd/flags.cc36
1 files changed, 5 insertions, 31 deletions
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index 87170e63..54eefcc0 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -76,15 +76,13 @@ DEFINE_string(vendor_boot_image, "",
"be vendor_boot.img in the directory specified by -system_image_dir.");
DEFINE_int32(memory_mb, 2048,
"Total amount of memory available for guest, MB.");
-std::string g_default_mempath{vsoc::GetDefaultMempath()};
-DEFINE_string(mempath, g_default_mempath.c_str(),
+DEFINE_string(mempath, vsoc::GetDefaultMempath(),
"Target location for the shmem file.");
-DEFINE_string(mobile_interface, "", // default handled on ParseCommandLine
+DEFINE_string(mobile_interface, GetPerInstanceDefault("cvd-mbr-"),
"Network interface to use for mobile networking");
-DEFINE_string(mobile_tap_name, "", // default handled on ParseCommandLine
+DEFINE_string(mobile_tap_name, GetPerInstanceDefault("cvd-mtap-"),
"The name of the tap interface to use for mobile");
-std::string g_default_serial_number{GetPerInstanceDefault("CUTTLEFISHCVD")};
-DEFINE_string(serial_number, g_default_serial_number.c_str(),
+DEFINE_string(serial_number, GetPerInstanceDefault("CUTTLEFISHCVD"),
"Serial number to use for the device");
DEFINE_string(instance_dir, "", // default handled on ParseCommandLine
"A directory to put all instance specific files");
@@ -155,7 +153,7 @@ DEFINE_string(adb_connector_binary,
"Location of the adb_connector binary. Only relevant if "
"-run_adb_connector is true");
DEFINE_int32(vhci_port, GetPerInstanceDefault(0), "VHCI port to use for usb");
-DEFINE_string(wifi_tap_name, "", // default handled on ParseCommandLine
+DEFINE_string(wifi_tap_name, GetPerInstanceDefault("cvd-wtap-"),
"The name of the tap interface to use for wifi");
DEFINE_int32(vsock_guest_cid,
vsoc::GetDefaultPerInstanceVsockCid(),
@@ -565,18 +563,6 @@ bool InitializeCuttlefishConfiguration(
}
void SetDefaultFlagsForQemu() {
- auto default_mobile_interface = GetPerInstanceDefault("cvd-mbr-");
- SetCommandLineOptionWithMode("mobile_interface",
- default_mobile_interface.c_str(),
- google::FlagSettingMode::SET_FLAGS_DEFAULT);
- auto default_mobile_tap_name = GetPerInstanceDefault("cvd-mtap-");
- SetCommandLineOptionWithMode("mobile_tap_name",
- default_mobile_tap_name.c_str(),
- google::FlagSettingMode::SET_FLAGS_DEFAULT);
- auto default_wifi_tap_name = GetPerInstanceDefault("cvd-wtap-");
- SetCommandLineOptionWithMode("wifi_tap_name",
- default_wifi_tap_name.c_str(),
- google::FlagSettingMode::SET_FLAGS_DEFAULT);
auto default_instance_dir =
cvd::StringFromEnv("HOME", ".") + "/cuttlefish_runtime";
SetCommandLineOptionWithMode("instance_dir",
@@ -589,18 +575,6 @@ void SetDefaultFlagsForQemu() {
}
void SetDefaultFlagsForCrosvm() {
- auto default_mobile_interface = GetPerInstanceDefault("cvd-mbr-");
- SetCommandLineOptionWithMode("mobile_interface",
- default_mobile_interface.c_str(),
- google::FlagSettingMode::SET_FLAGS_DEFAULT);
- auto default_mobile_tap_name = GetPerInstanceDefault("cvd-mtap-");
- SetCommandLineOptionWithMode("mobile_tap_name",
- default_mobile_tap_name.c_str(),
- google::FlagSettingMode::SET_FLAGS_DEFAULT);
- auto default_wifi_tap_name = GetPerInstanceDefault("cvd-wtap-");
- SetCommandLineOptionWithMode("wifi_tap_name",
- default_wifi_tap_name.c_str(),
- google::FlagSettingMode::SET_FLAGS_DEFAULT);
auto default_instance_dir =
cvd::StringFromEnv("HOME", ".") + "/cuttlefish_runtime";
SetCommandLineOptionWithMode("instance_dir",