Skip to content

Commit 40b20a7

Browse files
authored
Merge pull request #272 from Arunpandian15/sc
util: Add status code values in order to return errno
2 parents b11dc8c + 9a820c2 commit 40b20a7

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

src/nvme/util.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static inline __u8 nvme_generic_status_to_errno(__u16 status)
3737
case NVME_SC_SGL_INVALID_OFFSET:
3838
case NVME_SC_PRP_INVALID_OFFSET:
3939
case NVME_SC_CMB_INVALID_USE:
40+
case NVME_SC_KAT_INVALID:
4041
return EINVAL;
4142
case NVME_SC_CMDID_CONFLICT:
4243
return EADDRINUSE;
@@ -53,14 +54,18 @@ static inline __u8 nvme_generic_status_to_errno(__u16 status)
5354
case NVME_SC_CMD_SEQ_ERROR:
5455
return EILSEQ;
5556
case NVME_SC_SANITIZE_IN_PROGRESS:
57+
case NVME_SC_FORMAT_IN_PROGRESS:
5658
return EINPROGRESS;
5759
case NVME_SC_NS_WRITE_PROTECTED:
5860
case NVME_SC_NS_NOT_READY:
5961
case NVME_SC_RESERVATION_CONFLICT:
62+
case NVME_SC_OP_DENIED:
63+
case NVME_SC_ADMIN_CMD_MEDIA_NOT_READY:
6064
return EACCES;
6165
case NVME_SC_LBA_RANGE:
6266
return EREMOTEIO;
6367
case NVME_SC_CAP_EXCEEDED:
68+
case NVME_SC_AWU_EXCEEDED:
6469
return ENOSPC;
6570
}
6671
return EIO;
@@ -94,10 +99,12 @@ static inline __u8 nvme_cmd_specific_status_to_errno(__u16 status)
9499
return EINVAL;
95100
case NVME_SC_ABORT_LIMIT:
96101
case NVME_SC_ASYNC_LIMIT:
102+
case NVME_SC_NS_ATTACHMENT_LIMIT_EXCEEDED:
97103
return EDQUOT;
98104
case NVME_SC_FW_NEEDS_CONV_RESET:
99105
case NVME_SC_FW_NEEDS_SUBSYS_RESET:
100106
case NVME_SC_FW_NEEDS_MAX_TIME:
107+
case NVME_SC_FW_NEEDS_RESET:
101108
return ERESTART;
102109
case NVME_SC_FEATURE_NOT_SAVEABLE:
103110
case NVME_SC_FEATURE_NOT_CHANGEABLE:
@@ -114,7 +121,12 @@ static inline __u8 nvme_cmd_specific_status_to_errno(__u16 status)
114121
case NVME_SC_NS_ALREADY_ATTACHED:
115122
return EALREADY;
116123
case NVME_SC_THIN_PROV_NOT_SUPP:
124+
case NVME_SC_PROHIBIT_CMD_EXEC_NOT_SUPPORTED:
117125
return EOPNOTSUPP;
126+
case NVME_SC_ABORT_MISSING:
127+
return EWOULDBLOCK;
128+
case NVME_SC_SELF_TEST_IN_PROGRESS:
129+
return EINPROGRESS;
118130
}
119131

120132
return EIO;

0 commit comments

Comments
 (0)