Fix the following clippy warning:
warning: accessing first element with `configs.get(0)`
--> vhost-device-vsock/src/main.rs:410:22
|
410 | let config = configs.get(0).unwrap();
| ^^^^^^^^^^^^^^ help: try: `configs.first()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first
= note: `#[warn(clippy::get_first)]` on by default
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Commit b37e7e5709 changed how
the --help-deices text output was used inadvertently by including it by
default in the help output. Restore the --help-devices argument and make
it exclusive: you cannot combine it with other arguments. This way,
socket_path does not have to be an Option<PathBuf>.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Use clap's derive attributes to print device help instead of doing it
manually with the parsed arguments.
Previous output
===============
```text
Usage: vhost-device-scmi [OPTIONS]
Options:
-s, --socket-path <SOCKET_PATH> vhost-user socket to use (required)
-d, --device <DEVICE>... Devices to expose
--help-devices Print help on available devices
-h, --help Print help
```
New output
==========
```text
vhost-user SCMI backend device
Usage: vhost-device-scmi [OPTIONS] --socket-path <SOCKET_PATH>
Options:
-s, --socket-path <SOCKET_PATH> vhost-user socket to use
-d, --device <DEVICE>... Devices to expose
-h, --help Print help
-V, --version Print version
Available devices:
- iio: industrial I/O sensor
Parameters:
- path: path to the device directory (e.g. /sys/bus/iio/devices/iio:device0)
- channel: prefix of the device type (e.g. in_accel)
- name: an optional name of the sensor, max. 15 characters
- fake: fake accelerometer
A simple 3-axes sensor providing fake pre-defined values.
Parameters:
- name: an optional name of the sensor, max. 15 characters
Device specification example:
--device iio,path=/sys/bus/iio/devices/iio:device0,channel=in_accel
```
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
clap can parse a PathBuf directly from the command line arguments, and
paths are not always UTF-8. Use PathBuf instead of a String to allow for
all valid filesystem paths.
Signed-off-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Since everyone copied the first bits of code from the I2C crate, the
same issue is present almost everywhere. The returned value isn't
checked at all by the callers. Stop returning bool unnecessarily.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
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>
- 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>
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>