cros_async and by extension serde_keyvalue are needed on ChromeOS, so
add the `# provided by ebuild` comments where appropriate to make it
possible to uprev cros_async (which requires pulling in serde_keyvalue).
BUG=b:250883877
TEST=kokoro passes
Change-Id: I423cac0c4e5e30afac058b914358caca7d27edbf
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3953082
Auto-Submit: Allen Webb <allenwebb@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Use the nom crate for parsing. This will arguably be both simpler to
read and more reliable than our current ad-hoc parser.
Add a few extra tests to enforce the new rules that the new parser is
supposed to enforce.
BUG=b:218223240
TEST=cargo test -p serde_keyvalues -p crosvm
TEST=ARCVM starts successfully.
Change-Id: I4ea188ffe8aee872071c900793c50127855403ec
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3822428
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Alexandre Courbot <acourbot@chromium.org>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This adds support for parsing hex `m=0x1234abcd` octal `0o755` and
binary `m=0o1100` values according the their prefix. Negative numbers
can also be specified by adding a `-` after the prefix.
Note that negative values like `m=-0x1234` don't work, largely as an
artifact of the way the Num trait works. This could probably be fixed,
but given hex, octal, and binary numbers tend to be used in unsigned
situations most of the time this shouldn't be an issue.
The main motivation for this is the debugcon serial device, which
accepts an argument which is an x86 IO port. These are much more
naturally described in hex.
BUG=b:233610263
Change-Id: Ic68bacd772de6aebfaad0de7b8aa6faf5d4c1555
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3671595
Commit-Queue: Mike Gerow <gerow@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Add a crate for deserializing command-line options given as key-values.
This crate leverages serde to deserialize key-value argument strings (a
commonly used pattern in crosvm) into configuration structures. This
will allow us to remove a big part of the manual parsing currently done
in `main.rs`, will provide consistent arguments to the `crosvm run` and
`crosvm device` commands, and results in more precise error reporting.
The use of serde will also allow us to similarly deserialize
configuration structures from configuration files with very little extra
code involved.
As explained in the crate's documentation, its main entry point is a
`from_key_values` function that allows a build a struct implementing
serde's `Deserialize` trait from a key/values string.
In order to integrate transparently with `argh`, there is also a
`FromKeyValue` derive macro that automatically implements `FromArgValue`
for structs deriving from it.
BUG=b:218223240
BUG=b:217480043
TEST=cargo build
TEST=cargo test -p serde_keyvalue
Change-Id: Id6316e40150d5f08a05e6f04e39ecbc73d72dfa0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3439669
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>