1
0
Fork 0

Merging upstream version 1.14.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-16 11:31:10 +01:00
parent 868b5312e8
commit d6fd2fdea9
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
305 changed files with 20664 additions and 6099 deletions

View file

@ -97,7 +97,6 @@ static inline __u8 nvme_cmd_specific_status_to_errno(__u16 status)
case NVME_SC_NS_ALREADY_ATTACHED:
return EALREADY;
case NVME_SC_THIN_PROV_NOT_SUPP:
case NVME_SC_ONCS_NOT_SUPPORTED:
return EOPNOTSUPP;
case NVME_SC_DEVICE_SELF_TEST_IN_PROGRESS:
return EINPROGRESS;
@ -127,6 +126,22 @@ static inline __u8 nvme_fabrics_status_to_errno(__u16 status)
return EIO;
}
static inline __u8 nvme_path_status_to_errno(__u16 status)
{
switch (status) {
case NVME_SC_INTERNAL_PATH_ERROR:
case NVME_SC_ANA_PERSISTENT_LOSS:
case NVME_SC_ANA_INACCESSIBLE:
case NVME_SC_ANA_TRANSITION:
case NVME_SC_CTRL_PATHING_ERROR:
case NVME_SC_HOST_PATHING_ERROR:
case NVME_SC_HOST_CMD_ABORT:
return EACCES;
}
return EIO;
}
/*
* nvme_status_to_errno - It converts given status to errno mapped
* @status: >= 0 for nvme status field in completion queue entry,
@ -142,8 +157,11 @@ __u8 nvme_status_to_errno(int status, bool fabrics)
if (!status)
return 0;
if (status < 0)
return ECOMM;
if (status < 0) {
if (errno)
return errno;
return status;
}
/*
* The actual status code is enough with masking 0xff, but we need to
@ -152,12 +170,17 @@ __u8 nvme_status_to_errno(int status, bool fabrics)
status &= 0x7ff;
sct = nvme_status_type(status);
if (sct == NVME_SCT_GENERIC)
switch (sct) {
case NVME_SCT_GENERIC:
return nvme_generic_status_to_errno(status);
else if (sct == NVME_SCT_CMD_SPECIFIC && !fabrics)
return nvme_cmd_specific_status_to_errno(status);
else if (sct == NVME_SCT_CMD_SPECIFIC && fabrics)
case NVME_SCT_CMD_SPECIFIC:
if (!fabrics) {
return nvme_cmd_specific_status_to_errno(status);
}
return nvme_fabrics_status_to_errno(status);
case NVME_SCT_PATH:
return nvme_path_status_to_errno(status);
}
/*
* Media, integrity related status, and the others will be mapped to