fn process(&mut self, event: Events, ops: &mut EventOps) {
        let source = event.fd();
        let event_set = event.event_set();

        // TODO: also check for errors. Pending high level discussions on how we want
        // to handle errors in devices.
        let supported_events = EventSet::IN;
        if !supported_events.contains(event_set) {
            warn!(
                "Block: Received unknown event: {:?} from source: {:?}",
                event_set, source
            );
            return;
        }

        if self.is_activated() {
            let queue_evt = self.queue_evts[0].as_raw_fd();
            let rate_limiter_evt = self.rate_limiter.as_raw_fd();
            let activate_fd = self.activate_evt.as_raw_fd();

            // Looks better than C style if/else if/else.
            match source {
                _ if queue_evt == source => self.process_queue_event(),
                _ if rate_limiter_evt == source => self.process_rate_limiter_event(),
                _ if activate_fd == source => self.process_activate_event(ops),
                _ => warn!("Block: Spurious event received: {:?}", source),
            }
        } else {
            warn!(
                "Block: The device is not yet activated. Spurious event received: {:?}",
                source
            );
        }
    }
// Handle an event for queue or rate limiter.
Handle an event for queue or rate limiter.
Handle an event for queue or rate limiter .
fn process(&mut self, event: Events, ops: &mut EventOps) {
        let source = event.fd();
        let event_set = event.event_set();
        // TODO: also check for errors. Pending high level discussions on how we want
        // to handle errors in devices.
        let supported_events = EventSet::IN;
        if !supported_events.contains(event_set) {
            warn!(
                "Block: Received unknown event: {:?} from source: {:?}",
                event_set, source
            );
            return;
        }
        if self.is_activated() {
            let queue_evt = self.queue_evts[0].as_raw_fd();
            let rate_limiter_evt = self.rate_limiter.as_raw_fd();
            let activate_fd = self.activate_evt.as_raw_fd();
            // Looks better than C style if/else if/else.
            match source {
                _ if queue_evt == source => self.process_queue_event(),
                _ if rate_limiter_evt == source => self.process_rate_limiter_event(),
                _ if activate_fd == source => self.process_activate_event(ops),
                _ => warn!("Block: Spurious event received: {:?}", source),
            }
        } else {
            warn!(
                "Block: The device is not yet activated. Spurious event received: {:?}",
                source
            );
        }
    }
fn process ( & mut self , event : Events , ops : & mut EventOps ) { let source = event . fd ( ) ; let event_set = event . event_set ( ) ; // TODO: also check for errors. Pending high level discussions on how we want // to handle errors in devices. let supported_events = EventSet :: IN ; if ! supported_events . contains ( event_set ) { warn ! ( " " event_set source ) ; return ; } if self . is_activated ( ) { let queue_evt = self . queue_evts [ 0 ] . as_raw_fd ( ) ; let rate_limiter_evt = self . rate_limiter . as_raw_fd ( ) ; let activate_fd = self . activate_evt . as_raw_fd ( ) ; // Looks better than C style if/else if/else. match source { _ if queue_evt == source => self . process_queue_event ( ) , _ if rate_limiter_evt == source => self . process_rate_limiter_event ( ) , _ if activate_fd == source => self . process_activate_event ( ops ) , _ => warn ! ( " " source ) , } } else { warn ! ( " " source ) ; } }
Handle an event for queue or rate limiter.
Handle an event for queue or rate limiter .
&mut self
event
Events
ops
&mut EventOps
&mut self
event
Events
ops
&mut EventOps