Skip to content

Commit e6755ff

Browse files
RUST: fix resize in RegDescList and XferDescList
Signed-off-by: Evgeny Leksikov <[email protected]>
1 parent 0f6b8c3 commit e6755ff

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

src/bindings/rust/src/descriptors/reg.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,14 @@ impl<'a> RegDescList<'a> {
183183
}
184184

185185
/// Resizes the list to the given size
186-
pub fn resize(&mut self, _new_size: usize) -> Result<(), NixlError> {
187-
self.sync_mgr.mutate(|_data| {
188-
// No-op for now; backend capacity will be adjusted on next sync
186+
pub fn resize(&mut self, new_size: usize) -> Result<(), NixlError> {
187+
self.sync_mgr.mutate(|data| {
188+
data.descriptors.resize(new_size, RegDescriptor {
189+
addr: 0,
190+
len: 0,
191+
dev_id: 0,
192+
metadata: Vec::new(),
193+
});
189194
});
190195
Ok(())
191196
}

src/bindings/rust/src/descriptors/xfer.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,13 @@ impl<'a> XferDescList<'a> {
161161
}
162162

163163
/// Resizes the list to the given size
164-
pub fn resize(&mut self, _new_size: usize) -> Result<(), NixlError> {
165-
self.sync_mgr.mutate(|_data| {
166-
// No-op for now; backend capacity will be adjusted on next sync
164+
pub fn resize(&mut self, new_size: usize) -> Result<(), NixlError> {
165+
self.sync_mgr.mutate(|data| {
166+
data.descriptors.resize(new_size, XferDescriptor {
167+
addr: 0,
168+
len: 0,
169+
dev_id: 0,
170+
});
167171
});
168172
Ok(())
169173
}

0 commit comments

Comments
 (0)