File tree Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ pub trait VhostUserBackend: Send + Sync {
144
144
/// do with events happening on custom listeners.
145
145
fn handle_event (
146
146
& self ,
147
- device_event : u16 ,
147
+ device_event : usize ,
148
148
evset : EventSet ,
149
149
vrings : & [ Self :: Vring ] ,
150
150
thread_id : usize ,
@@ -288,7 +288,7 @@ pub trait VhostUserBackendMut: Send + Sync {
288
288
/// do with events happening on custom listeners.
289
289
fn handle_event (
290
290
& mut self ,
291
- device_event : u16 ,
291
+ device_event : usize ,
292
292
evset : EventSet ,
293
293
vrings : & [ Self :: Vring ] ,
294
294
thread_id : usize ,
@@ -390,7 +390,7 @@ impl<T: VhostUserBackend> VhostUserBackend for Arc<T> {
390
390
391
391
fn handle_event (
392
392
& self ,
393
- device_event : u16 ,
393
+ device_event : usize ,
394
394
evset : EventSet ,
395
395
vrings : & [ Self :: Vring ] ,
396
396
thread_id : usize ,
@@ -479,7 +479,7 @@ impl<T: VhostUserBackendMut> VhostUserBackend for Mutex<T> {
479
479
480
480
fn handle_event (
481
481
& self ,
482
- device_event : u16 ,
482
+ device_event : usize ,
483
483
evset : EventSet ,
484
484
vrings : & [ Self :: Vring ] ,
485
485
thread_id : usize ,
@@ -571,7 +571,7 @@ impl<T: VhostUserBackendMut> VhostUserBackend for RwLock<T> {
571
571
572
572
fn handle_event (
573
573
& self ,
574
- device_event : u16 ,
574
+ device_event : usize ,
575
575
evset : EventSet ,
576
576
vrings : & [ Self :: Vring ] ,
577
577
thread_id : usize ,
@@ -711,7 +711,7 @@ pub mod tests {
711
711
712
712
fn handle_event (
713
713
& mut self ,
714
- _device_event : u16 ,
714
+ _device_event : usize ,
715
715
_evset : EventSet ,
716
716
_vrings : & [ VringRwLock ] ,
717
717
_thread_id : usize ,
Original file line number Diff line number Diff line change @@ -184,10 +184,10 @@ where
184
184
}
185
185
} ;
186
186
187
- let ev_type = event. data ( ) as u16 ;
187
+ let ev_type = event. data ( ) ;
188
188
189
189
// handle_event() returns true if an event is received from the exit event fd.
190
- if self . handle_event ( ev_type, evset) ? {
190
+ if self . handle_event ( ev_type as usize , evset) ? {
191
191
break ' epoll;
192
192
}
193
193
}
@@ -196,13 +196,13 @@ where
196
196
Ok ( ( ) )
197
197
}
198
198
199
- fn handle_event ( & self , device_event : u16 , evset : EventSet ) -> VringEpollResult < bool > {
200
- if self . exit_event_fd . is_some ( ) && device_event as usize == self . backend . num_queues ( ) {
199
+ fn handle_event ( & self , device_event : usize , evset : EventSet ) -> VringEpollResult < bool > {
200
+ if self . exit_event_fd . is_some ( ) && device_event == self . backend . num_queues ( ) {
201
201
return Ok ( true ) ;
202
202
}
203
203
204
- if ( device_event as usize ) < self . vrings . len ( ) {
205
- let vring = & self . vrings [ device_event as usize ] ;
204
+ if device_event < self . vrings . len ( ) {
205
+ let vring = & self . vrings [ device_event] ;
206
206
let enabled = vring
207
207
. read_kick ( )
208
208
. map_err ( VringEpollError :: HandleEventReadKick ) ?;
Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ impl VhostUserBackendMut for MockVhostBackend {
117
117
118
118
fn handle_event (
119
119
& mut self ,
120
- _device_event : u16 ,
120
+ _device_event : usize ,
121
121
_evset : EventSet ,
122
122
_vrings : & [ VringRwLock ] ,
123
123
_thread_id : usize ,
You can’t perform that action at this time.
0 commit comments