-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove init example, add hello_world
- Loading branch information
Showing
3 changed files
with
27 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use std::error::Error; | ||
use std::{env, process}; | ||
|
||
pub fn main() -> Result<(), Box<dyn Error>> { | ||
let mut args = env::args(); | ||
args.next(); | ||
|
||
let pci_addr = match args.next() { | ||
Some(arg) => arg, | ||
None => { | ||
eprintln!("Usage: cargo run --example hello_world <pci bus id>"); | ||
process::exit(1); | ||
} | ||
}; | ||
|
||
let mut nvme = vroom::init(&pci_addr)?; | ||
nvme.write_copied("hello world".as_bytes(), 0)?; | ||
|
||
let mut dest = [0u8; 12]; | ||
nvme.read_copied(&mut dest, 0)?; | ||
|
||
println!("{}", std::str::from_utf8(&dest)?); | ||
|
||
Ok(()) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters