Commit Graph

14 Commits

Author SHA1 Message Date
Stefano Garzarella
9191a0c1de chore: remove pub visibility from exit event fields
The `exit_consumer` and `exit_notifier` fields are only used internally
by the exit_event() method implementation or by send_exit_event() in the
sound device. So, they do not need to be exposed in the public API of
backend structures.

Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2025-11-19 12:09:37 +02:00
dependabot[bot]
9040bcb726 build(deps): bump the rust-vmm group across 2 directories with 6 updates
Bumps the rust-vmm group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [vhost](https://github.com/rust-vmm/vhost) | `0.14.0` | `0.15.0` |
| [vhost-user-backend](https://github.com/rust-vmm/vhost) | `0.20.0` | `0.21.0` |
| [virtio-queue](https://github.com/rust-vmm/vm-virtio) | `0.16.0` | `0.17.0` |
| [vm-memory](https://github.com/rust-vmm/vm-memory) | `0.16.2` | `0.17.1` |
| [vmm-sys-util](https://github.com/rust-vmm/vmm-sys-util) | `0.14.0` | `0.15.0` |
| [virtio-vsock](https://github.com/rust-vmm/vm-virtio) | `0.10.0` | `0.11.0` |

Bumps the rust-vmm group with 5 updates in the /staging directory:

| Package | From | To |
| --- | --- | --- |
| [vhost](https://github.com/rust-vmm/vhost) | `0.14.0` | `0.15.0` |
| [vhost-user-backend](https://github.com/rust-vmm/vhost) | `0.20.0` | `0.21.0` |
| [virtio-queue](https://github.com/rust-vmm/vm-virtio) | `0.16.0` | `0.17.0` |
| [vm-memory](https://github.com/rust-vmm/vm-memory) | `0.16.2` | `0.17.1` |
| [vmm-sys-util](https://github.com/rust-vmm/vmm-sys-util) | `0.14.0` | `0.15.0` |

Updates `vhost` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-v0.14.0...vhost-v0.15.0)

Updates `vhost-user-backend` from 0.20.0 to 0.21.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-user-backend-v0.20.0...vhost-user-backend-v0.21.0)

Updates `virtio-queue` from 0.16.0 to 0.17.0
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.16.0...virtio-queue-v0.17.0)

Updates `vm-memory` from 0.16.2 to 0.17.1
- [Release notes](https://github.com/rust-vmm/vm-memory/releases)
- [Changelog](https://github.com/rust-vmm/vm-memory/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vm-memory/compare/v0.16.2...v0.17.1)

Updates `vmm-sys-util` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases)
- [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.14.0...v0.15.0)

Updates `virtio-vsock` from 0.10.0 to 0.11.0
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-vsock-v0.10.0...virtio-vsock-v0.11.0)

Updates `vhost` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-v0.14.0...vhost-v0.15.0)

Updates `vhost-user-backend` from 0.20.0 to 0.21.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-user-backend-v0.20.0...vhost-user-backend-v0.21.0)

Updates `virtio-queue` from 0.16.0 to 0.17.0
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.16.0...virtio-queue-v0.17.0)

Updates `vm-memory` from 0.16.2 to 0.17.1
- [Release notes](https://github.com/rust-vmm/vm-memory/releases)
- [Changelog](https://github.com/rust-vmm/vm-memory/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vm-memory/compare/v0.16.2...v0.17.1)

Updates `vmm-sys-util` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases)
- [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.14.0...v0.15.0)

Updates `vhost` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-v0.14.0...vhost-v0.15.0)

Updates `vhost-user-backend` from 0.20.0 to 0.21.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-user-backend-v0.20.0...vhost-user-backend-v0.21.0)

Updates `virtio-queue` from 0.16.0 to 0.17.0
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.16.0...virtio-queue-v0.17.0)

Updates `vm-memory` from 0.16.2 to 0.17.1
- [Release notes](https://github.com/rust-vmm/vm-memory/releases)
- [Changelog](https://github.com/rust-vmm/vm-memory/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vm-memory/compare/v0.16.2...v0.17.1)

Updates `vmm-sys-util` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases)
- [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.14.0...v0.15.0)

Updates `vhost` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-v0.14.0...vhost-v0.15.0)

Updates `vhost-user-backend` from 0.20.0 to 0.21.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](https://github.com/rust-vmm/vhost/compare/vhost-user-backend-v0.20.0...vhost-user-backend-v0.21.0)

Updates `virtio-queue` from 0.16.0 to 0.17.0
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](https://github.com/rust-vmm/vm-virtio/compare/virtio-queue-v0.16.0...virtio-queue-v0.17.0)

Updates `vm-memory` from 0.16.2 to 0.17.1
- [Release notes](https://github.com/rust-vmm/vm-memory/releases)
- [Changelog](https://github.com/rust-vmm/vm-memory/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vm-memory/compare/v0.16.2...v0.17.1)

Updates `vmm-sys-util` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases)
- [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.14.0...v0.15.0)

---
updated-dependencies:
- dependency-name: vhost
  dependency-version: 0.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vhost-user-backend
  dependency-version: 0.21.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: virtio-queue
  dependency-version: 0.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vm-memory
  dependency-version: 0.17.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vmm-sys-util
  dependency-version: 0.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: virtio-vsock
  dependency-version: 0.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vhost
  dependency-version: 0.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vhost-user-backend
  dependency-version: 0.21.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: virtio-queue
  dependency-version: 0.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vm-memory
  dependency-version: 0.17.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vmm-sys-util
  dependency-version: 0.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vhost
  dependency-version: 0.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vhost-user-backend
  dependency-version: 0.21.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: virtio-queue
  dependency-version: 0.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vm-memory
  dependency-version: 0.17.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vmm-sys-util
  dependency-version: 0.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vhost
  dependency-version: 0.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vhost-user-backend
  dependency-version: 0.21.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: virtio-queue
  dependency-version: 0.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vm-memory
  dependency-version: 0.17.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
- dependency-name: vmm-sys-util
  dependency-version: 0.15.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: rust-vmm
...

Signed-off-by: dependabot[bot] <support@github.com>
SG: adapted code to the new changes in vhost-user-backend and vm-memory:
  - used EventConsumer & EventNotifier instead of EventFd for exit_event
  - removed vm_memory::Error::InvalidGuestRegion
  - included vm_memory::Bytes needed for read_volatile_from
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
2025-11-19 11:28:08 +02:00
Alyssa Ross
c5ce9db691 Fix cargo doc
Signed-off-by: Alyssa Ross <hi@alyssa.is>
2025-09-18 16:08:18 +03:00
Manos Pitsidianakis
019e02b0f2 Replace ptr casts with typed cast() method
Replace type inferred raw pointer casts with .cast() method calls to
make intent clearer.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2025-08-04 12:30:43 +02:00
Manos Pitsidianakis
d88b12b9e0 gpio: run clippy --fix
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2025-07-18 10:05:07 +02:00
Manos Pitsidianakis
cead472596 gpio: run rustfmt
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2025-07-18 10:05:07 +02:00
Wenyu Huang
91a625603f chore: bump virtio-queue and some related dependencies
virtio-queue v0.15 introduces a new Descriptor API supporting both
split and packed virtqueue.
Update our dependencies and code to work with the new version
of the crate, including updating vhost-user-backend and virtio-vsock.

Updates `vhost-user-backend` from 0.18.0 to 0.19.0
- [Release notes](https://github.com/rust-vmm/vhost/releases)
- [Commits](rust-vmm/vhost@vhost-user-backend-v0.18.0...vhost-user-backend-v0.19.0)

Updates `virtio-queue` from 0.14.0 to 0.15.0
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](rust-vmm/vm-virtio@virtio-queue-v0.14.0...virtio-queue-v0.15.0)

Updates `virtio-vsock` from 0.8.0 to 0.9.0
- [Release notes](https://github.com/rust-vmm/vm-virtio/releases)
- [Commits](rust-vmm/vm-virtio@virtio-vsock-v0.8.0...virtio-vsock-v0.9.0)

Signed-off-by: Wenyu Huang <huangwenyuu@outlook.com>
2025-06-23 21:36:11 +02:00
Ruoqing He
d43fd79bb7 clippy: Fix clippy::precedence
Fix `clippy::precedence` warnings reported by clippy 0.1.85 (4d91de4e48
2025-02-17).

```console
error: operator precedence can trip the unwary
   --> vhost-device-template/src/vhu_foo.rs:152:9
    |
152 | /         1 << VIRTIO_F_VERSION_1
153 | |             | 1 << VIRTIO_F_NOTIFY_ON_EMPTY
154 | |             | 1 << VIRTIO_RING_F_INDIRECT_DESC
155 | |             | 1 << VIRTIO_RING_F_EVENT_IDX
    | |__________________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#precedence
    = note: `-D clippy::precedence` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::precedence)]`
help: consider parenthesizing your expression
    |
152 ~         1 << VIRTIO_F_VERSION_1
153 +             | 1 << VIRTIO_F_NOTIFY_ON_EMPTY
154 +             | 1 << VIRTIO_RING_F_INDIRECT_DESC | (1 << VIRTIO_RING_F_EVENT_IDX)
    |
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2025-03-31 13:45:27 +02:00
Luigi Leonardi
7f74da7e58 gpio: Use PathBuf for socket paths instead of Strings
Field `socket_path` now use PathBuf. This allows for better filesystem
compatibility.

Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
2025-03-04 09:04:18 +02:00
Manos Pitsidianakis
f293c4e8f0 Fix clippy::empty_line_after_doc_comments
Fix new warn by default clippy lint, empty_line_after_doc_comments,
by removing empty lines after doc comments.

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2024-12-16 14:00:08 +05:30
Erik Schilling
2143bcb44c tree-wide: continue unwinds on join failures
The error from joining a thread is a bit confusing. It is only printed
if the other thread panicked. This means, effectively, we only get here
if something called .unwrap(), .expect() or panicked in a different way.
In these cases an (ugly) error was already printend. Printing a pretty
message about the join failure does not really help a lot...

So let's just continue the unwind as suggested by the docs on the join
`Result` [1].

Before:

    thread '<unnamed>' panicked at 'Test panic', crates/gpio/src/backend.rs:146:13
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', crates/gpio/src/backend.rs:176:23

After:

    thread '<unnamed>' panicked at 'Test panic', crates/gpio/src/backend.rs:146:13
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

[1]: https://doc.rust-lang.org/std/thread/type.Result.html

Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
2023-11-20 13:05:48 +05:30
Erik Schilling
25c6ac3362 tree-wide: use new serve convenience function
This become available with the recent vhost-user-backend [1] updates and
allows to get rid of some boilerplate code.

[1] https://github.com/rust-vmm/vhost/pull/173

Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
2023-11-20 13:05:48 +05:30
Erik Schilling
31154ea0da Update vhost-user-backend to 0.11 series
- Features were renamed from slave -> backend
- Generics got simplified
- Some write and read functions on Volatile slice got turned into
  standalone traits: ReadVolatile, WriteVolatile
- handle_event no longer returns a bool

Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
2023-11-14 10:48:19 +02:00
Manos Pitsidianakis
a1e013286f Move all crates to workspace root
Having all the workspace crates under the crates/ directory is
unnecessary. Rust documentation itself recommends all crates to be in
the root directory:

https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html#creating-the-second-package-in-the-workspace

I paste the text content here, in case the online page ever changes or
becomes unavailable:

    ## Creating the Second Package in the Workspace

    Next, let’s create another member package in the workspace and call it add_one. Change the top-level Cargo.toml to specify the add_one path in the members list:

    Filename: Cargo.toml

    [workspace]

    members = [
        "adder",
        "add_one",
    ]

    Then generate a new library crate named add_one:

    $ cargo new add_one --lib
         Created library `add_one` package

    Your add directory should now have these directories and files:

    ├── Cargo.lock
    ├── Cargo.toml
    ├── add_one
    │   ├── Cargo.toml
    │   └── src
    │       └── lib.rs
    ├── adder
    │   ├── Cargo.toml
    │   └── src
    │       └── main.rs
    └── target

Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
2023-10-16 12:03:57 +05:30