From: Francis Pravin Date: Fri, 9 Aug 2024 11:42:03 +0000 (+0530) Subject: nvme-print: use Completion Condition enum X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3a1048e5de4184cc8e884a0afa11aac0c12d37f2;p=users%2Fsagi%2Fnvme-cli.git nvme-print: use Completion Condition enum Use the Completion Condition enum for LBA Status Descriptor. Also, modified the print statement of Completion Condition. Signed-off-by: Francis Pravin --- diff --git a/nvme-print-json.c b/nvme-print-json.c index e71dea54..ce094ec4 100644 --- a/nvme-print-json.c +++ b/nvme-print-json.c @@ -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; diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index b9d902ab..acecd1ac 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -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;