All of lore.kernel.org
 help / color / mirror / Atom feed
From: minwoo.im.dev@gmail.com (Minwoo Im)
Subject: [PATCH RFC 2/4] nvme-status: Introduce nvme status module to map errno
Date: Sun, 12 May 2019 07:24:59 +0900	[thread overview]
Message-ID: <5bcca563-73c9-a588-d656-9b612aedad20@gmail.com> (raw)
In-Reply-To: <SN6PR04MB452726893B1EC5E52D347B3F860D0@SN6PR04MB4527.namprd04.prod.outlook.com>


>> +	if (sct == NVME_SCT_GENERIC) {
>> +		switch (status) {
>> +		case NVME_SC_INVALID_OPCODE:
>> +		case NVME_SC_INVALID_FIELD:
>> +		case NVME_SC_INVALID_NS:
>> +		case NVME_SC_SGL_INVALID_LAST:
>> +		case NVME_SC_SGL_INVALID_COUNT:
>> +		case NVME_SC_SGL_INVALID_DATA:
>> +		case NVME_SC_SGL_INVALID_METADATA:
>> +		case NVME_SC_SGL_INVALID_TYPE:
>> +		case NVME_SC_SGL_INVALID_OFFSET:
>> +		case NVME_SC_SGL_INVALID_SUBTYPE:
>> +			return EINVAL;
>> +		case NVME_SC_CMDID_CONFLICT:
>> +			return EADDRINUSE;
>> +		case NVME_SC_DATA_XFER_ERROR:
>> +		case NVME_SC_INTERNAL:
>> +		case NVME_SC_SANITIZE_FAILED:
>> +			return EIO;
>> +		case NVME_SC_POWER_LOSS:
>> +		case NVME_SC_ABORT_REQ:
>> +		case NVME_SC_ABORT_QUEUE:
>> +		case NVME_SC_FUSED_FAIL:
>> +		case NVME_SC_FUSED_MISSING:
>> +			return EWOULDBLOCK;
>> +		case NVME_SC_CMD_SEQ_ERROR:
>> +			return EILSEQ;
>> +		case NVME_SC_SANITIZE_IN_PROGRESS:
>> +			return EINPROGRESS;
>> +		case NVME_SC_NS_WRITE_PROTECTED:
>> +		case NVME_SC_NS_NOT_READY:
>> +		case NVME_SC_RESERVATION_CONFLICT:
>> +			return EACCES;
>> +		case NVME_SC_LBA_RANGE:
>> +			return EREMOTEIO;
>> +		case NVME_SC_CAP_EXCEEDED:
>> +			return ENOSPC;
>> +		}
> 
> Please move above switch to the small helper inline function
> 
> nvme_status_code_generic().

I would like to have it indicating "errno" concept in the function name. 
  I'll make them like:
   nvme_generic_status_to_errno()
   nvme_cmd_specific_status_to_errno()
   nvme_fabrics_status_to_errno()

  reply	other threads:[~2019-05-11 22:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-11 19:37 [PATCH RFC 0/4] nvme-cli: Introduce nvme-status mapping with errno Minwoo Im
2019-05-11 19:37 ` [PATCH 1/4] nvme.h: Fix typos in status code values Minwoo Im
2019-05-11 21:51   ` Chaitanya Kulkarni
2019-05-11 19:37 ` [PATCH RFC 2/4] nvme-status: Introduce nvme status module to map errno Minwoo Im
2019-05-11 21:58   ` Chaitanya Kulkarni
2019-05-11 22:24     ` Minwoo Im [this message]
2019-05-12 15:22       ` Chaitanya Kulkarni
2019-05-11 19:37 ` [PATCH RFC 3/4] nvme: Return errno mapped for nvme error status Minwoo Im
2019-05-11 19:37 ` [PATCH RFC 4/4] fabrics: Return errno mapped for fabrics " Minwoo Im

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5bcca563-73c9-a588-d656-9b612aedad20@gmail.com \
    --to=minwoo.im.dev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.