Commit graph

16 commits

Author SHA1 Message Date
maciek swiech
fac9000051 balloon: use protos for registered events
since the RegisteredEvent model is effectively an external API, switch
to using protobuf as a more formal/stable means of communicating
messages. also introduces exporting the registered_events.proto file as
part of crosvm_control build, alongside the currently existing header
file.

this patch also introduces feature-gating for registered_events and
protos so as not to bring in too many third party dependencies for a
base build.

BUG=b/278117550
TEST=run bzImage locally
TEST=sidecar program available at https://x20.corp.google.com/users/dr/drmasquatch/socket-pinger-proto

Change-Id: I5d91d87f7807effc125352caf5c75eee2593f70d
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4521604
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: maciek swiech <drmasquatch@google.com>
2023-05-22 19:28:45 +00:00
Shintaro Kawamura
ca6adae33c crosvm_control: add swap status/trim command support
SwapStatus, SwapState, SwapStateTransition, SwapMetrics are directly
contained into crosvm_control.h

SwapState is translated as C++ enum.

SwapStateTransition::time_ms is now u64 because u128 does not support
repr(C).

Changed usize in the structs to u64 because usize is translated as
uintptr_t.

BUG=b:265386761
TEST=cargo build -p crosvm_control

Change-Id: Ia9df56d40c1884067a712620e0fc797e07af77a2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4486549
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: David Stevens <stevensd@chromium.org>
Commit-Queue: Shin Kawamura <kawasin@google.com>
Reviewed-by: Dennis Kempin <denniskempin@google.com>
2023-05-08 01:37:43 +00:00
Daniel Verkamp
668b0bad59 crosvm_control: remove unnecessary references
Fixes clippy warnings in Rust 1.68

BUG=b:276487055
TEST=tools/clippy # with rust 1.68

Change-Id: I2a88639edb058a07c9944337712530b4ea7abffa
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4391104
Reviewed-by: Maciek Swiech <drmasquatch@google.com>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
2023-04-11 02:06:21 +00:00
George Burgess IV
4f2ba33100 crosvm_control: explain why we need rerun-if-changed; remove nop one
These lines were originally inserted as a workaround, but now that the
`rerun-if-env-changed` lines being emitted by this build.rs have been
found, this workaround has been promoted to a bugfix. :)

build.rs is implicitly `rerun-if-changed`, so that bit can be removed.

BUG=b:275376804
TEST=CQ

Change-Id: I480c33f52fc27252263adb297b65d913f78a3030
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4402291
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: George Burgess <gbiv@chromium.org>
2023-04-05 14:16:00 +00:00
George Burgess IV
c8b89e9fee crosvm_control: add rerun-if-changed blocks
These are a workaround for b/275376804.

BUG=b:275376804
TEST=Built with these. Changes to src/lib.rs cause build.rs to run.

Change-Id: I89d1f340fd53a90d9ed327517c52c85f86565426
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4385870
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: George Burgess <gbiv@chromium.org>
2023-03-30 23:58:30 +00:00
Kameron Lutes
6c6966ecfc crosvm_control: Add Build Time C Compilation Check
Adds a build time compilation check for the generated crosvm_control.h

BUG=b:271789981
TEST=CQ, apply crrev/4237140 and observe build failure due to C compile
error

Change-Id: I57867894a975aa0a48f989051bb4243bf97f57e8
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4333206
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Commit-Queue: Kameron Lutes <kalutes@chromium.org>
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
2023-03-16 00:01:44 +00:00
Dennis Kempin
1dab58a2cf Update all copyright headers to match new style
This search/replace updates all copyright notices to drop the
"All rights reserved", Use "ChromiumOS" instead of "Chromium OS"
and drops the trailing dots.

This fulfills the request from legal and unifies our notices.

./tools/health-check has been updated to only accept this style.

BUG=b:246579983
TEST=./tools/health-check

Change-Id: I87a80701dc651f1baf4820e5cc42469d7c5f5bf7
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3894243
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
2022-09-13 18:41:29 +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
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
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