@@ -87,6 +87,52 @@ __u8 nvme_status_to_errno(int status, bool fabrics);
8787 */
8888const char * nvme_status_to_string (int status , bool fabrics );
8989
90+ /**
91+ * nvme_sanitize_ns_status_to_string() - Returns sanitize ns status string.
92+ * @sc: Return status code from an sanitize ns command
93+ *
94+ * Return: The sanitize ns status string if it is a specific status code.
95+ */
96+ static inline const char *
97+ nvme_sanitize_ns_status_to_string (__u16 sc )
98+ {
99+ switch (sc ) {
100+ case NVME_SC_EXCEEDS_MAX_NS_SANITIZE :
101+ return "Req Exceeds Max NS Sanitize Operations In Progress" ;
102+ default :
103+ break ;
104+ }
105+
106+ return NULL ;
107+ };
108+
109+ /**
110+ * nvme_opcode_status_to_string() - Returns nvme opcode status string.
111+ * @status: Return status from an nvme passthrough command
112+ * @admin: Set to true if an admin command
113+ * @opcode: Opcode from an nvme passthrough command
114+ *
115+ * Return: The nvme opcode status string if it is an nvme status field,
116+ * or a standard errno string if status is < 0.
117+ */
118+ static inline const char *
119+ nvme_opcode_status_to_string (int status , bool admin , __u8 opcode )
120+ {
121+ __u16 sct = nvme_status_code_type (status );
122+ __u16 sc = nvme_status_code (status );
123+ const char * s = NULL ;
124+
125+ if (status >= 0 && sct == NVME_SCT_CMD_SPECIFIC ) {
126+ if (admin && opcode == nvme_admin_sanitize_ns )
127+ s = nvme_sanitize_ns_status_to_string (sc );
128+ }
129+
130+ if (s )
131+ return s ;
132+
133+ return nvme_status_to_string (status , false);
134+ }
135+
90136/**
91137 * nvme_errno_to_string() - Returns string describing nvme connect failures
92138 * @err: Returned error code from nvme_add_ctrl()
0 commit comments