Skip to content

Commit 97054fc

Browse files
committed
Explicitly allow NotFeasible base state
1 parent 83bb13a commit 97054fc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/sys/dtx.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,15 @@ impl TryFrom<u16> for LatchStatus {
163163
pub enum BaseState {
164164
Detached,
165165
Attached,
166+
NotFeasible,
166167
}
167168

168169
impl BaseState {
169170
pub fn as_str(&self) -> &'static str {
170171
match self {
171-
BaseState::Detached => "Detached",
172-
BaseState::Attached => "Attached",
172+
BaseState::Detached => "Detached",
173+
BaseState::Attached => "Attached",
174+
BaseState::NotFeasible => "NotFeasible",
173175
}
174176
}
175177
}
@@ -184,6 +186,10 @@ impl TryFrom<u16> for BaseState {
184186
type Error = DtxError;
185187

186188
fn try_from(value: u16) -> DtxResult<Self> {
189+
if value == uapi::SDTX_DETACH_NOT_FEASIBLE {
190+
return Ok(BaseState::NotFeasible);
191+
}
192+
187193
match translate_status_code(value)? {
188194
uapi::SDTX_BASE_DETACHED => Ok(BaseState::Detached),
189195
uapi::SDTX_BASE_ATTACHED => Ok(BaseState::Attached),

0 commit comments

Comments
 (0)