Skip to content

Commit f4448cd

Browse files
committed
nvme-print-stdout: use libnvme FDP events feature definitions
This is to reduce to use the bitwise operators. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent f9ec2cf commit f4448cd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nvme-print-stdout.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,14 @@ static void stdout_add_bitmap(int i, __u8 seb)
246246
}
247247
}
248248

249-
static void stdout_persistent_event_log_fdp_events(unsigned int cdw11,
250-
unsigned int cdw12,
249+
static void stdout_persistent_event_log_fdp_events(unsigned int cdw11, unsigned int cdw12,
251250
unsigned char *buf)
252251
{
253-
unsigned int num = (cdw11 >> 16) & 0xff;
252+
unsigned int num = NVME_GET(cdw11, FEAT_FDPE_NOET);
254253

255254
for (unsigned int i = 0; i < num; i++) {
256255
printf("\t%-53s: %sEnabled\n", nvme_fdp_event_to_string(buf[i]),
257-
cdw12 & 0x1 ? "" : "Not ");
256+
NVME_GET(cdw12, FDP_SUPP_EVENT_ENABLED) ? "" : "Not ");
258257
}
259258
}
260259

@@ -497,16 +496,17 @@ static void stdout_persistent_event_log(void *pevent_log_info,
497496
fid = NVME_GET(le32_to_cpu(set_feat_event->cdw_mem[0]), FEATURES_CDW10_FID);
498497
cdw11 = le32_to_cpu(set_feat_event->cdw_mem[1]);
499498

500-
printf("Set Feature ID :%#02x (%s), value:%#08x\n", fid,
501-
nvme_feature_to_string(fid), cdw11);
499+
printf("Set Feature ID: 0x%02x (%s), value: 0x%08x\n", fid,
500+
nvme_feature_to_string(fid), cdw11);
502501
if (NVME_SET_FEAT_EVENT_MB_COUNT(set_feat_event->layout)) {
503502
mem_buf = (unsigned char *)set_feat_event + 4 + dword_cnt * 4;
504503
if (fid == NVME_FEAT_FID_FDP_EVENTS) {
505504
cdw12 = le32_to_cpu(set_feat_event->cdw_mem[2]);
506505
stdout_persistent_event_log_fdp_events(cdw11, cdw12,
507506
mem_buf);
508-
} else
507+
} else {
509508
stdout_feature_show_fields(fid, cdw11, mem_buf);
509+
}
510510
}
511511
break;
512512
case NVME_PEL_TELEMETRY_CRT:

0 commit comments

Comments
 (0)