Skip to content

Pass flags to downstream internal_start binary only if defined in env config.#2596

Open
ser-io wants to merge 1 commit into
google:mainfrom
ser-io:unsupported-flags-create
Open

Pass flags to downstream internal_start binary only if defined in env config.#2596
ser-io wants to merge 1 commit into
google:mainfrom
ser-io:unsupported-flags-create

Conversation

@ser-io
Copy link
Copy Markdown
Member

@ser-io ser-io commented May 20, 2026

Bug: b/329890155

@ser-io ser-io requested a review from jemoreira May 20, 2026 21:03
@ser-io ser-io marked this pull request as draft May 21, 2026 14:05
@ser-io ser-io force-pushed the unsupported-flags-create branch from 9587c7d to b6ea967 Compare May 22, 2026 19:35
@ser-io ser-io changed the title Remove use of undefok flag. Pass flags to downstream internal_start binary only if defined in env config. May 22, 2026
@ser-io ser-io force-pushed the unsupported-flags-create branch from b6ea967 to 40c8f7c Compare May 22, 2026 19:37
@ser-io ser-io marked this pull request as ready for review May 22, 2026 19:39
@ser-io ser-io force-pushed the unsupported-flags-create branch from 40c8f7c to e77ff33 Compare May 22, 2026 19:40

static std::set<std::string> GatherFlagNamesUsedInConfig(
const EnvironmentSpecification& cfg) {
std::vector<std::pair<std::string, std::function<bool(const Instance&)>>>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: vector<pair<string, predicate>> sounds like it could be map<string, predicate>.

static std::set<std::string> GatherFlagNamesUsedInConfig(
const EnvironmentSpecification& cfg) {
std::vector<std::pair<std::string, std::function<bool(const Instance&)>>>
predicates{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think it would be clearer to implement this like this:

std::set<std::string> GatherFlagNamesUsedInEnvironmentConfig(const EnvironmentSpec& cfg) {
  std::set<std::string> flag_names;
  for (const auto& instance: cfg.instances()) {
    flag_names.merge(GatherFlagNamesUsedInInstanceConfig);
  }
}

std::set<std::string> GatherFlagNamesUsedInInstanceConfig(const Instance& instance) {
  std::set<std::string> flag_names;
  if (instance.has_vm()) { flag_names.insert(kFlagVmManager); }
  if (instance.vm().has_cpus()) { flag_names.insert(kFlagCpus); }
  ...
  return flag_names;
}

"crosvm_simple_media_device";
inline constexpr char kFlagCrosvmV4l2Proxy[] = "crosvm_v4l2_proxy";

static std::set<std::string> GatherFlagNamesUsedInConfig(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: static isn't needed inside the anonymous namespace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants