]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
ioctl: use available Identify helper functions
authorCaleb Sander <csander@purestorage.com>
Sat, 12 Aug 2023 20:50:03 +0000 (14:50 -0600)
committerDaniel Wagner <wagi@monom.org>
Thu, 17 Aug 2023 12:56:12 +0000 (14:56 +0200)
nvme_identify_independent_identify_ns() only specifies a CNS and a NSID,
so have it just call nvme_identify_cns_nsid()
instead of duplicating most of its implementation.
Similarly, nvme_zns_identify_ns() is just nvme_identify_ns_csi()
with the CSI set to ZNS and no UUID index.

Signed-off-by: Caleb Sander <csander@purestorage.com>
src/nvme/ioctl.h

index 8ce80a0bd1686344947d299066ae41a1d550aa8b..47d8625e435752c14d4290215890fa1d23c4f2b7 100644 (file)
@@ -980,21 +980,8 @@ static inline int nvme_identify_allocated_ns_list_csi(int fd, __u32 nsid,
 static inline int nvme_identify_independent_identify_ns(int fd, __u32 nsid,
                        struct nvme_id_independent_id_ns *ns)
 {
-       struct nvme_identify_args args = {
-               .result = NULL,
-               .data = ns,
-               .args_size = sizeof(args),
-               .fd = fd,
-               .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
-               .cns = NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS,
-               .csi = NVME_CSI_NVM,
-               .nsid = nsid,
-               .cntid = NVME_CNTLID_NONE,
-               .cns_specific_id = NVME_CNSSPECID_NONE,
-               .uuidx = NVME_UUID_NONE,
-       };
-
-       return nvme_identify(&args);
+       return nvme_identify_cns_nsid(
+               fd, NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS, nsid, ns);
 }
 
 /**
@@ -1193,20 +1180,8 @@ static inline int nvme_identify_iocs(int fd, __u16 cntlid,
 static inline int nvme_zns_identify_ns(int fd, __u32 nsid,
                        struct nvme_zns_id_ns *data)
 {
-       struct nvme_identify_args args = {
-               .result = NULL,
-               .data = data,
-               .args_size = sizeof(args),
-               .fd = fd,
-               .timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
-               .cns = NVME_IDENTIFY_CNS_CSI_NS,
-               .csi = NVME_CSI_ZNS,
-               .nsid = nsid,
-               .cntid = NVME_CNTLID_NONE,
-               .cns_specific_id = NVME_CNSSPECID_NONE,
-       };
-
-       return nvme_identify(&args);
+       return nvme_identify_ns_csi(
+               fd, nsid, NVME_UUID_NONE, NVME_CSI_ZNS, data);
 }
 
 /**