Skip to content

Commit a30b01f

Browse files
ikegami-tigaw
authored andcommitted
nvme-print: Add PEL RCI port identifier type printf function
Change to use NVME_PEL_RCI_RCPIT definitions. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent 90a4f0d commit a30b01f

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

nvme-print-stdout.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,11 @@ static void stdout_persistent_event_log_rci(__le32 pel_header_rci)
224224
__u8 rcpit = NVME_PEL_RCI_RCPIT(rci);
225225
__u16 rcpid = NVME_PEL_RCI_RCPID(rci);
226226

227-
if(rsvd19)
227+
if (rsvd19)
228228
printf(" [31:19] : %#x\tReserved\n", rsvd19);
229-
printf("\tReporting Context Exists (RCE): %s(%u)\n",
230-
rce ? "true" : "false", rce);
229+
printf("\tReporting Context Exists (RCE): %s(%u)\n", rce ? "true" : "false", rce);
231230
printf("\tReporting Context Port Identifier Type (RCPIT): %u(%s)\n", rcpit,
232-
(rcpit == 0x00) ? "Does not already exist" :
233-
(rcpit == 0x01) ? "NVM subsystem port" :
234-
(rcpit == 0x02) ? "NVMe-MI port" : "Reserved");
231+
nvme_pel_rci_rcpit_to_string(rcpit));
235232
printf("\tReporting Context Port Identifier (RCPID): %#x\n\n", rcpid);
236233
}
237234

nvme-print.c

+15
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,21 @@ const char *nvme_host_metadata_type_to_string(enum nvme_features_id fid,
950950
}
951951
}
952952

953+
const char *nvme_pel_rci_rcpit_to_string(enum nvme_pel_rci_rcpit rcpit)
954+
{
955+
switch (rcpit) {
956+
case NVME_PEL_RCI_RCPIT_NOT_EXIST:
957+
return "Does not already exist";
958+
case NVME_PEL_RCI_RCPIT_EST_PORT:
959+
return "NVM subsystem port";
960+
case NVME_PEL_RCI_RCPIT_EST_ME:
961+
return "NVMe-MI port";
962+
default:
963+
break;
964+
}
965+
return "Reserved";
966+
}
967+
953968
void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
954969
{
955970
nvme_print(show_feature, NORMAL, fid, sel, result);

nvme-print.h

+1
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ const char *nvme_zone_state_to_string(__u8 state);
302302
const char *nvme_zone_type_to_string(__u8 cond);
303303
const char *nvme_plm_window_to_string(__u32 plm);
304304
const char *nvme_ns_wp_cfg_to_string(enum nvme_ns_write_protect_cfg state);
305+
const char *nvme_pel_rci_rcpit_to_string(enum nvme_pel_rci_rcpit rcpit);
305306

306307
void nvme_dev_full_path(nvme_ns_t n, char *path, size_t len);
307308
void nvme_generic_full_path(nvme_ns_t n, char *path, size_t len);

0 commit comments

Comments
 (0)