Skip to content

Commit fbb34d3

Browse files
ikegami-tigaw
authored andcommitted
nvme-print-stdout: add get feature pls mode print
This change required libnvme FEAT_PLS_MODE definition added. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 7f5999e commit fbb34d3

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

nvme-print-stdout.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4971,6 +4971,10 @@ static void stdout_feature_show_fields(enum nvme_features_id fid,
49714971
case NVME_FEAT_FID_SPINUP_CONTROL:
49724972
printf("\tSpinup control feature Enabled: %s\n", (result & 1) ? "True" : "False");
49734973
break;
4974+
case NVME_FEAT_FID_POWER_LOSS_SIGNAL:
4975+
printf("\tPower Loss Signaling Mode (PLSM): %s\n",
4976+
nvme_pls_mode_to_string(NVME_GET(result, FEAT_PLS_MODE)));
4977+
break;
49744978
case NVME_FEAT_FID_ENH_CTRL_METADATA:
49754979
case NVME_FEAT_FID_CTRL_METADATA:
49764980
case NVME_FEAT_FID_NS_METADATA:

nvme-print.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,6 +1349,22 @@ const char *nvme_time_scale_to_string(__u8 ts)
13491349
return "Reserved";
13501350
}
13511351

1352+
const char *nvme_pls_mode_to_string(__u8 mode)
1353+
{
1354+
switch (mode) {
1355+
case 0:
1356+
return "not enabled";
1357+
case 1:
1358+
return "enabled with Emergency Power Fail";
1359+
case 2:
1360+
return "enabled with Forced Quiescence";
1361+
default:
1362+
break;
1363+
}
1364+
1365+
return "Reserved";
1366+
}
1367+
13521368
void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
13531369
{
13541370
nvme_print(show_feature, NORMAL, fid, sel, result);

nvme-print.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ const char *nvme_pel_rci_rcpit_to_string(enum nvme_pel_rci_rcpit rcpit);
313313
const char *nvme_pel_ehai_pit_to_string(enum nvme_pel_ehai_pit pit);
314314
const char *nvme_ssi_state_to_string(__u8 state);
315315
const char *nvme_time_scale_to_string(__u8 ts);
316+
const char *nvme_pls_mode_to_string(__u8 mode);
316317

317318
void nvme_dev_full_path(nvme_ns_t n, char *path, size_t len);
318319
void nvme_generic_full_path(nvme_ns_t n, char *path, size_t len);

0 commit comments

Comments
 (0)