Skip to content

Move generated code to directories with _gen suffix #676

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cpuid/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ authors = ["Amazon firecracker team <[email protected]>"]

[dependencies]
kvm = { path = "../kvm" }
kvm_sys = { path = "../kvm_sys" }
kvm_gen = { path = "../kvm_gen" }
logger = { path = "../logger" }
2 changes: 1 addition & 1 deletion cpuid/src/c3_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use cpu_leaf::*;
use kvm_sys::kvm_cpuid_entry2;
use kvm_gen::kvm_cpuid_entry2;

/// Sets up the cpuid entries for a given VCPU following a C3 template.
pub fn set_cpuid_entries(entries: &mut [kvm_cpuid_entry2]) {
Expand Down
4 changes: 2 additions & 2 deletions cpuid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//! Utility for configuring the CPUID (CPU identification) for the guest microVM.

extern crate kvm;
extern crate kvm_sys;
extern crate kvm_gen;
#[macro_use]
extern crate logger;

Expand Down Expand Up @@ -278,7 +278,7 @@ fn get_brand_string() -> BrandString {
mod tests {
use super::*;
use kvm::{Kvm, MAX_KVM_CPUID_ENTRIES};
use kvm_sys::kvm_cpuid_entry2;
use kvm_gen::kvm_cpuid_entry2;

#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
#[test]
Expand Down
2 changes: 1 addition & 1 deletion cpuid/src/t2_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use cpu_leaf::*;
use kvm_sys::kvm_cpuid_entry2;
use kvm_gen::kvm_cpuid_entry2;

/// Sets up the cpuid entries for a given VCPU following a T2 template.
pub fn set_cpuid_entries(entries: &mut [kvm_cpuid_entry2]) {
Expand Down
8 changes: 4 additions & 4 deletions devices/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ dumbo = { path = "../dumbo" }
logger = { path = "../logger" }
memory_model = { path = "../memory_model" }
net_util = { path = "../net_util" }
net_sys = { path = "../net_sys" }
net_gen = { path = "../net_gen" }
rate_limiter = { path = "../rate_limiter" }
sys_util = { path = "../sys_util" }
virtio_sys = { path = "../virtio_sys" }
vhost_sys = { path = "../vhost_sys" , optional = true}
virtio_gen = { path = "../virtio_gen" }
vhost_gen = { path = "../vhost_gen" , optional = true}
vhost_backend = { path = "../vhost_backend", optional = true}

[dev-dependencies]
tempfile = ">=3.0.2"

[features]
vsock = ["vhost_sys", "vhost_backend"]
vsock = ["vhost_gen", "vhost_backend"]
6 changes: 3 additions & 3 deletions devices/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ extern crate dumbo;
#[macro_use]
extern crate logger;
extern crate memory_model;
extern crate net_sys;
extern crate net_gen;
extern crate net_util;
extern crate rate_limiter;
extern crate sys_util;
#[cfg(feature = "vsock")]
extern crate vhost_backend;
#[cfg(feature = "vsock")]
extern crate vhost_sys;
extern crate virtio_sys;
extern crate vhost_gen;
extern crate virtio_gen;

use std::fs::File;

Expand Down
4 changes: 2 additions & 2 deletions devices/src/virtio/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ use memory_model::{GuestAddress, GuestMemory, GuestMemoryError};
use rate_limiter::{RateLimiter, TokenType};
use sys_util::EventFd;
use sys_util::Result as SysResult;
use virtio_sys::virtio_blk::*;
use virtio_sys::virtio_config::*;
use virtio_gen::virtio_blk::*;
use virtio_gen::virtio_config::*;
use {DeviceEventT, EpollHandler};

const CONFIG_SPACE_SIZE: usize = 8;
Expand Down
8 changes: 4 additions & 4 deletions devices/src/virtio/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ use super::{
use dumbo::ns::MmdsNetworkStack;
use logger::{Metric, METRICS};
use memory_model::{GuestAddress, GuestMemory};
use net_sys;
use net_gen;
use net_util::{MacAddr, Tap, TapError, MAC_ADDR_LEN};
use rate_limiter::{RateLimiter, TokenType};
use sys_util::EventFd;
use virtio_sys::virtio_config::*;
use virtio_sys::virtio_net::*;
use virtio_gen::virtio_config::*;
use virtio_gen::virtio_net::*;
use {DeviceEventT, EpollHandler};

/// The maximum buffer size when segmentation offload is enabled. This
Expand Down Expand Up @@ -626,7 +626,7 @@ impl Net {
) -> Result<Self> {
// Set offload flags to match the virtio features below.
tap.set_offload(
net_sys::TUN_F_CSUM | net_sys::TUN_F_UFO | net_sys::TUN_F_TSO4 | net_sys::TUN_F_TSO6,
net_gen::TUN_F_CSUM | net_gen::TUN_F_UFO | net_gen::TUN_F_TSO4 | net_gen::TUN_F_TSO6,
).map_err(Error::TapSetOffload)?;

let vnet_hdr_size = vnet_hdr_len() as i32;
Expand Down
6 changes: 3 additions & 3 deletions devices/src/virtio/vhost/vsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use memory_model::GuestMemory;
use sys_util::EventFd;
use vhost_backend::Vhost;
use vhost_backend::Vsock as VhostVsockFd;
use vhost_sys::vhost::*;
use virtio_sys::virtio_config::*;
use virtio_sys::virtio_ring::*;
use vhost_gen::vhost::*;
use virtio_gen::virtio_config::*;
use virtio_gen::virtio_ring::*;

use byteorder::{ByteOrder, LittleEndian};
use epoll;
Expand Down
2 changes: 1 addition & 1 deletion kvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["The Chromium OS Authors"]
[dependencies]
libc = ">=0.2.39"

kvm_sys = { path = "../kvm_sys" }
kvm_gen = { path = "../kvm_gen" }
memory_model = { path = "../memory_model" }
sys_util = { path = "../sys_util" }

Expand Down
2 changes: 1 addition & 1 deletion kvm/src/cap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.

use kvm_sys::*;
use kvm_gen::*;

/// A capability the kernel's KVM interface can possibly expose.
#[derive(Clone, Copy, Debug)]
Expand Down
6 changes: 3 additions & 3 deletions kvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

extern crate libc;

extern crate kvm_sys;
extern crate kvm_gen;
extern crate memory_model;
extern crate sys_util;

Expand All @@ -23,15 +23,15 @@ use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};

use libc::{open, EINVAL, ENOSPC, O_RDWR};

use kvm_sys::*;
use kvm_gen::*;
use memory_model::MemoryMapping;
use sys_util::{errno_result, Error, EventFd, Result};
use sys_util::{
ioctl, ioctl_with_mut_ptr, ioctl_with_mut_ref, ioctl_with_ptr, ioctl_with_ref, ioctl_with_val,
};

pub use cap::*;
pub use kvm_sys::KVM_API_VERSION;
pub use kvm_gen::KVM_API_VERSION;

/// Taken from Linux Kernel v4.14.13 (arch/x86/include/asm/kvm_host.h)
pub const MAX_KVM_CPUID_ENTRIES: usize = 80;
Expand Down
2 changes: 1 addition & 1 deletion kvm_sys/Cargo.toml → kvm_gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "kvm_sys"
name = "kvm_gen"
version = "0.1.0"
authors = ["The Chromium OS Authors"]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
From 4e4496bedf962830fd72f4d5f6a8153755b996fb Mon Sep 17 00:00:00 2001
From: Andreea Florescu <[email protected]>
Date: Tue, 6 Feb 2018 16:01:48 +0200
Subject: [PATCH 1/3] kvm_sys: fix alignment for x86 kvm structs
Subject: [PATCH 1/3] kvm_gen: fix alignment for x86 kvm structs

Add alignment for kvm_irq_routing, kvm_msrs and
kvm_coalesced_mmio_ring.

Signed-off-by: Andreea Florescu <[email protected]>
---
kvm_sys/src/x86/bindings.rs | 3 +++
kvm_gen/src/x86/bindings.rs | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kvm_sys/src/x86/bindings.rs b/kvm_sys/src/x86/bindings.rs
diff --git a/kvm_gen/src/x86/bindings.rs b/kvm_gen/src/x86/bindings.rs
index 40c970c..9b8542c 100644
--- a/kvm_sys/src/x86/bindings.rs
+++ b/kvm_sys/src/x86/bindings.rs
--- a/kvm_gen/src/x86/bindings.rs
+++ b/kvm_gen/src/x86/bindings.rs
@@ -1273,6 +1273,7 @@ pub struct kvm_msrs {
pub nmsrs: __u32,
pub pad: __u32,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
From d796576ad266a1c590b848e73a8392c753804b24 Mon Sep 17 00:00:00 2001
From: Constantin Musca <[email protected]>
Date: Fri, 12 Jan 2018 18:07:02 +0200
Subject: [PATCH 2/3] kvm_sys: implement Debug trait for kvm_lapic_state
Subject: [PATCH 2/3] kvm_gen: implement Debug trait for kvm_lapic_state

This is needed for calling unwrap_err() on Result<kvm_lapic_state, Error>.

Signed-off-by: Constantin Musca <[email protected]>
---
kvm_sys/src/x86/bindings.rs | 7 +++++++
kvm_gen/src/x86/bindings.rs | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/kvm_sys/src/x86/bindings.rs b/kvm_sys/src/x86/bindings.rs
diff --git a/kvm_gen/src/x86/bindings.rs b/kvm_gen/src/x86/bindings.rs
index 9b8542c..2100db4 100644
--- a/kvm_sys/src/x86/bindings.rs
+++ b/kvm_sys/src/x86/bindings.rs
--- a/kvm_gen/src/x86/bindings.rs
+++ b/kvm_gen/src/x86/bindings.rs
@@ -1116,6 +1116,13 @@ fn bindgen_test_layout_kvm_regs() {
pub struct kvm_lapic_state {
pub regs: [::std::os::raw::c_char; 1024usize],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
From de3b980f47a403f3172517e83950d37a35b6de17 Mon Sep 17 00:00:00 2001
From: Andreea Florescu <[email protected]>
Date: Wed, 7 Feb 2018 12:05:51 +0200
Subject: [PATCH 3/3] kvm_sys: implement PartialEq for kvm_msr_entry
Subject: [PATCH 3/3] kvm_gen: implement PartialEq for kvm_msr_entry

Signed-off-by: Andreea Florescu <[email protected]>
---
kvm_sys/src/x86/bindings.rs | 2 +-
kvm_gen/src/x86/bindings.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kvm_sys/src/x86/bindings.rs b/kvm_sys/src/x86/bindings.rs
diff --git a/kvm_gen/src/x86/bindings.rs b/kvm_gen/src/x86/bindings.rs
index 2100db4..11413ce 100644
--- a/kvm_sys/src/x86/bindings.rs
+++ b/kvm_sys/src/x86/bindings.rs
--- a/kvm_gen/src/x86/bindings.rs
+++ b/kvm_gen/src/x86/bindings.rs
@@ -1255,7 +1255,7 @@ fn bindgen_test_layout_kvm_fpu() {
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
From cee0f2ec507f3e5f51db58f49640fdf6a89ce987 Mon Sep 17 00:00:00 2001
From: Diana Popa <[email protected]>
Date: Tue, 30 Oct 2018 10:32:59 -0500
Subject: [PATCH] kvm_sys: implement PartialEq for register...
Subject: [PATCH] kvm_gen: implement PartialEq for register...

related structures.

Signed-off-by: Diana Popa <[email protected]>
---
kvm_sys/src/x86/bindings.rs | 10 +++++-----
kvm_gen/src/x86/bindings.rs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kvm_sys/src/x86/bindings.rs b/kvm_sys/src/x86/bindings.rs
diff --git a/kvm_gen/src/x86/bindings.rs b/kvm_gen/src/x86/bindings.rs
index 4efc89d..94e07f6 100644
--- a/kvm_sys/src/x86/bindings.rs
+++ b/kvm_sys/src/x86/bindings.rs
--- a/kvm_gen/src/x86/bindings.rs
+++ b/kvm_gen/src/x86/bindings.rs
@@ -1077,7 +1077,7 @@ impl Default for kvm_ioapic_state {
}
}
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions kvm_sys/tests/sanity.rs → kvm_gen/tests/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.

extern crate kvm_sys;
extern crate kvm_gen;
extern crate libc;
extern crate sys_util;

use kvm_sys::*;
use kvm_gen::*;
use libc::{c_char, open, O_RDWR};
use std::fs::File;
use std::os::unix::io::FromRawFd;
Expand Down
2 changes: 1 addition & 1 deletion net_sys/Cargo.toml → net_gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "net_sys"
name = "net_gen"
version = "0.1.0"
authors = ["The Chromium OS Authors"]

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading