]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print: use Completion Condition enum
authorFrancis Pravin <francis.p@samsung.com>
Fri, 9 Aug 2024 11:42:03 +0000 (17:12 +0530)
committerDaniel Wagner <wagi@monom.org>
Tue, 13 Aug 2024 07:17:44 +0000 (09:17 +0200)
Use the Completion Condition enum for LBA Status Descriptor.
Also, modified the print statement of Completion Condition.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
nvme-print-json.c
nvme-print-stdout.c

index e71dea54f5e90d60602734cf23a7a535b318ee1a..ce094ec40b8b1ef7a15acbb807b7776441dbf662 100644 (file)
@@ -1853,13 +1853,20 @@ static void json_lba_status(struct nvme_lba_status *list,
        obj_add_uint(r, "Completion Condition (CMPC)", list->cmpc);
 
        switch (list->cmpc) {
-       case 1:
+       case NVME_LBA_STATUS_CMPC_NO_CMPC:
+               obj_add_str(r, "cmpc-definition", "No indication of the completion condition");
+               break;
+       case NVME_LBA_STATUS_CMPC_INCOMPLETE:
                obj_add_str(r, "cmpc-definition",
-                   "Completed due to transferring the amount of data specified in the MNDW field");
+                       "Completed transferring the amount of data specified in the"\
+                       "MNDW field. But, additional LBA Status Descriptor Entries are"\
+                       "available to transfer or scan did not complete (if ATYPE = 10h)");
                break;
-       case 2:
+       case NVME_LBA_STATUS_CMPC_COMPLETE:
                obj_add_str(r, "cmpc-definition",
-                   "Completed due to having performed the action specified in the Action Type field over the number of logical blocks specified in the Range Length field");
+                       "Completed the specified action over the number of LBAs specified"\
+                       "in the Range Length field and transferred all available LBA Status"\
+                       "Descriptor Entries");
                break;
        default:
                break;
index b9d902abaaa45d1e6fb105299587f388e0e915d0..acecd1ac3d3e818b4241ac40401793e7a2bc0a13 100644 (file)
@@ -4685,15 +4685,18 @@ static void stdout_lba_status(struct nvme_lba_status *list,
        printf("Completion Condition(CMPC): %u\n", list->cmpc);
 
        switch (list->cmpc) {
-       case 1:
-               printf("\tCompleted due to transferring the amount of data"\
-                       " specified in the MNDW field\n");
+       case NVME_LBA_STATUS_CMPC_NO_CMPC:
+               printf("\tNo indication of the completion condition\n");
                break;
-       case 2:
-               printf("\tCompleted due to having performed the action\n"\
-                       "\tspecified in the Action Type field over the\n"\
-                       "\tnumber of logical blocks specified in the\n"\
-                       "\tRange Length field\n");
+       case NVME_LBA_STATUS_CMPC_INCOMPLETE:
+               printf("\tCompleted transferring the amount of data specified in the\n"\
+                       "\tMNDW field. But, additional LBA Status Descriptor Entries are\n"\
+                       "\tavailable to transfer or scan did not complete (if ATYPE = 10h)\n");
+               break;
+       case NVME_LBA_STATUS_CMPC_COMPLETE:
+               printf("\tCompleted the specified action over the number of LBAs specified\n"\
+                       "\tin the Range Length field and transferred all available LBA Status\n"\
+                       "\tDescriptor Entries\n");
                break;
        default:
                break;