Skip to main content

blktrace_rs/
error.rs

1use std::io;
2
3/// Errors returned by this crate.
4#[derive(Debug, thiserror::Error)]
5pub enum BlktraceError {
6    /// The kernel has no debugfs support, which blktrace requires.
7    #[error("debugfs (/sys/kernel/debug) is not supported by the current kernel")]
8    DebugfsUnsupported,
9    /// Mounting debugfs failed.
10    #[error("failed to mount debugfs")]
11    MountDebugfs(#[source] nix::Error),
12    /// The `BLKTRACESETUP` ioctl failed.
13    #[error("BLKTRACESETUP failed")]
14    Setup(#[source] nix::Error),
15    /// The `BLKTRACESTART` ioctl failed.
16    #[error("BLKTRACESTART failed")]
17    Start(#[source] nix::Error),
18    /// The `BLKTRACESTOP` ioctl failed.
19    #[error("BLKTRACESTOP failed")]
20    Stop(#[source] nix::Error),
21    /// The `BLKTRACETEARDOWN` ioctl failed.
22    #[error("BLKTRACETEARDOWN failed")]
23    Teardown(#[source] nix::Error),
24    /// The `BLKFLSBUF` ioctl failed.
25    #[error("BLKFLSBUF failed")]
26    FlushBuffers(#[source] nix::Error),
27    /// A trace record's magic number did not match the kernel UAPI value.
28    #[error("blktrace event magic number mismatch")]
29    MagicMismatch,
30    /// The block name the kernel returned is not valid UTF-8.
31    #[error("invalid block name returned by the kernel")]
32    InvalidBlockName,
33    /// Reading the dropped-event counter failed.
34    #[error("failed to read the dropped events count")]
35    ReadDropped(#[source] io::Error),
36    /// The dropped-event counter is not a number.
37    #[error("failed to parse the dropped events count")]
38    ParseDropped,
39    /// A reader or collector thread died unexpectedly.
40    #[error("a tracing thread panicked")]
41    ThreadPanicked,
42    /// An I/O error.
43    #[error(transparent)]
44    Io(#[from] io::Error),
45}