]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
ioctl: add 'nsid' parameter to nvme_identify_secondary_ctrl_list()
authorHannes Reinecke <hare@suse.de>
Mon, 14 Jun 2021 11:39:13 +0000 (13:39 +0200)
committerHannes Reinecke <hare@suse.de>
Wed, 16 Jun 2021 06:22:00 +0000 (08:22 +0200)
nvme_identify_secondary_ctrl_list() can relate to specific nsids,
so allow the nsid parameter to be settable.

Signed-off-by: Hannes Reinecke <hare@suse.de>
src/nvme/ioctl.c
src/nvme/ioctl.h
test/test.c

index f4960f6f9575982d9136fb97844db483291fc364..edc4433b95a45f917e67d6b2ac2c57d95083925b 100644 (file)
@@ -456,12 +456,12 @@ int nvme_identify_primary_ctrl(int fd, __u16 cntid,
                             NVME_UUID_NONE, NVME_CSI_NVM, cap);
 }
 
-int nvme_identify_secondary_ctrl_list(int fd, __u16 cntid,
+int nvme_identify_secondary_ctrl_list(int fd, __u32 nsid, __u16 cntid,
        struct nvme_secondary_ctrl_list *list)
 {
        BUILD_ASSERT(sizeof(struct nvme_secondary_ctrl_list) == 4096);
        return nvme_identify(fd, NVME_IDENTIFY_CNS_SECONDARY_CTRL_LIST,
-                            NVME_NSID_NONE, cntid, NVME_NVMSETID_NONE,
+                            nsid, cntid, NVME_NVMSETID_NONE,
                             NVME_UUID_NONE, NVME_CSI_NVM, list);
 }
 
index 2878cd01c943c923050f7272340f8b62b1febd81..ef6faf1d1e145a3a048270b5c00550abe2699f62 100644 (file)
@@ -985,6 +985,7 @@ int nvme_identify_primary_ctrl(int fd, __u16 cntid,
 /**
  * nvme_identify_secondary_ctrl_list() - Retrieves secondary controller list
  * @fd:                File descriptor of nvme device
+ * @nsid:      Namespace identifier
  * @cntid:     Return controllers starting at this identifier
  * @sc_list:   User space destination address to transfer the data
  *
@@ -999,7 +1000,7 @@ int nvme_identify_primary_ctrl(int fd, __u16 cntid,
  * Return: The nvme command status if a response was received (see
  * &enum nvme_status_field) or -1 with errno set otherwise.
  */
-int nvme_identify_secondary_ctrl_list(int fd, __u16 cntid,
+int nvme_identify_secondary_ctrl_list(int fd, __u32 nsid, __u16 cntid,
                                      struct nvme_secondary_ctrl_list *list);
 
 /**
index fc9c21ef084779bd94a68d2a4ed6b768aea2e90a..7c6a5cb8356840c15dfe5834263d04f1cb38bade 100644 (file)
@@ -101,7 +101,7 @@ static int test_ctrl(nvme_ctrl_t c)
                printf("  Identify Primary:\n");
        else
                printf("  ERROR: Identify Primary:%x\n", ret);
-       ret = nvme_identify_secondary_ctrl_list(fd, 0, &sec);
+       ret = nvme_identify_secondary_ctrl_list(fd, 1, 0, &sec);
        if (!ret)
                printf("  Identify Secondary:\n");
        else