]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print-stdout: add get feature pls mode print
authorTokunori Ikegami <ikegami.t@gmail.com>
Sun, 12 Jan 2025 08:00:08 +0000 (17:00 +0900)
committerDaniel Wagner <wagi@monom.org>
Mon, 13 Jan 2025 17:29:34 +0000 (18:29 +0100)
This change required libnvme FEAT_PLS_MODE definition added.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
nvme-print-stdout.c
nvme-print.c
nvme-print.h

index fe3c971e319ed2f3b6091e0de6418ad48766f5d3..4a8a95dff2ddcea69f32987c5c80f4a58a37d742 100644 (file)
@@ -4971,6 +4971,10 @@ static void stdout_feature_show_fields(enum nvme_features_id fid,
        case NVME_FEAT_FID_SPINUP_CONTROL:
                printf("\tSpinup control feature Enabled: %s\n", (result & 1) ? "True" : "False");
                break;
+       case NVME_FEAT_FID_POWER_LOSS_SIGNAL:
+               printf("\tPower Loss Signaling Mode (PLSM): %s\n",
+                      nvme_pls_mode_to_string(NVME_GET(result, FEAT_PLS_MODE)));
+               break;
        case NVME_FEAT_FID_ENH_CTRL_METADATA:
        case NVME_FEAT_FID_CTRL_METADATA:
        case NVME_FEAT_FID_NS_METADATA:
index b94d2356ff7a0eaad4ddc4f7b3fef873b58ed765..e95d21e00e136d8aa61a798f97c60e59c4f487eb 100644 (file)
@@ -1349,6 +1349,22 @@ const char *nvme_time_scale_to_string(__u8 ts)
        return "Reserved";
 }
 
+const char *nvme_pls_mode_to_string(__u8 mode)
+{
+       switch (mode) {
+       case 0:
+               return "not enabled";
+       case 1:
+               return "enabled with Emergency Power Fail";
+       case 2:
+               return "enabled with Forced Quiescence";
+       default:
+               break;
+       }
+
+       return "Reserved";
+}
+
 void nvme_feature_show(enum nvme_features_id fid, int sel, unsigned int result)
 {
        nvme_print(show_feature, NORMAL, fid, sel, result);
index f6096a87737c5cd4659d66ec006d24ad7bd5cc75..6fedd5840c18011f6177ec5d5658f4b13d1a198f 100644 (file)
@@ -313,6 +313,7 @@ const char *nvme_pel_rci_rcpit_to_string(enum nvme_pel_rci_rcpit rcpit);
 const char *nvme_pel_ehai_pit_to_string(enum nvme_pel_ehai_pit pit);
 const char *nvme_ssi_state_to_string(__u8 state);
 const char *nvme_time_scale_to_string(__u8 ts);
+const char *nvme_pls_mode_to_string(__u8 mode);
 
 void nvme_dev_full_path(nvme_ns_t n, char *path, size_t len);
 void nvme_generic_full_path(nvme_ns_t n, char *path, size_t len);