Commit graph

24 commits

Author SHA1 Message Date
Christian Blichmann
9dc9210d3d crosvm_control: Also create a static lib
This is useful for projects that build in lock-step with crosvm and want
to control a VM without having to `dlopen()` or embed
`libcrosvm_control.so`.

TEST=./tools/presubmit --quick
BUG=none

Change-Id: I9407c3e1783f55e399358bdf291a999ee8dc8892
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3864925
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Christian Blichmann <cblichmann@google.com>
Tested-by: Christian Blichmann <cblichmann@google.com>
2022-09-01 07:33:29 +00:00
Daniel Verkamp
8930ba079f crosvm: update book and doc links to crosvm.dev
Replaced using this script:

git grep -l 'https://google.github.io/crosvm' \
 | xargs -n1 sed -i \
 -e 's^https://google.github.io/crosvm/doc/^https://crosvm.dev/doc/^g' \
 -e 's^https://google.github.io/crosvm/^https://crosvm.dev/book/^g'

BUG=None
TEST=mdbook build doc/book

Change-Id: I8df4e0bcc1ca1e9044df29998572393c934e29cc
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3795005
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-29 22:54:01 +00:00
Dennis Kempin
4fea399df9 Reformat imports
crosvm is switching the import style to use one import per line.
While more verbose, this will greatly reduce the occurence of merge
conflicts going forward.

Note: This is using a nightly feature of rustfmt. So it's a one-off
re-format only. We are considering adding a nightly toolchain to
enable the feature permanently.

BUG=b:239937122
TEST=CQ

Change-Id: Id2dd4dbdc0adfc4f8f3dd1d09da1daafa2a39992
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3784345
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-07-28 00:15:50 +00:00
Daniel Verkamp
0a5f9fc411 crosvm_control: linkify max_usb_devices reference
Make the function reference in the docs into a link so it's easier to
follow in the generated HTML docs.

BUG=None
TEST=tools/cargo-doc

Change-Id: I1dbf2f02deb547422c2d8c3a17b892fc96b6f448
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3764042
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: Daniel Verkamp <dverkamp@chromium.org>
2022-07-22 19:50:43 +00:00
Kameron Lutes
93b6042f33 crosvm_control: Expose USB_CONTROL_MAX_PORTS
Exposes the maximum number of USB ports that can be retrieved through a
call to crosvm_client_usb_list.

BUG=b:188858559
TEST=cq

Change-Id: I87c788f755763afaab021eb4126dadbcc3ac4090
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3757173
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-07-13 03:01:24 +00:00
Kameron Lutes
517bfb7acf crosvm_control: Add link to library docs
Adds a link to the crosvm_control docs in the library source.

BUG=b:236909264
TEST=cq

Change-Id: I144e4a3823d20cea2c1087b71c2efa86e7029de3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3729256
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-06-29 04:13:01 +00:00
Kameron Lutes
ffad493f61 crosvm_control: Add shared and unevictable memory to BalloonStats
Adds the shared_memory and unevicatble_memory fields to BalloonStatsFfi
struct and also returns them from crosvm_client_balloon_stats.

BUG=b:188858559
TEST=cq

Change-Id: I9ff52b77cd19e16a860596f24ff45407a2acdd1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3713864
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-06-23 03:10:51 +00:00
Kameron Lutes
6e0ac7de54 crosvm_control: Add cbindgen configuration options
Adds necessary configuration to cbindgen to correctly format the
generated crosvm_control.h header.

BUG=b:188858559
TEST=cq

Change-Id: I7abab7a5f9d260451540c5938719ec51cad56457
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3713865
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
2022-06-21 23:25:39 +00:00
Daniel Verkamp
1dbe52fac4 vm_control: clarify that USB attach only uses dev_path
The bus/address and vendor/product IDs are unused internally; only the
usbdevfs device path matters. Update the internal API parameters and
documentation to match.

The crosvm_control `crosvm_client_usb_attach()` function must keep the
extra parameters to maintain API compatibility, but its documentation is
updated to note that they are unused.

BUG=None
TEST=Attach USB device to Crostini on trogdor

Change-Id: I7086f61a420be1dbf3dd1877fa86a5e82c0c5c77
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3708640
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-06-17 23:18:24 +00:00
Kameron Lutes
299c1121c3 crosvm_control: Add make_rt API
Adds a make_rt API to the crosvm_control library.

BUG=b:188858559
TEST=cq

Change-Id: I3affcd6cb003a17f125b45e78906fabe1e371c43
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3635255
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
2022-05-10 01:29:17 +00:00
Daniel Verkamp
45b0920767 doc: add a top-level comment to all crates
This provides at least a minimal one-line description to show what each
crate is about.

BUG=None
TEST=tools/cargo-doc

Change-Id: I26732e8c29062e622d5be09bdc120a49d564b9fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3630422
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
2022-05-06 20:46:57 +00:00
Keiichi Watanabe
94e753c41e crosvm_control: Skip build.rs when cargo-doc is called
This will fix GitHub Action's failure.
This couldn't be caught in kokoro because kokoro sets correct
environment variables for testing.

BUG=none
TEST=./tools/cargo-doc

Change-Id: I1db2e459422e755f6231cb0a6e5e082ffa0727ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3581449
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-04-21 00:17:25 +00:00
Keiichi Watanabe
b24aa4cb84 crosvm_control: Use anyhow in build.rs
This provides clearer error message.

BUG=none
TEST=cargo check

Change-Id: I954be94b2961383f2c23da104e695321e49e497e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3581448
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-04-20 23:53:07 +00:00
Anton Romanov
c79d5f838c crosvm: crosvm_control: use OUT_DIR instead of CARGO_TARGET_DIR in build script
CARGO_TARGET_DIR is not meant to be used in build scripts as that is an
optional variable that *may* be passed to cargo. The one that is set by
cargo itself is OUT_DIR and is always present to specify where build
scripts are expected to place output

BUG=none
TEST=cq

Change-Id: I118eebf914dbefd93f2cafb6950c7a6b4c01c574
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3598239
Auto-Submit: Anton Romanov <romanton@google.com>
Reviewed-by: Kameron Lutes <kalutes@chromium.org>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-04-20 23:05:48 +00:00
Keiichi Watanabe
25d7911e8d crosvm_control: Minor style fix
BUG=none
TEST=cargo chekc

Change-Id: I24fa7eced9053eee535778153390f4039044e47f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3581447
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-04-20 19:33:30 +00:00
Kameron Lutes
1904e141b7 Reland "crosvm_control: Generate C header during build"
This is a reland of commit 06fca32aff

Original change's description:
> crosvm_control: Generate C header during build
>
> Generates a C header for the crosvm_control library during crosvm build.
>
> BUG=b:188858559
> TEST=cq
>
> Cq-Depend: chromium:3553666
> Change-Id: Ic6d57d654f546a4ddf9facad16d29a03c103ebbe
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553761
> Reviewed-by: Dennis Kempin <denniskempin@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Kameron Lutes <kalutes@chromium.org>

Bug: b:188858559
Change-Id: I041cf6452ecec2d3ef9581b07ee0c457ba81cf98
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3593855
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-04-20 18:29:20 +00:00
Junichi Uekawa
835bfc3cfa Revert "crosvm_control: Generate C header during build"
This reverts commit 06fca32aff.

Reason for revert: cros side dependency is not there yet

Original change's description:
> crosvm_control: Generate C header during build
>
> Generates a C header for the crosvm_control library during crosvm build.
>
> BUG=b:188858559
> TEST=cq
>
> Cq-Depend: chromium:3553666
> Change-Id: Ic6d57d654f546a4ddf9facad16d29a03c103ebbe
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553761
> Reviewed-by: Dennis Kempin <denniskempin@google.com>
> Tested-by: kokoro <noreply+kokoro@google.com>
> Commit-Queue: Kameron Lutes <kalutes@chromium.org>

Bug: b:188858559
Change-Id: I34a2d970415f95f559678520901340c1d8e6297a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3581450
Auto-Submit: Junichi Uekawa <uekawa@chromium.org>
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2022-04-14 12:48:22 +00:00
Kameron Lutes
06fca32aff crosvm_control: Generate C header during build
Generates a C header for the crosvm_control library during crosvm build.

BUG=b:188858559
TEST=cq

Cq-Depend: chromium:3553666
Change-Id: Ic6d57d654f546a4ddf9facad16d29a03c103ebbe
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3553761
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2022-04-13 23:37:32 +00:00
Daniel Verkamp
f35f636cc5 Rust 1.60 clippy fixes
BUG=None
TEST=tools/presubmit # with rust-toolchain updated to 1.60.0

Change-Id: I5772e8b0593f8d92003e93aeb2145e87610abe2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3577332
Reviewed-by: Anton Romanov <romanton@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2022-04-11 20:40:36 +00:00
Dennis Kempin
ef516189db Refactoring: Move common/base into base
Executes the script in https://crrev.com/c/3530502

BUG=b:223206469
TEST=presubmit

Change-Id: Ibeffdc8de0b2270f070e60bb2de8d9fdc78a2a6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3530503
Reviewed-by: Vikram Auradkar <auradkar@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2022-03-17 00:01:27 +00:00
Anton Romanov
bed40ad547 crosvm: migrate to Rust 2021 edition
BUG=none
TEST=cq

Change-Id: I0059c970879b78bfd40b6ce58b10debcf154b50f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3508322
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Anton Romanov <romanton@google.com>
2022-03-09 01:16:03 +00:00
Vikram Auradkar
ae5118f5c7 Enable windows tests for a few crates
Run tests for sys_util_core, poll_token_derive and balloon_control on
windows.

Using dotfiles to disable/serialize test runs of a subset of crates does
not work well with third party crates as it forces us to commit the dot
file to the crate.

The patch modifies and uses the script that runs linux tests.
This patch also allows us to
- build/test child crate even if parent crate has disabled build/test.
- avoid building crosvm if it is not explicitly specified.

RIP short lived .windows_build_test_skip. You allowed us to run noop
kokoro tests.

Test: py .\tools\impl\test_runner.py --arch x86_64
Bug: b:215610772
Change-Id: Icc6d04ffd7c0c33d4f60aeac16fc7d23881c387d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3459809
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-02-18 03:18:58 +00:00
Vikram Auradkar
0108238474 Upstream windows build/test script
The patch also adds files to skip building and testing crates on
windows. When we run
```
tools/windows/build_test.py --skip_file_name .windows_build_test_skip
```

the build/test succeeds without actually doing anything as build/test
for all crates is skipped by creating '.windows_build_test_skip'.

Bug: 213170957
Test: Ran script on downstream repo
Change-Id: Iebd2cea463ee722be4feaed88229e1fb5e9fd6c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3417918
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Vikram Auradkar <auradkar@google.com>
2022-01-28 00:55:08 +00:00
ameron Lutes
cde1b5416f crosvm: Rename libcrosvm_control to crosvm_control
The current inclusion of the 'lib' prefix is redundant and results
in 'liblibcrosvm_control' once built.

These changes remove the 'lib' prefix from the source files.

BUG=b:188858559
TEST=cros_run_unit_tests --board ${board} --packages chromeos-base/crosvm

Change-Id: Ic1bcdce9aa5d879f5867232ffec60f40fe57d3a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3321731
Reviewed-by: Hikaru Nishida <hikalium@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Christian Blichmann <cblichmann@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
2021-12-14 18:38:42 +00:00