Skip to content

Commit 96b6a25

Browse files
committed
feat(init): main function implementation
The most basic function which does the thing. This will need expansion in multiple dimensions, but I want to focus on getting something the team can test. Signed-off-by: Daniel Noland <[email protected]>
1 parent e4667df commit 96b6a25

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

init/src/main.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ use std::path::PathBuf;
1111

1212
use tracing::{error, info};
1313

14-
use crate::{nic::PciDriver, sysfs::{SysfsPath, SYSFS}};
14+
use crate::{
15+
nic::{BindToVfioPci, PciDriver, PciNic},
16+
sysfs::{SYSFS, SysfsPath},
17+
};
1518

1619
/// Errors which might occur during system dataplane system initialization
1720
#[derive(Debug, thiserror::Error)]
@@ -89,5 +92,13 @@ fn setup() -> Result<(), InitErr> {
8992

9093
fn main() -> Result<(), InitErr> {
9194
setup()?;
95+
// TODO: proper argument parsing
96+
// -- hack add a real command line parser
97+
let mut args = std::env::args().skip(1);
98+
// -- end hack
99+
// TODO: fix unwraps in the next PR. These can't be properly addressed before the arg parser is done.
100+
let address = hardware::pci::address::PciAddress::try_from(args.next().unwrap()).unwrap();
101+
let mut device = PciNic::new(address)?;
102+
device.bind_to_vfio_pci()?;
92103
Ok(())
93104
}

0 commit comments

Comments
 (0)