Skip to content
This repository was archived by the owner on Oct 24, 2022. It is now read-only.

Commit eb393cf

Browse files
committed
Simple syntax only change to keep some order
Some idea tools advises to keep all methods in the same order as trait definition when implementation the trait for structure. Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
1 parent a6c815d commit eb393cf

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

src/handler.rs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -262,18 +262,6 @@ where
262262
Ok(())
263263
}
264264

265-
fn get_protocol_features(&mut self) -> VhostUserResult<VhostUserProtocolFeatures> {
266-
Ok(self.backend.protocol_features())
267-
}
268-
269-
fn set_protocol_features(&mut self, features: u64) -> VhostUserResult<()> {
270-
// Note: slave that reported VHOST_USER_F_PROTOCOL_FEATURES must
271-
// support this message even before VHOST_USER_SET_FEATURES was
272-
// called.
273-
self.acked_protocol_features = features;
274-
Ok(())
275-
}
276-
277265
fn set_mem_table(
278266
&mut self,
279267
ctx: &[VhostUserMemoryRegion],
@@ -315,10 +303,6 @@ where
315303
Ok(())
316304
}
317305

318-
fn get_queue_num(&mut self) -> VhostUserResult<u64> {
319-
Ok(self.num_queues as u64)
320-
}
321-
322306
fn set_vring_num(&mut self, index: u32, num: u32) -> VhostUserResult<()> {
323307
if index as usize >= self.num_queues || num == 0 || num as usize > self.max_queue_size {
324308
return Err(VhostUserError::InvalidParam);
@@ -448,6 +432,22 @@ where
448432
Ok(())
449433
}
450434

435+
fn get_protocol_features(&mut self) -> VhostUserResult<VhostUserProtocolFeatures> {
436+
Ok(self.backend.protocol_features())
437+
}
438+
439+
fn set_protocol_features(&mut self, features: u64) -> VhostUserResult<()> {
440+
// Note: slave that reported VHOST_USER_F_PROTOCOL_FEATURES must
441+
// support this message even before VHOST_USER_SET_FEATURES was
442+
// called.
443+
self.acked_protocol_features = features;
444+
Ok(())
445+
}
446+
447+
fn get_queue_num(&mut self) -> VhostUserResult<u64> {
448+
Ok(self.num_queues as u64)
449+
}
450+
451451
fn set_vring_enable(&mut self, index: u32, enable: bool) -> VhostUserResult<()> {
452452
// This request should be handled only when VHOST_USER_F_PROTOCOL_FEATURES
453453
// has been negotiated.
@@ -494,6 +494,24 @@ where
494494
self.backend.set_slave_req_fd(vu_req);
495495
}
496496

497+
fn get_inflight_fd(
498+
&mut self,
499+
_inflight: &vhost::vhost_user::message::VhostUserInflight,
500+
) -> VhostUserResult<(vhost::vhost_user::message::VhostUserInflight, File)> {
501+
// Assume the backend hasn't negotiated the inflight feature; it
502+
// wouldn't be correct for the backend to do so, as we don't (yet)
503+
// provide a way for it to handle such requests.
504+
Err(VhostUserError::InvalidOperation)
505+
}
506+
507+
fn set_inflight_fd(
508+
&mut self,
509+
_inflight: &vhost::vhost_user::message::VhostUserInflight,
510+
_file: File,
511+
) -> VhostUserResult<()> {
512+
Err(VhostUserError::InvalidOperation)
513+
}
514+
497515
fn get_max_mem_slots(&mut self) -> VhostUserResult<u64> {
498516
Ok(MAX_MEM_SLOTS)
499517
}
@@ -561,24 +579,6 @@ where
561579

562580
Ok(())
563581
}
564-
565-
fn get_inflight_fd(
566-
&mut self,
567-
_inflight: &vhost::vhost_user::message::VhostUserInflight,
568-
) -> VhostUserResult<(vhost::vhost_user::message::VhostUserInflight, File)> {
569-
// Assume the backend hasn't negotiated the inflight feature; it
570-
// wouldn't be correct for the backend to do so, as we don't (yet)
571-
// provide a way for it to handle such requests.
572-
Err(VhostUserError::InvalidOperation)
573-
}
574-
575-
fn set_inflight_fd(
576-
&mut self,
577-
_inflight: &vhost::vhost_user::message::VhostUserInflight,
578-
_file: File,
579-
) -> VhostUserResult<()> {
580-
Err(VhostUserError::InvalidOperation)
581-
}
582582
}
583583

584584
impl<S, V, B> Drop for VhostUserHandler<S, V, B>

0 commit comments

Comments
 (0)