uhyve_interface/v2/parameters.rs
1//! Parameters for [Hypercalls](crate::v2::Hypercall).
2
3use crate::GuestPhysAddr;
4/// Re-export of all unchanged parameters and flags from v1.
5pub use crate::parameters::*;
6pub use crate::v1::parameters::{CloseParams, OpenParams, UnlinkParams};
7
8/// Parameters for a [`FileWrite`](crate::v2::Hypercall::FileWrite) hypercall.
9#[repr(C)]
10#[derive(Debug, Copy, Clone)]
11pub struct WriteParams {
12 /// Number of bytes in the buffer to be written.
13 pub len: u64,
14 /// Number of bytes written on success or errno.
15 pub ret: i64,
16 /// Buffer to be written into the file.
17 pub buf: GuestPhysAddr,
18 /// File descriptor of the file.
19 pub fd: i32,
20}
21
22/// Parameters for a [`FileRead`](crate::v2::Hypercall::FileRead) hypercall.
23#[repr(C)]
24#[derive(Debug, Copy, Clone)]
25pub struct ReadParams {
26 /// Number of bytes to read into the buffer.
27 pub len: u64,
28 /// Number of bytes read on success or errno.
29 pub ret: i64,
30 /// Buffer to read the file into.
31 pub buf: GuestPhysAddr,
32 /// File descriptor of the file.
33 pub fd: i32,
34}
35
36/// Parameters for a [`FileLseek`](crate::v2::Hypercall::FileLseek) hypercall
37#[repr(C)]
38#[derive(Debug, Copy, Clone)]
39pub struct LseekParams {
40 /// Offset in the file.
41 pub offset: i64,
42 /// `whence` value of the lseek call.
43 pub whence: u32,
44 /// File descriptor of the file.
45 pub fd: i32,
46}
47
48/// Parameters for a [`SerialWriteBuffer`](crate::v1::Hypercall::SerialWriteBuffer) hypercall.
49#[repr(C)]
50#[derive(Debug, Copy, Clone)]
51pub struct SerialWriteBufferParams {
52 /// Length of the buffer.
53 pub len: u64,
54 /// Address of the buffer to be printed.
55 pub buf: GuestPhysAddr,
56}
57
58/// Parameters for a [`SerialReadBuffer`](crate::v2::Hypercall::SerialReadBuffer) hypercall.
59#[repr(C)]
60#[derive(Debug, Copy, Clone)]
61pub struct SerialReadBufferParams {
62 /// length of `buf`.
63 pub maxlen: u64,
64 /// Amount of bytes acutally written.
65 pub len: u64,
66 /// Address to write to.
67 pub buf: GuestPhysAddr,
68}