@@ -83,27 +83,20 @@ pub const fn scratch_top_ptr<T>(offset: u64) -> *mut T {
8383
8484/// Compute the byte offset from the scratch base to the G2H ring.
8585///
86- /// TODO(virtq): Remove input/output
87- pub const fn g2h_ring_scratch_offset ( input_data_size : usize , output_data_size : usize ) -> usize {
88- let io_off = input_data_size + output_data_size;
89- let align = crate :: virtq:: Descriptor :: ALIGN ;
90-
91- ( io_off + align - 1 ) & !( align - 1 )
86+ /// The G2H ring starts at offset 0, aligned to descriptor alignment.
87+ pub const fn g2h_ring_scratch_offset ( ) -> usize {
88+ 0
9289}
9390
9491/// Compute the byte offset from the scratch base to the H2G ring.
9592///
96- /// TODO(ring): Remove input/output
97- pub const fn h2g_ring_scratch_offset (
98- input_data_size : usize ,
99- output_data_size : usize ,
100- g2h_num_descs : usize ,
101- ) -> usize {
102- let g2h_offset = g2h_ring_scratch_offset ( input_data_size, output_data_size) ;
93+ /// The H2G ring follows immediately after the G2H ring, aligned to
94+ /// descriptor alignment.
95+ pub const fn h2g_ring_scratch_offset ( g2h_num_descs : usize ) -> usize {
10396 let g2h_size = crate :: virtq:: Layout :: query_size ( g2h_num_descs) ;
10497 let align = crate :: virtq:: Descriptor :: ALIGN ;
10598
106- ( g2h_offset + g2h_size + align - 1 ) & !( align - 1 )
99+ ( g2h_size + align - 1 ) & !( align - 1 )
107100}
108101
109102/// Compute the minimum scratch region size needed for a sandbox.
0 commit comments