use std::io;
#[derive(Debug, thiserror::Error)]
pub enum BlktraceError {
#[error("debugfs (/sys/kernel/debug) is not supported by the current kernel")]
DebugfsUnsupported,
#[error("failed to mount debugfs")]
MountDebugfs(#[source] nix::Error),
#[error("BLKTRACESETUP failed")]
Setup(#[source] nix::Error),
#[error("BLKTRACESTART failed")]
Start(#[source] nix::Error),
#[error("BLKTRACESTOP failed")]
Stop(#[source] nix::Error),
#[error("BLKTRACETEARDOWN failed")]
Teardown(#[source] nix::Error),
#[error("BLKFLSBUF failed")]
FlushBuffers(#[source] nix::Error),
#[error("blktrace event magic number mismatch")]
MagicMismatch,
#[error("invalid block name returned by the kernel")]
InvalidBlockName,
#[error("failed to read the dropped events count")]
ReadDropped(#[source] io::Error),
#[error("failed to parse the dropped events count")]
ParseDropped,
#[error("a tracing thread panicked")]
ThreadPanicked,
#[error(transparent)]
Io(#[from] io::Error),
}