-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
s390x: add zVM Secure IPL support #1338
Conversation
5567618
to
2739de2
Compare
838be73
to
f9e2bf6
Compare
ca33d36
to
7fc8eeb
Compare
0238bbc
to
38d3ca0
Compare
7e2ed26
to
dc4b19d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor comments but LGTM as is too.
dc4b19d
to
ec2bd25
Compare
fn parse_lszdev_eckd(line: &str) -> Result<Loaddev> { | ||
// ECKD ID looks like: 0.0.5223, we need only last part of it (5223) | ||
lazy_static! { | ||
static ref REGEX: Regex = Regex::new(r#"[[:digit:]].[[:digit:]].([[:xdigit:]]+)"#).unwrap(); | ||
} | ||
if let Some(cap) = REGEX.captures_iter(line).next() { | ||
return Ok(Loaddev::Eckd(cap[1].to_string())); | ||
} | ||
bail!("bad ECKD id: {}", line); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is obviously totally fine, but just noting I think it's a one-liner to parse this without regexps:
line.split('.').nth(2).ok_or_else(|| anyhow!("Bad EKCD")).map(|s| Loaddev::Eckd(s.to_string()))
or so. (Though validation is looser)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, the reason to use regex here was to validate format of ID, which probably not that necessary.
Implements proposal from: coreos/enhancements#10