Skip to main content

async_fuser/
poll_events.rs

1use std::fmt::Display;
2use std::fmt::Formatter;
3
4use bitflags::bitflags;
5
6bitflags! {
7    /// Poll events for use with fuse poll operations.
8    ///
9    /// These correspond to the standard poll(2) events from libc.
10    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
11    pub struct PollEvents: u32 {
12        /// There is data to read.
13        const POLLIN = libc::POLLIN as u32;
14        /// There is some exceptional condition on the file descriptor.
15        const POLLPRI = libc::POLLPRI as u32;
16        /// Writing is now possible.
17        const POLLOUT = libc::POLLOUT as u32;
18        /// Error condition.
19        const POLLERR = libc::POLLERR as u32;
20        /// Hang up.
21        const POLLHUP = libc::POLLHUP as u32;
22        /// Invalid request: fd not open.
23        const POLLNVAL = libc::POLLNVAL as u32;
24        /// Normal data may be read.
25        const POLLRDNORM = libc::POLLRDNORM as u32;
26        /// Priority data may be read.
27        const POLLRDBAND = libc::POLLRDBAND as u32;
28        /// Normal data may be written.
29        const POLLWRNORM = libc::POLLWRNORM as u32;
30        /// Priority data may be written.
31        const POLLWRBAND = libc::POLLWRBAND as u32;
32    }
33}
34
35impl Display for PollEvents {
36    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
37        Display::fmt(&self.bits(), f)
38    }
39}