Skip to content

Commit 9e9ce49

Browse files
committed
initial code
Signed-off-by: Martin Kröning <[email protected]>
1 parent aa8d919 commit 9e9ce49

19 files changed

+3972
-28
lines changed

.github/workflows/ci.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
merge_group:
7+
8+
env:
9+
RUSTFLAGS: -Dwarnings
10+
RUSTDOCFLAGS: -Dwarnings
11+
12+
jobs:
13+
check:
14+
name: Check
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@stable
19+
- uses: taiki-e/install-action@cargo-hack
20+
- run: cargo hack check --feature-powerset --exclude-features nightly --no-dev-deps
21+
22+
clippy:
23+
name: Clippy
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
- uses: dtolnay/rust-toolchain@stable
28+
- run: cargo clippy --features alloc,mmio,pci,zerocopy
29+
30+
doc:
31+
name: Doc
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: dtolnay/rust-toolchain@stable
36+
- run: cargo doc --features alloc,mmio,pci,zerocopy
37+
38+
fmt:
39+
name: Format
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
- uses: dtolnay/rust-toolchain@nightly
44+
with:
45+
components: rustfmt
46+
- run: cargo fmt --all --check
47+
48+
test:
49+
name: Test
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: dtolnay/rust-toolchain@stable
54+
- run: cargo test --features alloc,mmio,pci,zerocopy

Cargo.lock

+155-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+29-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
[package]
22
name = "virtio-spec"
3-
version = "0.0.0"
3+
version = "0.1.0"
4+
authors = ["Martin Kröning <[email protected]>"]
45
edition = "2021"
5-
description = "Reserved."
6+
description = "Definitions from the Virtual I/O Device (VIRTIO) specification."
7+
repository = "https://github.com/rust-osdev/virtio-spec-rs"
68
license = "MIT OR Apache-2.0"
9+
keywords = ["virtio", "specification", "driver", "net", "pci"]
10+
categories = ["external-ffi-bindings", "no-std::no-alloc"]
11+
12+
[package.metadata.docs.rs]
13+
all-features = true
14+
rustdoc-args = ["--cfg", "docsrs"]
15+
16+
[dependencies]
17+
allocator-api2 = { version = "0.2", default-features = false, features = ["alloc"], optional = true }
18+
bitfield-struct = "0.8"
19+
bitflags = "2"
20+
endian-num = { version = "0.1", features = ["bitflags", "linux-types"] }
21+
num_enum = { version = "0.7", default-features = false }
22+
pci_types = { version = "0.10", optional = true }
23+
volatile = "0.6"
24+
volatile-macro = "0.6"
25+
zerocopy = { version = "0.7", optional = true, default-features = false }
26+
zerocopy-derive = { version = "0.7", optional = true }
27+
28+
[features]
29+
alloc = ["dep:allocator-api2"]
30+
mmio = []
31+
nightly = ["allocator-api2/nightly"]
32+
pci = ["dep:pci_types"]
33+
zerocopy = ["dep:zerocopy", "dep:zerocopy-derive", "endian-num/zerocopy"]

LICENSE-APACHE

-25
Original file line numberDiff line numberDiff line change
@@ -174,28 +174,3 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
174174
of your accepting any such warranty or additional liability.
175175

176176
END OF TERMS AND CONDITIONS
177-
178-
APPENDIX: How to apply the Apache License to your work.
179-
180-
To apply the Apache License to your work, attach the following
181-
boilerplate notice, with the fields enclosed by brackets "[]"
182-
replaced with your own identifying information. (Don't include
183-
the brackets!) The text should be enclosed in the appropriate
184-
comment syntax for the file format. We also recommend that a
185-
file or class name and description of purpose be included on the
186-
same "printed page" as the copyright notice for easier
187-
identification within third-party archives.
188-
189-
Copyright [yyyy] [name of copyright owner]
190-
191-
Licensed under the Apache License, Version 2.0 (the "License");
192-
you may not use this file except in compliance with the License.
193-
You may obtain a copy of the License at
194-
195-
http://www.apache.org/licenses/LICENSE-2.0
196-
197-
Unless required by applicable law or agreed to in writing, software
198-
distributed under the License is distributed on an "AS IS" BASIS,
199-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200-
See the License for the specific language governing permissions and
201-
limitations under the License.

README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# virtio-spec-rs
2+
3+
[![Crates.io](https://img.shields.io/crates/v/virtio-spec)](https://crates.io/crates/virtio-spec)
4+
[![docs.rs](https://img.shields.io/docsrs/virtio-spec)](https://docs.rs/virtio-spec)
5+
[![CI](https://github.com/rust-osdev/virtio-spec-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/rust-osdev/virtio-spec-rs/actions/workflows/ci.yml)
6+
7+
This crate contains the Rust equivalents of the definitions from the [Virtual I/O Device (VIRTIO) Specification](https://github.com/oasis-tcs/virtio-spec).
8+
This crate aims to be unopinionated regarding actual VIRTIO drivers that are implemented on top of this crate.
9+
10+
For API documentation, see the [docs].
11+
12+
[docs]: https://docs.rs/virtio-spec
13+
14+
## License
15+
16+
Licensed under either of
17+
18+
* Apache License, Version 2.0
19+
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
20+
* MIT license
21+
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
22+
23+
at your option.
24+
25+
### Contribution
26+
27+
Unless you explicitly state otherwise, any contribution intentionally submitted
28+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
29+
dual licensed as above, without any additional terms or conditions.

rustfmt.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
format_code_in_doc_comments = true
2+
group_imports = "StdExternalCrate"
3+
imports_granularity = "Module"

0 commit comments

Comments
 (0)