summaryrefslogtreecommitdiffstats
path: root/test/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.c')
-rw-r--r--test/test.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/test.c b/test/test.c
index 2f24e1e..23036bb 100644
--- a/test/test.c
+++ b/test/test.c
@@ -16,6 +16,7 @@
* somewhere.
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <inttypes.h>
@@ -112,7 +113,7 @@ static int test_ctrl(nvme_ctrl_t c)
printf(" PASSED: Identify Primary\n");
else
printf(" ERROR: Identify Primary:%x\n", ret);
- ret = nvme_identify_secondary_ctrl_list(fd, 1, 0, &sec);
+ ret = nvme_identify_secondary_ctrl_list(fd, 0, &sec);
if (!ret)
printf(" PASSED: Identify Secondary\n");
else
@@ -197,7 +198,7 @@ static int test_ctrl(nvme_ctrl_t c)
printf(" Temperature Threshold:%x\n", result);
else if (ret > 0)
printf(" ERROR: Temperature Threshold:%x\n", ret);
- ret = nvme_get_features_err_recovery(fd, sel, &result);
+ ret = nvme_get_features_err_recovery2(fd, sel, 0, &result);
if (!ret)
printf(" Error Recovery:%x\n", result);
else if (ret > 0)
@@ -257,12 +258,12 @@ static int test_ctrl(nvme_ctrl_t c)
printf(" SW Progress Marker:%x\n", result);
else if (ret > 0)
printf(" ERROR: Sanitize:%x\n", ret);
- ret = nvme_get_features_resv_mask(fd, sel, &result);
+ ret = nvme_get_features_resv_mask2(fd, sel, 0, &result);
if (!ret)
printf(" Reservation Mask:%x\n", result);
else if (ret > 0)
printf(" ERROR: Reservation Mask:%x\n", ret);
- ret = nvme_get_features_resv_persist(fd, sel, &result);
+ ret = nvme_get_features_resv_persist2(fd, sel, 0, &result);
if (!ret)
printf(" Reservation Persistence:%x\n", result);
else if (ret > 0)
@@ -274,7 +275,7 @@ static int test_namespace(nvme_ns_t n)
{
int ret, nsid = nvme_ns_get_nsid(n), fd = nvme_ns_get_fd(n);
struct nvme_id_ns ns = { 0 }, allocated = { 0 };
- struct nvme_ns_id_desc descs = { 0 };
+ struct nvme_ns_id_desc *descs;
__u32 result = 0;
__u8 flbas;
@@ -292,11 +293,16 @@ static int test_namespace(nvme_ns_t n)
printf(" Identify allocated ns\n");
else
printf(" ERROR: Identify allocated ns:%x\n", ret);
- ret = nvme_identify_ns_descs(fd, nsid, &descs);
+ descs = malloc(NVME_IDENTIFY_DATA_SIZE);
+ if (!descs)
+ return -1;
+
+ ret = nvme_identify_ns_descs(fd, nsid, descs);
if (!ret)
printf(" Identify NS Descriptors\n");
else
printf(" ERROR: Identify NS Descriptors:%x\n", ret);
+ free(descs);
ret = nvme_get_features_write_protect(fd, nsid,
NVME_GET_FEATURES_SEL_CURRENT, &result);
if (!ret)